/* ==========================================================================
   Google Fonts Import (Lora for elegant academic serif, Outfit for clean headings)
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400..700;1,400..700&family=Outfit:wght@300..800&family=Fira+Code:wght@400..600&display=swap');

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    /* Pure charcoal base color with our faint scientific chalkboard background */
    background-color: #1a1c1e;
    background-image: 
        linear-gradient(rgba(26, 28, 30, 0.94), rgba(26, 28, 30, 0.94)), 
        url('smarter_blackboard_bg.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #e2e8f0;
    min-height: 100vh;
    padding: 30px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1.5;
}

a {
    color: #dfd7c3; /* Antique chalk gold */
    text-decoration: none;
    transition: color 0.15s ease;
    border-bottom: 1px dotted rgba(223, 215, 195, 0.4);
}

a:hover {
    color: #ffffff;
    border-bottom-style: dashed;
}

/* ==========================================================================
   Outer Shell (Clean Slate Frame)
   ========================================================================== */
#shell {
    width: 100%;
    max-width: 880px;
    background: rgba(22, 24, 26, 0.95); /* Solid slate background, no gradient */
    border: 1px solid rgba(223, 215, 195, 0.25); /* Thin antique gold border */
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
#header {
    background: #141517;
    border-bottom: 1px solid rgba(223, 215, 195, 0.25);
    padding: 24px 20px;
    text-align: center;
}

#header h1 {
    font-size: 32px;
    font-weight: 700;
    color: #ffffff; /* Clean white */
    letter-spacing: 3px;
    text-transform: uppercase;
    font-family: 'Outfit', sans-serif;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

#header-nav {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 12px;
    display: flex;
    justify-content: center;
    gap: 16px;
}

#header-nav a {
    color: #94a3b8;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: 11px;
    padding: 4px 8px;
    border: none;
    transition: all 0.15s ease;
}

#header-nav a:hover {
    color: #dfd7c3;
}

/* ==========================================================================
   Subheader
   ========================================================================== */
#subheader {
    background: #18191b;
    border-bottom: 1px solid rgba(223, 215, 195, 0.12);
    padding: 12px 24px;
    font-size: 14px;
    color: #cbd5e1;
    text-align: center;
    font-family: 'Lora', serif;
    font-style: italic;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   Body Content Container
   ========================================================================== */
#content {
    padding: 30px 40px;
    flex-grow: 1;
}

@media (max-width: 640px) {
    #content {
        padding: 20px 16px;
    }
}

/* ==========================================================================
   Vote View (Whoissmartest Comparison)
   ========================================================================== */
#vote-prompt {
    text-align: center;
    font-size: 20px;
    font-weight: 500;
    color: #ffffff;
    margin-bottom: 26px;
    letter-spacing: 0.5px;
}

#vote-table {
    width: 100%;
    border-collapse: collapse;
}

#vote-table tr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

#vote-table td {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Authentic Slate Divider (VS) */
#vote-table td.or-cell {
    flex: 0 0 54px;
    font-size: 14px;
    font-weight: 700;
    color: #dfd7c3;
    background: #141517;
    border: 1px solid rgba(223, 215, 195, 0.3);
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fira Code', monospace;
    user-select: none;
    z-index: 10;
}

@media (max-width: 768px) {
    #vote-table tr {
        flex-direction: row;
        gap: 12px;
        justify-content: center;
    }
    #vote-table td.or-cell {
        transform: none;
        width: 38px;
        height: 38px;
        font-size: 11px;
        flex: 0 0 38px;
        margin: 0;
    }
    .vote-candidate-card {
        padding: 8px;
        max-width: 46%;
    }
    .vote-photo-btn img {
        height: 35vw !important; /* Highly responsive height to ensure zero vertical scrolling on mobile phones */
        max-height: 180px;
        min-height: 120px;
    }
    .person-name {
        font-size: 14px !important;
        margin-top: 6px !important;
        margin-bottom: 4px !important;
    }
    .person-stats {
        font-size: 10px !important;
        padding: 3px 6px !important;
        gap: 4px !important;
    }
    #vote-prompt {
        font-size: 20px !important;
        margin-bottom: 12px !important;
    }
    body {
        padding: 10px 6px !important;
    }
    #content {
        padding: 16px 8px !important;
    }
}

