/* ==================== GLOBAL STYLES ==================== */

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

:root {
    --primary-color: #1e3a8a;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==================== NAVIGATION ==================== */

.navbar {
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: 700;
}

.nav-brand a {
    text-decoration: none;
    color: inherit;
}

.nav-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.user-name {
    color: var(--text-secondary);
    font-weight: 500;
}

/* ==================== BUTTONS ==================== */

.btn-primary,
.btn-secondary,
.btn-outline,
.btn-large {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==================== HERO SECTION ==================== */

.hero {
    padding: 4rem 0;
    text-align: center;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: white;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.gradient-text {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ==================== FEATURES SECTION ==================== */

.features {
    padding: 4rem 0;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
    color: var(--primary-color);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: var(--surface);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
    text-align: center;
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.feature-card p {
    color: var(--text-secondary);
}

/* ==================== CTA SECTIONS ==================== */

.cta-section {
    padding: 4rem 0;
    background: var(--primary-color);
    color: white;
    text-align: center;
}

.cta-section.secondary {
    background: var(--secondary-color);
}

.cta-content h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.cta-content p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

/* ==================== AUTH PAGES ==================== */

.auth-section {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
}

.auth-container {
    width: 100%;
    max-width: 500px;
    padding: 0 20px;
}

.auth-card {
    background: var(--surface);
    padding: 3rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
}

.auth-card h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    text-align: center;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Role Selection */
.role-selection {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.role-btn {
    flex: 1;
    padding: 1rem;
    background: var(--background);
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.role-btn:hover {
    border-color: var(--primary-color);
    background: rgba(30, 58, 138, 0.05);
}

.role-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.role-icon {
    font-size: 2rem;
}

/* Forms */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.form-group small {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.role-fields {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.error-message {
    background: #fee2e2;
    color: var(--error-color);
    padding: 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* ==================== MODAL ==================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--surface);
    padding: 2rem;
    border-radius: 1rem;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}

.modal-content h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.modal-content p {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

/* ==================== DASHBOARD ==================== */

.dashboard-section {
    padding: 2rem 0;
    min-height: calc(100vh - 80px);
}

.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-header h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.dashboard-header p {
    color: var(--text-secondary);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    font-size: 3rem;
}

.stat-content h3 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.stat-content p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Quick Actions */
.quick-actions,
.recent-activity,
.subject-progress {
    margin-bottom: 3rem;
}

.quick-actions h3,
.recent-activity h3,
.subject-progress h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.action-card {
    background: var(--surface);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.action-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.action-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.action-card h4 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.action-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Activity List */
.activity-list {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
}

.activity-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    font-size: 1.5rem;
}

.activity-content {
    flex: 1;
}

.activity-text {
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.activity-time {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
}

/* ==================== CHAT INTERFACE ==================== */

.chat-section {
    padding: 2rem 0;
    min-height: calc(100vh - 80px);
}

.chat-container {
    max-width: 900px;
    margin: 0 auto;
    background: var(--surface);
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 160px);
}

.chat-header {
    padding: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.chat-title h2 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.chat-title p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.chat-controls {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.chat-select {
    padding: 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.chat-input-small {
    width: 100px;
    padding: 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.user-message {
    flex-direction: row-reverse;
}

.ai-avatar,
.user-avatar,
.error-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.user-avatar {
    background: var(--secondary-color);
}

.error-icon {
    background: var(--error-color);
}

.message-content {
    max-width: 70%;
    padding: 1rem;
    border-radius: 1rem;
}

.user-content {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.ai-content {
    background: var(--background);
    border-bottom-left-radius: 0.25rem;
}

.error-content {
    background: #fee2e2;
    color: var(--error-color);
}

.welcome-message {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: white;
    padding: 2rem;
    border-radius: 1rem;
    margin-bottom: 1rem;
}

.welcome-message h3 {
    margin-bottom: 1rem;
}

.welcome-message ul {
    margin: 1rem 0 1rem 1.5rem;
}

.welcome-message li {
    margin: 0.5rem 0;
}

.typing-content {
    background: var(--background);
    padding: 1rem;
}

.typing-dots {
    display: flex;
    gap: 0.5rem;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

.audio-controls {
    margin-top: 1rem;
}

.audio-btn {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.audio-btn:hover {
    background: var(--primary-dark);
}

/* Chat Input */
.chat-input-container {
    padding: 1.5rem;
    border-top: 2px solid var(--border-color);
}

.chat-form {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.audio-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    white-space: nowrap;
}

.audio-toggle input {
    cursor: pointer;
}

.chat-send-btn {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
}

.chat-send-btn:hover {
    background: var(--primary-dark);
}

.chat-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==================== FOOTER ==================== */

.footer {
    background: var(--primary-color);
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 4rem;
}

.footer p {
    margin: 0.5rem 0;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .actions-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .role-selection {
        flex-direction: column;
    }

    .chat-controls {
        flex-direction: column;
    }

    .chat-select,
    .chat-input-small {
        width: 100%;
    }

    .message-content {
        max-width: 85%;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
}