/*
 * Professor 360 - Professional Design System
 * Theme: "Intelligent Glass" - Modern, Clean, Accessible
 */

:root {
    /* --- Color Palette --- */
    /* Primary Blue */
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-900: #1e3a8a;

    /* Accent Gold/Warning */
    --accent-500: #f59e0b;
    --accent-glow: rgba(245, 158, 11, 0.4);

    /* Status Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Typography */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* --- Dark Theme (Default) --- */
    --bg-app: #0f172a;
    --bg-surface: #1e293b;
    --bg-surface-hover: #334155;

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    --border-color: rgba(255, 255, 255, 0.08);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);

    /* RGBA backgrounds for dark mode */
    --bg-subtle: rgba(15, 23, 42, 0.5);
    --bg-subtle-light: rgba(255, 255, 255, 0.02);
    --bg-subtle-hover: rgba(255, 255, 255, 0.05);
    --bg-primary-subtle: rgba(59, 130, 246, 0.08);
    --bg-primary-subtle-hover: rgba(59, 130, 246, 0.15);
    --bg-subtle-solid: rgba(15, 23, 42, 0.95);
    --border-subtle: rgba(255, 255, 255, 0.05);
    --border-primary: rgba(59, 130, 246, 0.2);
    --border-primary-focus: rgba(59, 130, 246, 0.3);
    --shadow-primary: 0 0 20px rgba(59, 130, 246, 0.4);
    --shadow-primary-subtle: 0 0 0 3px rgba(59, 130, 246, 0.15);
    --shadow-glow-primary: 0 2px 6px rgba(59, 130, 246, 0.4);
    --bg-gradient: radial-gradient(circle at top right, #1e293b 0%, #0f172a 40%);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

/* --- Light Theme --- */
:root[data-theme="light"] {
    --bg-app: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f1f5f9;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;

    --border-color: rgba(0, 0, 0, 0.1);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.15);

    /* RGBA backgrounds for light mode */
    --bg-subtle: rgba(0, 0, 0, 0.03);
    --bg-subtle-light: rgba(0, 0, 0, 0.01);
    --bg-subtle-hover: rgba(0, 0, 0, 0.04);
    --bg-primary-subtle: rgba(59, 130, 246, 0.08);
    --bg-primary-subtle-hover: rgba(59, 130, 246, 0.12);
    --bg-subtle-solid: rgba(255, 255, 255, 0.95);
    --border-subtle: rgba(0, 0, 0, 0.05);
    --border-primary: rgba(59, 130, 246, 0.15);
    --border-primary-focus: rgba(59, 130, 246, 0.25);
    --shadow-primary: 0 0 20px rgba(59, 130, 246, 0.2);
    --shadow-primary-subtle: 0 0 0 3px rgba(59, 130, 246, 0.1);
    --shadow-glow-primary: 0 2px 6px rgba(59, 130, 246, 0.25);
    --bg-gradient: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

/* --- Reset & Global --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    outline: none;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

html *,
html *::before,
html *::after {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-app);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

ul {
    list-style: none;
}

/* --- Animations --- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- App Layout --- */
.app-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    background-color: var(--bg-surface);
    border-right: var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    z-index: 10;
    overflow-y: auto;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding: 0 0.5rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-600), var(--primary-900));
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    box-shadow: var(--shadow-primary);
}

.logo-area h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    font-family: var(--font-heading);
}

.logo-area .highlight {
    color: var(--primary-500);
}

/* Navigation */
.main-nav ul {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.nav-header {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
    margin: 1.5rem 0 0.5rem 0.75rem;
}

.main-nav a {
    display: flex;
    align-items: center;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.95rem;
}

.main-nav a i {
    width: 22px;
    margin-right: 12px;
    font-size: 1.1rem;
    text-align: center;
    color: var(--text-muted);
    transition: 0.2s;
}

.main-nav a:hover {
    background: var(--bg-subtle-hover);
    color: var(--text-primary);
}

.main-nav li.active a {
    background: var(--bg-primary-subtle-hover);
    color: var(--primary-500);
    border: 1px solid var(--border-primary);
}

.main-nav li.active a i {
    color: var(--primary-500);
}

.nav-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: var(--border-color);
}

