/**
 * Step Ahead IELTS - Teacher Admin Panel & Login Shield Stylesheet
 */

/* Locked test card styles */
.test-card.locked-card {
    position: relative !important;
    opacity: 0.7;
    border-color: #cbd5e1 !important;
    background-color: #f1f5f9 !important;
    cursor: pointer !important;
    box-shadow: none !important;
}

.test-card.locked-card::before {
    content: '🔒 Locked Test';
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #cbd5e1;
    color: #475569;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 30px;
    text-transform: uppercase;
}

.test-card.locked-card .start-btn {
    background-color: #94a3b8 !important;
    border-color: #94a3b8 !important;
    color: white !important;
    cursor: not-allowed !important;
}

.test-card.locked-card .sol-card-btn {
    display: none !important;
}

/* Locked modal warning */
.lock-warning-alert {
    background-color: var(--warning-light);
    border: 1px solid #fef3c7;
    color: #b45309;
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Auth Screen Cover overlay */
.auth-overlay-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 50% 50%, #0f172a 0%, #020617 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: #f1f5f9;
}

.auth-dialog-card {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    width: 460px;
    max-width: 90%;
    padding: 3rem 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    text-align: center;
    animation: dialogEnter 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dialogEnter {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-header-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    margin: 0 auto 1.5rem auto;
    box-shadow: var(--glow-shadow);
}

.auth-dialog-card h2 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-dialog-card p.auth-subtitle {
    font-size: 0.9rem;
    color: #94a3b8;
    margin-bottom: 2rem;
}

.auth-fields-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    text-align: left;
}

.auth-field-row {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.auth-field-row label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.auth-text-input {
    background: rgba(2, 6, 17, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: white;
    border-radius: 10px;
    padding: 0.8rem 1rem;
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}

.auth-text-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(2, 6, 17, 0.8);
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.35);
}

.auth-button-trigger {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    border: none;
    border-radius: 10px;
    padding: 0.85rem;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 0.5rem;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.auth-button-trigger:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.45);
    background: linear-gradient(135deg, var(--primary-hover), var(--primary));
}

.auth-error-notification {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #fca5a5;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    font-size: 0.8rem;
    display: none;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    text-align: left;
}

.setup-panel-trigger {
    margin-top: 1.75rem;
    font-size: 0.75rem;
    color: #64748b;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    display: inline-block;
}

.setup-panel-trigger:hover {
    color: #cbd5e1;
    text-decoration: underline;
}

/* Supabase Credentials Setup Box style */
.db-credentials-config-box {
    display: none;
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    text-align: left;
}

.db-credentials-config-box h4 {
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
}

/* Dynamic Admin Layout inside teacher.html */
.teacher-grid-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

@media (min-width: 1024px) {
    .teacher-grid-wrapper {
        grid-template-columns: 1fr;
    }
}

