/* ==========================================================================
   AUC DASHBOARDS STYLESHEET (Student, Judge, Admin HQ + Auth Gatekeeper)
   ========================================================================== */

:root {
    --dash-bg: #030919;
    --dash-sidebar: #06132D;
    --dash-surface: #091C3E;
    --dash-card: rgba(9, 28, 62, 0.7);
    --dash-card-hover: rgba(14, 38, 82, 0.85);
    --dash-border: rgba(255, 255, 255, 0.08);
    --dash-border-active: rgba(0, 255, 135, 0.4);
    
    --neon-green: #00FF87;
    --neon-cyan: #00E5FF;
    --neon-gold: #FFB800;
    --neon-red: #FF3B30;
    --neon-purple: #9D4EDD;
    
    --text-primary: #FFFFFF;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    
    --radius-sm: 0.5rem;
    --radius-md: 0.875rem;
    --radius-lg: 1.25rem;
    --radius-xl: 1.75rem;
    --radius-full: 9999px;
    
    --sidebar-width: 270px;
    --topbar-height: 72px;
    --transition-fast: all 0.2s ease;
}

/* Light Mode for Dashboards */
body.light-mode.dashboard-body {
    --dash-bg: #F4F7FB;
    --dash-sidebar: #FFFFFF;
    --dash-surface: #FFFFFF;
    --dash-card: #FFFFFF;
    --dash-card-hover: #F8FAFC;
    --dash-border: rgba(11, 25, 44, 0.08);
    --dash-border-active: rgba(0, 135, 90, 0.4);
    
    --neon-green: #00875A;
    --neon-cyan: #0284C7;
    --neon-gold: #D97706;
    
    --text-primary: #0B192C;
    --text-secondary: #334155;
    --text-muted: #64748B;
}

body.light-mode.dashboard-body .dash-topbar {
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid rgba(11, 25, 44, 0.08);
}

body.light-mode.dashboard-body .metric-card,
body.light-mode.dashboard-body .table-card,
body.light-mode.dashboard-body .stepper-card,
body.light-mode.dashboard-body .roadmap-controller-card,
body.light-mode.dashboard-body .rubric-card,
body.light-mode.dashboard-body .auth-card,
body.light-mode.dashboard-body .dash-modal {
    background: #FFFFFF;
    border: 1px solid rgba(11, 25, 44, 0.08);
    box-shadow: 0 10px 30px rgba(11, 25, 44, 0.04);
}

body.light-mode.dashboard-body .step-item {
    background: #F8FAFC;
    border-color: rgba(11, 25, 44, 0.08);
}

body.light-mode.dashboard-body .search-input,
body.light-mode.dashboard-body .form-control {
    background: #FFFFFF;
    border: 1px solid rgba(11, 25, 44, 0.15);
    color: #0B192C;
}

body.light-mode.dashboard-body .sidebar-link {
    color: #475569;
}

body.light-mode.dashboard-body .sidebar-link:hover {
    background: #F1F5F9;
    color: #00875A;
}

body.light-mode.dashboard-body .sidebar-link.active {
    background: rgba(0, 135, 90, 0.08);
    color: #00875A;
    border-left-color: #00875A;
}

body.dashboard-body {
    background-color: var(--dash-bg);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    display: flex;
    min-height: 100vh;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* ==========================================================================
   1. AUTHENTICATION & LOGIN GATEKEEPER OVERLAY
   ========================================================================== */
.auth-gate-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(9, 28, 62, 0.95) 0%, rgba(3, 9, 25, 0.98) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.auth-gate-overlay.authenticated {
    display: none !important;
}

.auth-card {
    background: var(--dash-surface);
    border: 1px solid var(--dash-border-active);
    border-radius: var(--radius-xl);
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(0, 255, 135, 0.15);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--neon-green), var(--neon-cyan), var(--neon-gold));
}

.auth-logo {
    height: 52px;
    margin: 0 auto 1.25rem auto;
}

.auth-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.auth-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.5;
}

.auth-error-msg {
    background: rgba(255, 59, 48, 0.15);
    border: 1px solid rgba(255, 59, 48, 0.4);
    color: var(--neon-red);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
    display: none;
}

/* ==========================================================================
   2. DASHBOARD LAYOUT & SIDEBAR
   ========================================================================== */
.dash-sidebar {
    width: var(--sidebar-width);
    background-color: var(--dash-sidebar);
    border-right: 1px solid var(--dash-border);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.5rem 1.25rem;
    z-index: 100;
    transition: transform 0.35s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--dash-border);
    margin-bottom: 1.5rem;
}

