/* ========================================
   MODULAR STATE MANAGEMENT STYLES
   ======================================== */

/* Main content layout */
.main-content {
    display: flex;
    gap: 0;
}

/* State Container - Wrapper for both chat and module states */
.state-container {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Allow flex shrinking */
}

/* Chat State - Original chat interface */
.chat-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    transition: opacity 0.3s ease;
    position: relative;
}

.chat-state.hidden {
    opacity: 0;
    pointer-events: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Module Container - Base for all modules */
.module-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--background);
    z-index: 50;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: none;
    flex-direction: column;
    pointer-events: none;
    overflow: hidden;
}

.module-container.active {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

/* Module Header */
.module-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 10;
}

.module-header .header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.module-back-btn,
.module-close-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    color: var(--text-color);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.module-back-btn:hover,
.module-close-btn:hover {
    background: var(--card-hover-bg);
    color: var(--primary-color);
}

.module-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.module-title i {
    color: var(--primary-color);
    font-size: 24px;
}

/* Module Content */
.module-content {
    flex: 1;
    overflow-y: auto;
    position: relative;
    padding: 20px;
}

.module-main-content {
    max-width: 1200px;
    margin: 0 auto;
}

/* Module Section */
.module-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.module-section .section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.module-section .section-title i {
    color: var(--primary-color);
    font-size: 18px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .module-header {
        padding: 12px 16px;
    }
    
    .module-title {
        font-size: 18px;
    }
    
    .module-content {
        padding: 12px;
    }
    
    .module-section {
        padding: 16px;
    }
}

/* Animation Keyframes */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

/* Module State Indicators */
.module-indicator {
    position: fixed;
    top: 80px;
    right: 20px;
    background: var(--primary-color);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    z-index: 1000;
    display: none;
    animation: fadeIn 0.3s ease;
}

.module-indicator.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Module Navigation Buttons (for triggering module switch) */
.open-module-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.open-module-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--primary-color-rgb), 0.3);
}

.open-module-btn i {
    font-size: 16px;
}
