/* ===== Teacher Dashboard Styles ===== */
@import url('https://fonts.googleapis.com/css2?family=Lexend+Giga:wght@100..900&family=Lexend+Deca:wght@100..900&display=swap');

:root {
    --purple-dark: #2D2B55;
    --purple-mid: #4A4580;
    --purple-light: #6C63FF;
    --purple-glow: rgba(108, 99, 255, 0.3);
    --accent-orange: #F39C12;
    --accent-green: #2ECC71;
    --error-red: #E74C3C;
    --text-white: #FFFFFF;
    --text-light: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.45);
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-bg-hover: rgba(255, 255, 255, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-glow: 0 8px 32px rgba(108, 99, 255, 0.2);
    --transition: 0.25s ease;
    --font-display: 'Lexend Giga', sans-serif;
    --font-body: 'Lexend Deca', sans-serif;
    --sidebar-width: 240px;
}

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

body {
    font-family: var(--font-body);
    background: linear-gradient(135deg, var(--purple-dark) 0%, var(--purple-mid) 50%, #3D3570 100%);
    color: var(--text-white);
    min-height: 100vh;
    display: flex;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: rgba(0, 0, 0, 0.25);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 50;
}

.sidebar-header {
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo-icon {
    font-size: 22px;
}

.sidebar-logo-text {
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 700;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-light);
    transition: all var(--transition);
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: var(--font-body);
}

.sidebar-link:hover {
    background: var(--glass-bg);
    color: var(--text-white);
}

.sidebar-link.active {
    background: var(--glass-bg-hover);
    color: var(--text-white);
    font-weight: 600;
}

.sidebar-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--glass-border);
}

.sidebar-signout {
    color: var(--text-muted);
}

.sidebar-signout:hover {
    color: var(--error-red);
    background: rgba(231, 76, 60, 0.1);
}

/* ===== Mobile Header ===== */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 60;
}

.mobile-title {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
}

.mobile-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.mobile-menu-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-white);
    border-radius: 2px;
    transition: all var(--transition);
}

.mobile-signout {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 8px;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px 40px;
    min-height: 100vh;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-title {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-subtitle {
    font-size: 0.9rem;
    color: var(--text-light);
}

/* ===== Dashboard Buttons ===== */
.btn-dash {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-dash-primary {
    background: linear-gradient(135deg, var(--purple-light), #8B7BFF);
    color: var(--text-white);
    box-shadow: 0 4px 16px rgba(108, 99, 255, 0.35);
}

.btn-dash-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(108, 99, 255, 0.5);
}

.btn-dash-secondary {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-white);
}

.btn-dash-secondary:hover {
    background: var(--glass-bg-hover);
}

.btn-dash-danger {
    background: rgba(231, 76, 60, 0.15);
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: #FF7675;
}

.btn-dash-danger:hover {
    background: rgba(231, 76, 60, 0.25);
}

.btn-dash-sm {
    padding: 8px 16px;
    font-size: 0.8rem;
}

.student-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.reset-pin-btn {
    background: rgba(46, 204, 113, 0.15);
    border: 1px solid rgba(46, 204, 113, 0.3);
    color: #55EFC4;
}

.reset-pin-btn:hover {
    background: rgba(46, 204, 113, 0.25);
}

.reset-pin-btn.pin-shown {
    background: rgba(243, 156, 18, 0.2);
    border-color: rgba(243, 156, 18, 0.4);
    color: #FDCB6E;
    font-weight: 700;
    letter-spacing: 1px;
}

/* ===== Classes Grid ===== */
.classes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.class-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--transition);
    color: var(--text-white);
    display: block;
}

.class-card:hover {
    background: var(--glass-bg-hover);
    border-color: var(--purple-light);
}

.class-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.class-card-name {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
}