/* --- Main Content --- */
.main-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-gradient);
}

/* Top Bar */
.top-bar {
    height: 70px;
    border-bottom: var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2.5rem;
    background: var(--bg-subtle-solid);
    backdrop-filter: blur(12px);
    z-index: 5;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#page-title {
    font-weight: 600;
    font-size: 1.15rem;
    color: var(--text-primary);
}

#page-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    border-left: 1px solid var(--bg-surface-hover);
    padding-left: 1rem;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.03);
}

.icon-btn:hover {
    background: var(--bg-subtle-hover);
    color: var(--text-primary);
}

.user-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--bg-surface-hover);
    cursor: pointer;
    transition: border-color 0.2s;
}

.user-profile img:hover {
    border-color: var(--primary-500);
}

/* --- View Container --- */
.view-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    padding-bottom: 4rem;
    scroll-behavior: smooth;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.view {
    animation: fadeIn 0.3s ease-out;
}

.view.hidden {
    display: none;
}

.view.active {
    display: block;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-surface-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* --- Cards --- */
.card {
    background: var(--bg-surface);
    border: var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: all 0.2s;
    font-size: 0.95rem;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    border: 1px solid rgba(37, 99, 235, 0.5);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: var(--bg-surface-hover);
    color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
    border: none;
    transform: none;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--bg-surface-hover);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    border-color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* --- Inputs --- */
input,
select,
textarea {
    width: 100%;
    background: var(--bg-app);
    border: 1px solid var(--bg-surface-hover);
    color: var(--text-primary);
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    transition: all 0.2s;
    font-size: 0.95rem;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-500);
    box-shadow: var(--shadow-primary-subtle);
}

input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

/* --- Custom Checkboxes --- */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-500);
}

input[type="checkbox"]:hover {
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

/* --- Form Groups --- */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
}

.input-group {
    margin-bottom: 1.25rem;
}

.input-wrapper {
    display: flex;
    gap: 0.5rem;
}

.input-wrapper input {
    flex: 1;
}

.input-wrapper button {
    padding: 0 1rem;
}

/* --- Upload Box --- */
.upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.upload-box {
    border: 2px dashed var(--bg-surface-hover);
    border-radius: var(--radius-md);
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    background: var(--bg-subtle);
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    position: relative;
}

.upload-box:hover {
    border-color: var(--primary-500);
    background: rgba(59, 130, 246, 0.05);
}

.upload-box:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: var(--shadow-primary-subtle);
}

.upload-box i {
    font-size: 2.5rem;
    color: var(--text-muted);
    transition: 0.2s;
}

.upload-box:hover i {
    color: var(--primary-500);
}

.upload-box p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.upload-box .btn {
    margin-top: 0.5rem;
}

/* --- Range Selector --- */
.range-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-app);
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--bg-surface-hover);
}

.range-selector span {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    min-width: 60px;
}

input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: var(--bg-surface-hover);
    border-radius: 3px;
    border: none;
    padding: 0;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-500);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-glow-primary);
    transition: transform 0.2s;
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

input[type=range]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary-500);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-glow-primary);
}

/* --- Module Header --- */
.module-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: var(--border-color);
}

.module-header i {
    font-size: 1.5rem;
    color: var(--primary-500);
}

.module-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: var(--font-heading);
}

/* --- Step Tabs --- */
.step-tabs {
    display: flex;
    overflow-x: auto;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--bg-surface-hover);
    scrollbar-width: thin;
}

.step-tab {
    background: transparent;
    color: var(--text-muted);
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    white-space: nowrap;
    border: 1px solid transparent;
    font-weight: 500;
    font-size: 0.9rem;
}

.step-tab:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
}

.step-tab.active {
    background: var(--bg-primary-subtle-hover);
    color: var(--primary-500);
    border-color: var(--border-primary-focus);
}

/* --- Schedule Items --- */
.schedule-list {
    margin-top: 1rem;
}