/* Clean Slate Cards */
.vote-candidate-card {
    width: 100%;
    max-width: 310px;
    background: #18191b;
    border: 1px solid rgba(223, 215, 195, 0.15); /* Clean border, no AI glows */
    border-radius: 8px;
    padding: 14px;
    text-align: center;
    transition: all 0.2s ease-out;
}

.vote-candidate-card:hover {
    transform: translateY(-4px);
    border-color: rgba(223, 215, 195, 0.45);
    background: #1e2022;
}

.vote-photo-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: block;
    width: 100%;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.vote-photo-btn img {
    display: block;
    width: 100%;
    height: 270px;
    object-fit: cover;
    transition: filter 0.2s ease;
    filter: brightness(0.88);
}

.vote-candidate-card:hover .vote-photo-btn img {
    filter: brightness(0.98);
}

.person-name {
    font-family: 'Lora', serif;
    font-size: 19px;
    font-weight: 600;
    color: #ffffff;
    margin-top: 12px;
    margin-bottom: 6px;
}

.vote-candidate-card:hover .person-name {
    color: #dfd7c3;
}

.person-stats {
    font-size: 13px;
    color: #94a3b8;
    background: #121314;
    padding: 5px 12px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Fira Code', monospace;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.person-stats .stat-elo {
    color: #dfd7c3;
    font-weight: 500;
}

#no-photos {
    text-align: center;
    color: #94a3b8;
    padding: 60px 0;
}

#no-photos p {
    font-size: 16px;
    margin-bottom: 20px;
}

/* ==========================================================================
   Leaderboard View
   ========================================================================== */
#leaderboard-title {
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 20px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(223, 215, 195, 0.25);
}

#leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    background: #18191b;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(223, 215, 195, 0.15);
}

#leaderboard-table th {
    background-color: #141517;
    color: #dfd7c3;
    font-size: 11px;
    font-weight: 600;
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(223, 215, 195, 0.2);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

#leaderboard-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
    color: #cbd5e1;
    font-size: 14px;
}

#leaderboard-table tr:last-child td {
    border-bottom: none;
}

#leaderboard-table tr:hover td {
    background-color: rgba(223, 215, 195, 0.03);
}

.lb-rank {
    font-weight: 600;
    width: 40px;
    color: #94a3b8;
}