/* Tab helper text: one-line "what this page does" hint under each tab */
.tab-help-text {
    background: var(--primary-light, #ede9fe);
    border: 1px solid #c4b5fd;
    border-radius: 10px;
    color: #5b21b6;
    font-size: 0.85rem;
    line-height: 1.6;
    padding: 0.7rem 1rem;
    margin: 0 0 1.25rem;
}

/* "⋯ Manage" dropdown per student row (native <details>, no JS needed) */
.row-actions-menu {
    position: relative;
}
.row-actions-menu summary {
    cursor: pointer;
    list-style: none;
    display: inline-block;
    background: #f1f5f9;
    border: 1px solid var(--border, #e2e8f0);
    color: #334155;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.3rem 0.6rem;
    border-radius: 8px;
    white-space: nowrap;
}
.row-actions-menu summary::-webkit-details-marker { display: none; }
.row-actions-menu[open] summary {
    background: var(--primary-light, #eff6ff);
    color: var(--primary, #6d28d9);
    border-color: #bfdbfe;
}
.row-actions-menu .row-actions-box {
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 50;
    background: white;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
    padding: 0.5rem;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.row-actions-menu .row-actions-box button {
    width: 100%;
    text-align: left;
    white-space: nowrap;
}

/* First-login welcome / quick-start guide modal */
.onboarding-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 11000;
    padding: 1rem;
}
.onboarding-card {
    background: white;
    border-radius: 20px;
    max-width: 480px;
    width: 100%;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(2, 6, 23, 0.5);
    font-family: var(--font-heading, 'Plus Jakarta Sans', sans-serif);
}
.onboarding-card h2 {
    margin: 0 0 0.5rem;
    font-size: 1.4rem;
    color: var(--dark, #0f172a);
}
.onboarding-card p.sub {
    color: var(--dark-muted, #64748b);
    font-size: 0.9rem;
    margin: 0 0 1.25rem;
    line-height: 1.6;
}
.onboarding-steps {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.onboarding-steps li {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    color: #1e293b;
    font-size: 0.92rem;
    line-height: 1.5;
}
.onboarding-steps .step-num {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary-light, #eff6ff);
    color: var(--primary, #6d28d9);
    font-weight: 800;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.onboarding-card button {
    width: 100%;
    padding: 0.75rem;
    border-radius: 12px;
    border: none;
    background: var(--primary, #6d28d9);
    color: white;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.95rem;
}
.onboard-dont-again {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: var(--dark-muted, #64748b);
    margin: 0 0 1.25rem;
    cursor: pointer;
    user-select: none;
}
.onboard-dont-again input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary, #6d28d9);
    cursor: pointer;
}

.teacher-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.teacher-card-panel {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 1.75rem;
    box-shadow: var(--card-shadow);
}

.teacher-card-panel h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--dark);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
}

/* ==========================================
   Dashboard stats strip
   ========================================== */
.teacher-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 1.25rem 2rem 0;
}

.teacher-stat {
    background: white;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.teacher-stat .stat-num {
    font-family: var(--font-heading);
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.1;
}

.teacher-stat .stat-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--dark-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ==========================================
   Collapsible sidebar groups
   ========================================== */
.teacher-sidebar .teacher-group {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.teacher-group-head {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: #e2e8f0;
    border: none;
    border-radius: 10px;
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-family: var(--font-heading);
    transition: var(--transition);
    text-align: left;
}

.teacher-group-head:hover {
    background: linear-gradient(135deg, #1e293b, #0f172a);
}

.teacher-group-title {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.teacher-group-caret {
    font-size: 0.85rem;
    color: #94a3b8;
    transition: transform var(--transition);
}

.teacher-group-body {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    animation: groupOpen 0.18s ease-out;
}

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

/* Tables and logs styling in admin view */
.admin-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    text-align: left;
}

.admin-data-table th {
    background-color: var(--light);
    color: var(--dark-muted);
    font-weight: 700;
    padding: 0.85rem 1rem;
    border-bottom: 2px solid var(--border);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.admin-data-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--dark);
    vertical-align: middle;
}

.admin-data-table tbody tr:hover {
    background-color: var(--primary-light);
}

/* Column toggle chips above admin tables */
.col-toggle-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}

.col-toggle-chip {
    background: var(--light);
    border: 1px solid var(--border);
    color: var(--dark-muted);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1.3;
}

.col-toggle-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.col-toggle-chip.off {
    background: var(--danger-light, #fee2e2);
    border-color: #fecaca;
    color: #b91c1c;
    text-decoration: line-through;
    opacity: 0.85;
}

/* Sticky student-name column: stays visible on horizontal scroll */
.col-toggle-table th.col-sticky,
.col-toggle-table td.col-sticky {
    position: sticky;
    left: 0;
    z-index: 2;
    background-color: #fff;
    box-shadow: 2px 0 0 0 var(--border);
}

.col-toggle-table th.col-sticky {
    background-color: var(--light);
}

.col-toggle-table tbody tr:hover td.col-sticky {
    background-color: var(--primary-light);
}

/* Fee status row highlights */
.admin-data-table tr.row-overdue td {
    background-color: #fef2f2;
}

.admin-data-table tr.row-overdue td.col-sticky {
    background-color: #fef2f2;
}

.admin-data-table tr.row-expiring td {
    background-color: #fffbeb;
}

.admin-data-table tr.row-expiring td.col-sticky {
    background-color: #fffbeb;
}

.action-btn-danger {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-weight: bold;
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: var(--transition);
}

.action-btn-danger:hover {
    background-color: var(--danger-light);
}

.action-btn-primary {
    background-color: var(--primary-light);
    border: 1px solid #bfdbfe;
    color: var(--primary);
    cursor: pointer;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
    border-radius: 30px;
    transition: var(--transition);
}

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

/* Tab Layouts */
.admin-tab-group {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
    gap: 1.5rem;
}

.admin-tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.75rem 0.25rem;
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--dark-muted);
    cursor: pointer;
    font-size: 0.95rem;
    transition: var(--transition);
}

.admin-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Dropdowns & Forms inside Admin Panel */
.teacher-form-input {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--dark);
    background-color: var(--light);
    margin-bottom: 1rem;
    transition: var(--transition);
}

.teacher-form-input:focus {
    outline: none;
    border-color: var(--primary);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.teacher-submit-btn {
    width: 100%;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
}

.teacher-submit-btn:hover {
    background-color: var(--primary-hover);
    box-shadow: var(--glow-shadow);
}

/* Dialog details expander */
.diagnostic-expander-tr {
    background-color: var(--light);
}

.diagnostic-detail-panel {
    padding: 1.5rem;
    border-radius: 12px;
    background: white;
    border: 1px solid var(--border);
    margin: 0.5rem 0;
}

/* ==========================================
   PENDING BADGE & APPROVAL STYLES
   ========================================== */
.tab-pending-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    border-radius: 999px;
    padding: 0 4px;
    margin-left: 6px;
    animation: pulse-badge 1.5s infinite;
}
@keyframes pulse-badge {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.1); }
}
.pending-card {
    background: var(--warning-light);
    border: 1px solid rgba(245,158,11,0.3);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.pending-card-info { flex: 1; }
.pending-card-info strong { display: block; font-weight: 700; color: var(--dark); }
.pending-card-info span { font-size: 0.82rem; color: var(--dark-muted); }
.pending-card-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }
.btn-activate {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.45rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}
.btn-activate:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-reject {
    background: var(--danger-light);
    color: var(--danger-text);
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: 8px;
    padding: 0.45rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}
.btn-reject:hover { background: #fee2e2; }

/* CSV Export Button */
.btn-export-csv {
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0.55rem 1.1rem;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.btn-export-csv:hover { opacity: 0.9; transform: translateY(-1px); }

/* Password Reset button */
.action-btn-reset {
    background: none;
    border: none;
    color: var(--warning-text);
    font-weight: 600;
    font-size: 0.82rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: var(--transition);
}
.action-btn-reset:hover { background: var(--warning-light); }

/* Audio once warning in exam */
.audio-once-warning {
    background: linear-gradient(135deg, #fef3c7, #fef9c3);
    border: 1px solid #fcd34d;
    border-radius: 10px;
    padding: 0.7rem 1rem;
    font-size: 0.83rem;
    color: #92400e;
    text-align: center;
    margin-bottom: 0.75rem;
}

/* Next Wrong Answer button */
.next-wrong-btn {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.next-wrong-btn:hover { opacity: 0.9; transform: translateY(-1px); }