.sidebar-brand img {
    height: 42px;
    width: auto;
}

.sidebar-brand-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 800;
    font-size: 1.2rem;
    background: linear-gradient(135deg, #00FF87, #00E5FF);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-badge {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-full);
    background: rgba(0, 255, 135, 0.12);
    color: var(--neon-green);
    border: 1px solid rgba(0, 255, 135, 0.3);
    margin-top: 0.2rem;
    display: inline-block;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex-grow: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.92rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition-fast);
    cursor: pointer;
}

.sidebar-link i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
    color: var(--text-muted);
    transition: var(--transition-fast);
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.sidebar-link:hover i {
    color: var(--neon-green);
}

.sidebar-link.active {
    background: linear-gradient(90deg, rgba(0, 255, 135, 0.15) 0%, rgba(0, 229, 255, 0.05) 100%);
    color: var(--neon-green);
    border-left: 3px solid var(--neon-green);
    font-weight: 600;
}

.sidebar-link.active i {
    color: var(--neon-green);
}

.sidebar-footer {
    border-top: 1px solid var(--dash-border);
    padding-top: 1.25rem;
}

.user-profile-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--dash-border);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--neon-green), var(--neon-cyan));
    color: #030919;
    font-weight: 800;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-info {
    flex-grow: 1;
    overflow: hidden;
}

.user-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ==========================================================================
   3. MAIN CONTENT AREA & TOPBAR
   ========================================================================== */
.dash-main {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.dash-topbar {
    height: var(--topbar-height);
    background: rgba(6, 19, 45, 0.75);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--dash-border);
    position: sticky;
    top: 0;
    z-index: 90;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    display: none;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--dash-border);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.page-headline h1 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.page-headline p {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.topbar-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--dash-border);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: var(--transition-fast);
}

.topbar-btn:hover {
    color: var(--neon-green);
    border-color: var(--neon-green);
    background: rgba(0, 255, 135, 0.08);
}

.topbar-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: var(--neon-green);
    color: #030919;
    font-size: 0.68rem;
    font-weight: 800;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dash-content {
    padding: 2rem;
    flex-grow: 1;
}

/* ==========================================================================
   4. METRIC STAT CARDS
   ========================================================================== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: var(--dash-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--dash-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: var(--transition-fast);
}

.metric-card:hover {
    background: var(--dash-card-hover);
    border-color: var(--dash-border-active);
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.metric-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.metric-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: rgba(0, 255, 135, 0.1);
    color: var(--neon-green);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.metric-value {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.metric-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.metric-tag-positive {
    color: var(--neon-green);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* ==========================================================================
   5. ROADMAP STAGE CONTROLLER (ADMIN MASTER)
   ========================================================================== */
.roadmap-controller-card {
    background: var(--dash-card);
    border: 1px solid var(--dash-border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    margin-bottom: 2rem;
}

.roadmap-stage-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--dash-border);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    transition: var(--transition-fast);
}

.roadmap-stage-row:last-child {
    margin-bottom: 0;
}

.roadmap-stage-row.stage-open {
    border-color: rgba(0, 255, 135, 0.4);
    background: rgba(0, 255, 135, 0.04);
}

.roadmap-stage-info {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.stage-num-badge {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: rgba(0, 255, 135, 0.1);
    color: var(--neon-green);
    border: 1px solid rgba(0, 255, 135, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 800;
    font-size: 1.1rem;
}

/* Toggle Switch */
.switch-control {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.switch-control input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.15);
    transition: .3s;
    border-radius: 34px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .switch-slider {
    background-color: var(--neon-green);
    box-shadow: 0 0 15px rgba(0, 255, 135, 0.4);
}

input:checked + .switch-slider:before {
    transform: translateX(24px);
    background-color: #030919;
}

/* ==========================================================================
   6. PROGRESS STEPPER (STUDENT PORTAL)
   ========================================================================== */
.stepper-card {
    background: var(--dash-card);
    border: 1px solid var(--dash-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
}

.stepper-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.stepper-header h3 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.25rem;
    margin: 0;
}

.stepper-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    position: relative;
}

.step-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--dash-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    text-align: center;
    position: relative;
    transition: var(--transition-fast);
}

.step-item.completed {
    border-color: rgba(0, 255, 135, 0.4);
    background: rgba(0, 255, 135, 0.05);
}