/* Understated Scholarly Medals */
.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
}
.rank-1 { background: rgba(223, 215, 195, 0.2); color: #ffffff; border: 1px solid #dfd7c3; } /* Gold/Chalk */
.rank-2 { background: rgba(148, 163, 184, 0.15); color: #e2e8f0; border: 1px solid #94a3b8; } /* Silver/Chalk */
.rank-3 { background: rgba(180, 83, 9, 0.1); color: #decbb7; border: 1px solid rgba(223, 215, 195, 0.3); } /* Bronze */
.rank-other { color: #94a3b8; }

.lb-thumb {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.lb-name {
    font-family: 'Lora', serif;
    font-weight: 500;
    font-size: 15px;
    color: #ffffff;
}

.lb-elo {
    color: #dfd7c3;
    font-weight: 600;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
}

.lb-wins {
    color: #86efac; /* Subtle clean green */
    font-family: 'Fira Code', monospace;
}

.lb-losses {
    color: #fca5a5; /* Subtle clean red */
    font-family: 'Fira Code', monospace;
}

.lb-wl {
    color: #94a3b8;
    font-family: 'Fira Code', monospace;
    font-size: 12px;
}

/* ==========================================================================
   Forms (Upload / Login)
   ========================================================================== */
#form-box {
    max-width: 440px;
    margin: 0 auto;
    background: #18191b;
    border: 1px solid rgba(223, 215, 195, 0.15);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

#form-box h2 {
    font-size: 17px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 18px;
    border-bottom: 1px solid rgba(223, 215, 195, 0.2);
    padding-bottom: 8px;
}

.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    font-size: 11px;
    color: #dfd7c3;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
    font-weight: 600;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="file"] {
    width: 100%;
    background-color: #121314;
    border: 1px solid rgba(223, 215, 195, 0.15);
    border-radius: 4px;
    color: #ffffff;
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.15s ease;
}

.field input[type="text"]:focus,
.field input[type="password"]:focus {
    outline: none;
    border-color: #dfd7c3;
    background-color: #141517;
}

.field input[type="file"] {
    padding: 6px;
    cursor: pointer;
}

.field small {
    display: block;
    color: #94a3b8;
    font-size: 11px;
    margin-top: 5px;
}

.btn {
    background-color: #dfd7c3;
    color: #141517;
    border: none;
    border-radius: 4px;
    padding: 9px 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    width: 100%;
    transition: background-color 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn:hover {
    background-color: #ffffff;
}

.btn-small {
    background-color: rgba(248, 113, 113, 0.08);
    color: #fca5a5;
    border: 1px solid rgba(248, 113, 113, 0.15);
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 11px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.btn-small:hover {
    background-color: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
}

.msg-ok {
    color: #86efac;
    background: rgba(74, 222, 128, 0.06);
    border: 1px solid rgba(74, 222, 128, 0.15);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
}

.msg-err {
    color: #fca5a5;
    background: rgba(248, 113, 113, 0.06);
    border: 1px solid rgba(248, 113, 113, 0.15);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
}

/* ==========================================================================
   Upload List View
   ========================================================================== */
#upload-list {
    margin-top: 30px;
}

#upload-list h3 {
    font-size: 14px;
    font-weight: 600;
    color: #dfd7c3;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(223, 215, 195, 0.2);
    padding-bottom: 6px;
}

#upload-list table {
    width: 100%;
    border-collapse: collapse;
    background: #18191b;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(223, 215, 195, 0.12);
}

#upload-list td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
    font-size: 13px;
    color: #cbd5e1;
}

#upload-list tr:last-child td {
    border-bottom: none;
}

#upload-list img {
    width: 38px;
    height: 38px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   Footer
   ========================================================================== */
#footer {
    border-top: 1px solid rgba(223, 215, 195, 0.25);
    padding: 16px 20px;
    font-size: 11px;
    color: #94a3b8;
    text-align: center;
    background: #141517;
    font-family: 'Fira Code', monospace;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   Keyboard & Selection Features
   ========================================================================== */
.vote-candidate-card.keyboard-active {
    transform: scale(1.03) translateY(-4px);
    border-color: #dfd7c3 !important;
    background: #25272a !important;
    box-shadow: 0 0 15px rgba(223, 215, 195, 0.2);
}

.keyboard-hint {
    margin-top: 10px;
    font-size: 11px;
    color: #94a3b8;
    opacity: 0.75;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: 'Outfit', sans-serif;
    user-select: none;
}

.keyboard-hint kbd {
    background: #121314;
    border: 1px solid rgba(223, 215, 195, 0.3);
    border-radius: 3px;
    padding: 1px 6px;
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    color: #dfd7c3;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   Mobile Responsiveness Enhancements
   ========================================================================== */
@media (max-width: 600px) {
    /* Hide detailed stats on mobile leaderboard to avoid horizontal overflow */
    #leaderboard-table th:nth-child(5), /* Wins */
    #leaderboard-table td:nth-child(5),
    #leaderboard-table th:nth-child(6), /* Losses */
    #leaderboard-table td:nth-child(6),
    #leaderboard-table th:nth-child(7), /* W/L Ratio */
    #leaderboard-table td:nth-child(7) {
        display: none;
    }

    /* Hide detailed stats in admin upload list on mobile */
    #upload-list td:nth-child(3) {
        display: none;
    }
}

@media (max-width: 480px) {
    body {
        padding: 12px 8px;
    }
    #header h1 {
        font-size: 24px;
        letter-spacing: 1.5px;
    }
    #subheader {
        font-size: 12px;
        padding: 10px 16px;
    }
    #header-nav {
        gap: 10px;
    }
    .keyboard-hint {
        display: none; /* Hide keyboard hints on mobile touch screens */
    }
}


