/* Base Styles */
:root {
    --primary-color: #4a6fa5;
    --secondary-color: #6b8cae;
    --accent-color: #3d5a80;
    --text-color: #333333;
    --light-text: #ffffff;
    --background-color: #f5f7fa;
    --sidebar-bg: #2c3e50;
    --sidebar-active: #1a2530;
    --border-color: #e1e5eb;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --background-light: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    height: 100vh;
    margin: 0;
}

a {
    text-decoration: none;
    color: var(--primary-color);
}

ul {
    list-style: none;
}

button,
.button {
    cursor: pointer;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.primary-button {
    background-color: var(--primary-color);
    color: var(--light-text);
}

.primary-button:hover {
    background-color: var(--accent-color);
}

.secondary-button {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.secondary-button:hover {
    background-color: var(--border-color);
}

/* AI Generation Button */
.btn-ai {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--light-text);
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 8px;
}

.btn-ai:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-ai:disabled {
    background: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ai-icon {
    font-size: 16px;
}

input,
select,
textarea {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    width: 100%;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    color: var(--light-text);
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.logo-container {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.main-nav ul li {
    margin-bottom: 10px;
}

.main-nav ul li a {
    display: flex;
    align-items: center;
    color: var(--light-text);
    padding: 10px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.main-nav ul li a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.main-nav ul li.active a {
    background-color: var(--sidebar-active);
}

.main-nav .icon {
    margin-right: 10px;
}

/* Mobile only nav */
.mobile-only-nav {
    display: none;
}

/* New Session Button */
.new-session-container {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.new-session-button {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--light-text);
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.new-session-button:hover {
    background: linear-gradient(135deg, var(--accent-color), var(--primary-color));
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.new-session-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.new-session-icon {
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
}

.user-info {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
}

.user-name {
    margin-top: 8px;
    font-weight: 500;
}

.user-role {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 4px;
}

/* User Actions in Sidebar */
.user-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    justify-content: center;
}

.sidebar .user-action {
    display: inline-block;
    color: #e8f4f8;
    text-decoration: none;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar .user-action:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.switch-role {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    text-align: center;
}

.switch-role a {
    color: var(--light-text);
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.1);
    transition: background-color 0.3s;
}

.switch-role a:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

header h1 {
    font-size: 24px;
    font-weight: 500;
}

.course-selector select {
    width: 200px;
}

/* Notifications */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 300px;
}

.notification {
    padding: 12px 16px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    animation: slide-in 0.3s ease-out;
    position: relative;
    padding-right: 30px;
}

.notification.success {
    background-color: var(--success-color);
    color: white;
}

.notification.info {
    background-color: var(--info-color);
    color: white;
}

.notification.warning {
    background-color: var(--warning-color);
    color: #333;
}

.notification.error {
    background-color: var(--danger-color);
    color: white;
}

.notification-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    color: inherit;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
}

.notification-close:hover {
    opacity: 1;
}

@keyframes slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive */
/* Mobile Header Toggle - Default Hidden */
.mobile-header-toggle {
    display: none;
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        padding: 10px;
    }

    .main-nav ul {
        display: flex;
        justify-content: space-around;
    }

    .user-info {
        display: none;
    }

    .notification-container {
        width: calc(100% - 40px);
        max-width: none;
    }

    .mobile-only-nav {
        display: block;
    }

    /* Optimize header space on mobile */
    .new-session-container {
        margin-top: 10px;
        padding-top: 10px;
    }

    .new-session-button {
        padding: 8px 12px;
        font-size: 13px;
    }

    /* Compact header on mobile */
    header {
        margin-bottom: 10px;
        padding-bottom: 10px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    header h1 {
        font-size: 20px;
    }

    /* Mobile Header Toggle Styles */
    .logo-container {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-bottom: 15px;
        /* adjust padding */
    }

    .mobile-header-toggle {
        background: rgba(255, 255, 255, 0.2);
        border: none;
        color: white;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        font-size: 14px;
        transition: background 0.3s;
    }

    .mobile-header-toggle:hover {
        background: rgba(255, 255, 255, 0.3);
    }

    /* Collapsed State */
    .mobile-collapsed .sidebar .main-nav,
    .mobile-collapsed .sidebar .user-info,
    .mobile-collapsed header,
    .mobile-collapsed .history-header,
    .mobile-collapsed .flagged-header {
        display: none !important;
    }

    .mobile-collapsed .sidebar {
        padding-bottom: 0;
        /* Minimal padding */
    }

    .mobile-collapsed .logo-container {
        margin-bottom: 10px;
        border-bottom: none;
    }
}