.step-item.current {
    border-color: var(--neon-cyan);
    background: rgba(0, 229, 255, 0.08);
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.15);
}

.step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin: 0 auto 0.75rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.88rem;
}

.step-item.completed .step-number {
    background: var(--neon-green);
    color: #030919;
}

.step-item.current .step-number {
    background: var(--neon-cyan);
    color: #030919;
}

.step-item.locked .step-number {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}

.step-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.step-status {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.step-item.completed .step-status {
    color: var(--neon-green);
}

.step-item.current .step-status {
    color: var(--neon-cyan);
    font-weight: 600;
}

/* ==========================================================================
   7. TABLES & STATUS BADGES
   ========================================================================== */
.table-card {
    background: var(--dash-card);
    border: 1px solid var(--dash-border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    margin-bottom: 2rem;
    overflow-x: auto;
}

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.table-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.search-input {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--dash-border);
    border-radius: var(--radius-md);
    padding: 0.6rem 1rem;
    color: #FFF;
    font-size: 0.88rem;
    outline: none;
    min-width: 220px;
}

.search-input:focus {
    border-color: var(--neon-green);
    box-shadow: 0 0 15px rgba(0, 255, 135, 0.2);
}

.dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.dash-table th {
    padding: 1rem 1.25rem;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--dash-border);
}

.dash-table td {
    padding: 1.15rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    vertical-align: middle;
}

.dash-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.8rem;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
}

.status-approved {
    background: rgba(0, 255, 135, 0.12);
    color: var(--neon-green);
    border: 1px solid rgba(0, 255, 135, 0.3);
}

.status-pending {
    background: rgba(255, 184, 0, 0.12);
    color: var(--neon-gold);
    border: 1px solid rgba(255, 184, 0, 0.3);
}

.status-review {
    background: rgba(0, 229, 255, 0.12);
    color: var(--neon-cyan);
    border: 1px solid rgba(0, 229, 255, 0.3);
}

.status-flagged {
    background: rgba(255, 59, 48, 0.12);
    color: var(--neon-red);
    border: 1px solid rgba(255, 59, 48, 0.3);
}

/* ==========================================================================
   8. SCORING RUBRIC CALCULATOR (JUDGE PORTAL)
   ========================================================================== */
.rubric-card {
    background: var(--dash-card);
    border: 1px solid var(--dash-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
}

.rubric-row {
    padding: 1.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: grid;
    grid-template-columns: 1.5fr 2fr 100px;
    gap: 2rem;
    align-items: center;
}

.rubric-row:last-child {
    border-bottom: none;
}

.rubric-info h4 {
    margin: 0 0 0.35rem 0;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.rubric-info p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.rubric-slider-wrap {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.rubric-slider {
    flex-grow: 1;
    -webkit-appearance: none;
    height: 6px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

.rubric-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--neon-green);
    cursor: pointer;
    box-shadow: 0 0 10px var(--neon-green);
}

.rubric-score-badge {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--neon-green);
    text-align: right;
}

.rubric-total-box {
    background: linear-gradient(135deg, rgba(0, 255, 135, 0.1) 0%, rgba(0, 229, 255, 0.05) 100%);
    border: 1px solid rgba(0, 255, 135, 0.3);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1.5rem;
}

.rubric-total-score {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--neon-green);
}

/* ==========================================================================
   9. MODALS
   ========================================================================== */
.dash-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(3, 9, 25, 0.85);
    backdrop-filter: blur(12px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.dash-modal-overlay.active {
    display: flex;
}

.dash-modal {
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2.25rem;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
    position: relative;
}

.dash-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    border-bottom: 1px solid var(--dash-border);
    padding-bottom: 1rem;
}

.dash-modal-close {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--dash-border);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.dash-modal-close:hover {
    color: #FFF;
    border-color: var(--neon-red);
}

/* Responsive */
@media (max-width: 992px) {
    .dash-sidebar {
        transform: translateX(-100%);
    }
    .dash-sidebar.show {
        transform: translateX(0);
    }
    .dash-main {
        margin-left: 0;
    }
    .sidebar-toggle {
        display: inline-flex;
    }
    .stepper-grid {
        grid-template-columns: 1fr 1fr;
    }
    .rubric-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

@media (max-width: 600px) {
    .stepper-grid {
        grid-template-columns: 1fr;
    }
    .dash-content {
        padding: 1.25rem;
    }
    .auth-card {
        padding: 2rem 1.5rem;
    }
}