.class-card-status {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.class-card-status.active {
    background: rgba(46, 204, 113, 0.15);
    color: #55EFC4;
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.class-card-status.inactive {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
}

.class-card-school {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 16px;
}

.class-card-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.class-card-info {
    flex: 1;
    min-width: 0;
}

.class-card-cover {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(255,255,255,0.05);
}

.class-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.class-card-journey {
    padding: 0 0 10px;
    min-height: 24px;
}

.class-card-journey-link {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--accent, #a78bfa);
    text-decoration: none;
    transition: color 0.15s;
}

.class-card-journey-link:hover {
    color: #fff;
    text-decoration: underline;
}

.class-card-attach-btn {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: 1px dashed rgba(255,255,255,0.2);
    border-radius: 6px;
    padding: 3px 10px;
    cursor: pointer;
    font-family: var(--font-body);
    transition: color 0.15s, border-color 0.15s;
}

.class-card-attach-btn:hover {
    color: var(--accent, #a78bfa);
    border-color: var(--accent, #a78bfa);
}

/* Attach Journey modal list */
.attach-journey-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.12s, border-color 0.12s;
    margin-bottom: 6px;
}

.attach-journey-item:hover {
    background: rgba(124,58,237,0.1);
    border-color: rgba(124,58,237,0.25);
}

.attach-journey-item input[type="radio"] {
    accent-color: var(--primary, #7C3AED);
    flex-shrink: 0;
}

.aji-icon { font-size: 1rem; flex-shrink: 0; }

.aji-title {
    flex: 1;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-white);
}

.aji-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.aji-official {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 700;
    background: rgba(34,197,94,0.15);
    border: 1px solid rgba(34,197,94,0.4);
    color: #4ade80;
    border-radius: 10px;
    padding: 1px 6px;
    margin-left: 6px;
    vertical-align: middle;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ── Attach Journey choice panel ── */
.modal-card-wide {
    max-width: 560px;
    width: 100%;
}

.attach-choice-intro {
    font-size: 0.82rem;
    color: var(--text-light);
    margin-bottom: 12px;
}

.attach-own-note {
    font-size: 0.82rem;
    color: #4ade80;
}

.attach-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.attach-option {
    display: flex;
    gap: 12px;
    padding: 14px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.attach-option:has(input:checked) {
    border-color: var(--primary, #7C3AED);
    background: rgba(124,58,237,0.08);
}

.attach-option input[type="radio"] {
    margin-top: 3px;
    accent-color: var(--primary, #7C3AED);
    flex-shrink: 0;
}

.attach-option-body { flex: 1; }

.attach-option-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.attach-rec-badge {
    font-size: 0.65rem;
    font-weight: 700;
    background: rgba(124,58,237,0.25);
    border: 1px solid rgba(124,58,237,0.5);
    color: #c4b5fd;
    border-radius: 10px;
    padding: 1px 7px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.attach-option-desc {
    font-size: 0.78rem;
    color: var(--text-light);
    line-height: 1.55;
}

.class-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.class-card-code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--accent-orange);
}

.class-card-count {
    font-size: 0.82rem;
    color: var(--text-light);
}

/* ===== Card Action Buttons ===== */
.class-card-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--glass-border);
}

.card-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition);
    cursor: pointer;
    border: 1px solid transparent;
}

.card-action-manage {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-light);
    border-color: var(--glass-border);
}

.card-action-manage:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-white);
    border-color: var(--purple-light);
}

.card-action-progress {
    background: rgba(99, 102, 241, 0.15);
    color: #A78BFA;
    border-color: rgba(99, 102, 241, 0.3);
}

.card-action-progress:hover {
    background: rgba(99, 102, 241, 0.25);
    color: #C4B5FD;
    border-color: rgba(99, 102, 241, 0.5);
}

.card-action-game {
    background: #FF7043;
    color: #fff;
    border-color: transparent;
    font-weight: 700;
    box-shadow: 0 3px 0 #D84315;
    transition: all 0.15s;
}

.card-action-game:hover {
    background: #F05A2A;
    color: #fff;
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 5px 0 #D84315;
}

.card-action-game:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #D84315;
}

.card-action-game-full {
    margin-top: 8px;
    width: 100%;
}

.card-action-btn svg {
    flex-shrink: 0;
}

/* ===== Empty / Loading States ===== */
.empty-state, .loading-state {
    text-align: center;
    padding: 60px 24px;
}

.empty-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
}

.empty-state h2 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--purple-light);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-state p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-card {
    background: linear-gradient(135deg, #3D3570, var(--purple-dark));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px 0;
}

.modal-header h2 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.modal-close:hover {
    background: var(--glass-bg);
    color: var(--text-white);
}

.modal-body {
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-footer {
    padding: 16px 28px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ===== Dashboard Forms ===== */
.form-group-dash {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label-dash {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-light);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.form-input-dash {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-white);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    width: 100%;
}

.form-input-dash::placeholder {
    color: var(--text-muted);
}

.form-input-dash:focus {
    border-color: var(--purple-light);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.3);
}

select.form-input-dash {
    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='rgba(255,255,255,0.5)' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

select.form-input-dash option {
    background: var(--purple-dark);
    color: var(--text-white);
}

.form-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.form-hint a {
    color: var(--purple-light);
    text-decoration: underline;
}

.form-message-dash {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.4;
    display: none;
}

.form-message-dash.error {
    display: block;
    background: rgba(231, 76, 60, 0.15);
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: #FF7675;
}

.form-message-dash.success {
    display: block;
    background: rgba(46, 204, 113, 0.15);
    border: 1px solid rgba(46, 204, 113, 0.3);
    color: #55EFC4;
}

.spinner-dash {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--text-white);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: none;
}

.btn-dash.loading .spinner-dash { display: block; }
.btn-dash.loading .btn-text { display: none; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-header {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        padding: 72px 16px 24px;
    }

    .page-title {
        font-size: 1.2rem;
    }

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

    .page-header {
        flex-direction: column;
    }

    .modal-card {
        width: 95%;
    }
}

/* ===== Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