.schedule-item {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 1.5rem;
    padding: 1.25rem;
    border-bottom: var(--border-color);
    align-items: center;
    transition: all 0.2s;
    animation: fadeIn 0.3s ease-out;
}

.schedule-item:last-child {
    border-bottom: none;
}

.schedule-item:hover {
    background: var(--bg-subtle-light);
    padding-left: 1.5rem;
}

.date-box {
    text-align: center;
    border-right: 2px solid;
    padding-right: 1rem;
    font-family: var(--font-heading);
}

.schedule-item .info-box h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.schedule-item .info-box p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* --- Hero Card --- */
.hero-card {
    background: linear-gradient(135deg, var(--bg-primary-subtle-hover), var(--bg-subtle));
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 2rem;
}

.hero-content h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-family: var(--font-heading);
}

.hero-content p {
    color: var(--text-secondary);
    max-width: 500px;
    margin-bottom: 1.75rem;
    line-height: 1.7;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.hero-visual {
    font-size: 4rem;
    color: var(--primary-500);
    animation: pulse 3s ease-in-out infinite;
}

/* --- Dashboard Grid --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.status-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.card-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.card-icon.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.card-icon.info {
    background: var(--bg-primary-subtle-hover);
    color: var(--info);
}

.card-icon.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.card-info h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.card-info p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.card-link {
    margin-top: auto;
    color: var(--primary-500);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: gap 0.2s;
}

.card-link:hover {
    gap: 0.75rem;
}

/* --- Badge --- */
.badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Interactive & Result Boxes --- */
.interactive-box {
    background: rgba(15, 23, 42, 0.8);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--bg-surface-hover);
}

.result-box {
    background: var(--bg-primary-subtle);
    border: 1px solid var(--primary-900);
    border-left: 4px solid var(--primary-500);
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    margin-top: 1.5rem;
    max-height: 500px;
    overflow-y: auto;
}

.editable-area {
    font-size: 1.05rem;
    line-height: 1.7;
    background: rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--bg-surface-hover);
    transition: all 0.2s;
    min-height: 100px;
}

.editable-area:hover,
.editable-area:focus {
    border-color: var(--primary-500);
    border-style: solid;
}

.editable-area:focus {
    box-shadow: var(--shadow-primary-subtle);
}

/* --- Warning Box --- */
.warning-box {
    padding: 1rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.warning-box i {
    color: var(--warning);
    margin-right: 0.5rem;
}

.warning-box code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* --- Utilities --- */
.text-muted {
    color: var(--text-muted);
}

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* --- Slider Indicator --- */
.slider-indicator #slider-value {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: color 0.3s ease, transform 0.2s ease;
}

/* --- Button Variants --- */
.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* --- Modal --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease-out;
    padding: 1rem;
}

.modal-content {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* --- Spinner --- */
.fa-spinner,
.fa-spin {
    animation: spin 1s linear infinite;
}

/* --- Chat Styles --- */
.chat-message {
    margin-bottom: 1rem;
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

.chat-message.user {
    justify-content: flex-end;
}

.chat-bubble {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    line-height: 1.5;
}

.chat-bubble.bot {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.chat-bubble.user {
    background: var(--primary-600);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-bubble ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.chat-bubble li {
    margin-bottom: 0.25rem;
}

/* --- XAI Grid --- */
.xai-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.xai-card {
    background: var(--bg-subtle);
    padding: 1.25rem;
    border-radius: var(--radius-sm);
    border-left: 3px solid;
}

.xai-card.high {
    border-left-color: var(--danger);
}

.xai-card.medium {
    border-left-color: var(--warning);
}

.xai-card.low {
    border-left-color: var(--success);
}

.xai-card h4 {
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.xai-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.xai-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--bg-subtle-hover);
}

.xai-metric-value {
    font-weight: bold;
    font-size: 1.1rem;
}

/* --- Student Detail Factors --- */
.factor-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}

.factor-item i {
    color: var(--warning);
    margin-top: 0.1rem;
}

.factor-item.high i {
    color: var(--danger);
}

.factor-item.low i {
    color: var(--success);
}

.factor-content {
    flex: 1;
}

.factor-label {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.factor-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* --- Recommendations --- */
.recommendation-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-primary-subtle);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}

.recommendation-item i {
    color: var(--primary-500);
    flex-shrink: 0;
}

.recommendation-text {
    font-size: 0.9rem;
    line-height: 1.5;
}

/* --- Student List Item --- */
.student-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    background: var(--bg-subtle-light);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.student-list-item:hover {
    background: var(--bg-subtle-hover);
    padding-left: 1.25rem;
}

.student-list-item.high-risk {
    border-left-color: var(--danger);
}

.student-list-item.medium-risk {
    border-left-color: var(--warning);
}

.student-list-item.low-risk {
    border-left-color: var(--success);
}

.student-info {
    flex: 1;
}

.student-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.student-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.student-risk-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

/* --- Charts & Analytics --- */
.chart-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Pie Chart */
.pie-chart {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    position: relative;
    background: conic-gradient(
        var(--danger) 0deg 90deg,
        var(--warning) 90deg 200deg,
        var(--success) 200deg 360deg
    );
    display: flex;
    align-items: center;
    justify-content: center;
}

.pie-chart::before {
    content: '';
    position: absolute;
    width: 100px;
    height: 100px;
    background: var(--bg-surface);
    border-radius: 50%;
}

.pie-legend {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.pie-legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
}

.pie-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* Bar Chart */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 0.8rem;
    height: 100%;
    padding: 1rem;
}

.bar-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.bar {
    width: 100%;
    background: var(--primary-500);
    border-radius: 4px 4px 0 0;
    transition: height 0.5s ease;
    position: relative;
    min-height: 20px;
}

.bar:hover {
    opacity: 0.8;
}

.bar-value {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    font-weight: bold;
    white-space: nowrap;
}

.bar-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

/* Scatter/Bubble Chart */
.scatter-chart {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 1rem;
}

.bubble {
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    color: white;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s;
}

.bubble:hover {
    transform: scale(1.1);
}

.bubble-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    margin-bottom: 0.3rem;
}

.bubble:hover .bubble-tooltip {
    opacity: 1;
}

/* --- Responsive Design --- */
@media (max-width: 1200px) {
    .app-container {
        grid-template-columns: 220px 1fr;
    }

    .sidebar {
        padding: 1rem;
    }

    .view-container {
        padding: 1.5rem;
    }
}

@media (max-width: 900px) {
    .app-container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        height: 100vh;
        width: 260px;
        transition: left 0.3s;
        z-index: 100;
        box-shadow: var(--shadow-lg);
    }

    .sidebar.active {
        left: 0;
    }

    .hero-card {
        flex-direction: column;
        text-align: center;
    }

    .hero-content p {
        margin-left: auto;
        margin-right: auto;
    }

    .action-buttons {
        justify-content: center;
    }

    .hero-visual {
        display: none;
    }

    .upload-grid {
        grid-template-columns: 1fr;
    }

    .schedule-item {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .date-box {
        border-right: none;
        border-bottom: 2px solid;
        padding-right: 0;
        padding-bottom: 0.5rem;
        text-align: left;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .xai-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .top-bar {
        padding: 0 1rem;
    }

    #page-subtitle {
        display: none;
    }

    .view-container {
        padding: 1rem;
    }

    .card {
        padding: 1.25rem;
    }

    .hero-content h2 {
        font-size: 1.5rem;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .chat-bubble {
        max-width: 90%;
    }
}

/* Manual navigation links hover effect */
#view-manual a[href^="#manual-"]:hover {
    background: var(--primary-500) !important;
    border-color: var(--primary-500) !important;
    color: white !important;
    transform: translateY(-2px);
}

#view-manual a[href^="#manual-"]:hover i,
#view-manual a[href^="#manual-"]:hover span {
    color: white !important;
}

/* Smooth scrolling for manual anchor links */
html {
    scroll-behavior: smooth;
}
