/* style.css */
:root {
    /* Background Colors */
    --bg-darker: #0d1117;    /* Main Body */
    --bg-sidebar: #161b22;   /* Sidebar */
    --bg-card: #1c252e;      /* Card color */
    
    /* Accent Colors */
    --accent-cyan: #4fd1c5;  /* The glow color */
    --accent-orange: #ffa447; /* Difficulty/Warning */
    --accent-blue: #1d4ed8;   /* Progress blue */
    
    /* Text Colors */
    --text-white: #f0f6fc;
    --text-gray: #8b949e;
    
    /* Borders & Spacing */
    --border: 1px solid #30363d;
    --radius-lg: 16px;
    --radius-md: 8px;

    --nav-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --page-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Cross-document view transitions (Chromium / Safari TP) */
@view-transition {
    navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 0.28s;
    animation-timing-function: var(--page-ease);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-darker);
    color: var(--text-white);
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 60;
    background: var(--bg-card);
    border: var(--border);
    color: var(--text-white);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background 0.2s var(--nav-ease), border-color 0.2s var(--nav-ease), transform 0.2s var(--nav-ease);
}

.sidebar-toggle:hover {
    border-color: var(--accent-cyan);
}

.sidebar-backdrop {
    display: none;
}

.toast-stack {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: min(360px, calc(100vw - 2rem));
}

.toast {
    background: var(--bg-card);
    border: var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    animation: toast-in 0.28s var(--page-ease);
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

.toast.error { border-color: #f85149; }
.toast.success { border-color: var(--accent-cyan); }

@media (max-width: 900px) {
    .sidebar-toggle {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
    }
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 50;
        width: min(300px, 88vw);
        transform: translateX(-105%);
        transition: transform 0.32s var(--nav-ease);
        height: 100dvh;
        max-height: 100dvh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 2rem;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.55);
        z-index: 40;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.28s var(--nav-ease), visibility 0.28s var(--nav-ease);
    }
    .sidebar-backdrop.visible {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
    .main-content {
        width: 100%;
        max-width: 100%;
        padding: 3.75rem 1rem 1.5rem;
        overflow-x: hidden;
    }
    .top-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.85rem;
        margin-bottom: 1.25rem;
    }
    .top-bar h1 {
        font-size: 1.35rem;
        padding-left: 2.75rem; /* clear menu button */
        line-height: 1.3;
    }
    .filter-group {
        flex-wrap: wrap;
        gap: 0.5rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.15rem;
    }
    .btn-filter {
        padding: 0.45rem 0.85rem;
        font-size: 0.85rem;
        white-space: nowrap;
        flex: 0 0 auto;
    }
    .active-challenge-card {
        flex-direction: column;
        gap: 1.25rem;
        padding: 1.25rem;
    }
    .active-challenge-card .hero-left h1 {
        font-size: 1.35rem;
        line-height: 1.25;
        word-break: break-word;
    }
    .big-time {
        font-size: 2.5rem;
    }
    .bottom-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .leaderboard-preview {
        padding: 1.1rem;
    }
    .preview-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .table-header,
    .table-row,
    .full-grid {
        grid-template-columns: 2.2fr 1fr 1fr;
        gap: 0.35rem;
        font-size: 0.85rem;
    }
    .full-grid {
        grid-template-columns: 2.5rem 1.4fr 1fr 0.8fr;
    }
    .challenge-item {
        padding: 1.15rem;
    }
    .challenge-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.65rem;
    }
    .challenge-stats-row {
        flex-wrap: wrap;
        gap: 1rem 1.25rem;
    }
    .action-buttons {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .action-buttons .btn-join,
    .action-buttons .btn-outline,
    .btn-join,
    .btn-outline {
        width: auto;
        min-height: 44px;
    }
    .podium-container {
        flex-direction: column;
        align-items: stretch;
        gap: 0.85rem;
    }
    .podium-card,
    .podium-card.gold,
    .podium-card.silver,
    .podium-card.bronze {
        width: 100%;
        height: auto;
        min-height: 0;
        padding: 1.25rem;
    }
    .profile-grid,
    .stats-row {
        grid-template-columns: 1fr;
    }
    .profile-header-flex {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    .hero-resource-card {
        padding: 1.25rem;
    }
    .resource-hero-content h2 {
        font-size: 1.25rem;
    }
    .resources-grid {
        grid-template-columns: 1fr;
    }
    .admin-panel-head {
        flex-direction: column;
        align-items: stretch;
    }
    #admin-tabs.filter-group,
    .filter-group#admin-tabs {
        width: 100%;
    }
    #admin-judging .challenge-picker,
    .challenge-picker {
        width: 100%;
        min-width: 0;
        margin-left: 0;
    }
    .admin-form-grid {
        grid-template-columns: 1fr;
    }
    .judge-card-grid {
        grid-template-columns: 1fr;
    }
    .judge-workspace {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 1rem;
    }
    .admin-list-row {
        flex-direction: column;
        align-items: stretch;
    }
    .admin-row-actions {
        width: 100%;
    }
    .admin-row-actions .btn-outline,
    .admin-row-actions .btn-join {
        flex: 1;
        text-align: center;
    }
    .toast-stack {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
        max-width: none;
    }
    .card {
        padding: 1.1rem;
    }
    .submission-card {
        max-width: 100%;
    }
    .upload-zone {
        padding: 1.5rem 1rem;
    }
}

@media (max-width: 600px) {
    .main-content {
        padding: 3.5rem 0.85rem 1.25rem;
    }
    .top-bar h1 {
        font-size: 1.2rem;
        padding-left: 3rem;
    }
    .table-header {
        display: none;
    }
    .table-row,
    .full-grid {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
        padding: 0.85rem 0;
    }
    .rank-info {
        width: 100%;
    }
    .status-tag {
        align-self: flex-start;
    }
    .stat-num {
        font-size: 1.85rem;
    }
    .box,
    .box::before,
    .box::after {
        width: min(380px, calc(100vw - 1.5rem));
    }
    .holder {
        width: 100%;
        padding: 0.75rem;
        display: flex;
        justify-content: center;
    }
    .inputBox {
        width: 100%;
    }
}

/* Prefer dynamic viewport on modern mobile browsers */
@supports (height: 100dvh) {
    @media (max-width: 900px) {
        .sidebar { height: 100dvh; max-height: 100dvh; }
    }
}

.sidebar {
    padding: 1.5rem;
}

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 3rem;
    view-transition-name: main-content;
    animation: page-enter 0.38s var(--page-ease) both;
}

body.is-navigating .main-content {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.16s ease, transform 0.16s ease;
    pointer-events: none;
}

@keyframes page-enter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* Sidebar Logo & Nav */
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 2.5rem;
}

.logo-icon {
    background-color: var(--accent-cyan);
    color: #000;
    padding: 4px 8px;
    border-radius: var(--radius-md);
    font-weight: bold;
}

.side-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-item {
    text-decoration: none;
    color: var(--text-gray);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    transition: color 0.22s var(--nav-ease), background 0.22s var(--nav-ease), transform 0.22s var(--nav-ease), box-shadow 0.22s var(--nav-ease);
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.nav-item:hover {
    background-color: rgba(79, 209, 197, 0.08);
    color: var(--text-white);
    transform: translateX(4px);
}

.nav-item.active {
    background-color: rgba(79, 209, 197, 0.12);
    color: var(--accent-cyan);
    box-shadow: inset 3px 0 0 var(--accent-cyan);
    transform: none;
}

.nav-item:active {
    transform: translateX(2px) scale(0.98);
}

.btn-filter {
    transition: color 0.2s var(--nav-ease), background 0.2s var(--nav-ease), border-color 0.2s var(--nav-ease), transform 0.15s ease;
}

.btn-filter:hover {
    transform: translateY(-1px);
}

.admin-panel {
    animation: page-enter 0.32s var(--page-ease) both;
}

.admin-panel.is-switching {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.14s ease, transform 0.14s ease;
}



/* Hero Card */
.active-challenge-card {
    background: linear-gradient(135deg, #162c35 0%, #0d1117 100%);
    border: var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.big-time {
    font-size: 3.5rem;
    font-weight: bold;
    color: var(--accent-cyan);
}

/* Common Card Styling */
.card {
    background-color: var(--bg-card);
    border: var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 2rem;
}

.row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #21262d;
}



.label{
    font-size: 0.75rem;
    color: var(--text-gray);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.btn-join{
    background-color: var(--accent-cyan);
    color: #000;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    margin-top: 1rem;
    cursor: pointer;
}

.badge{
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
}

.badge-blue{
    background-color: var(--accent-blue);
}
.badge-orange { background-color: #7c2d12; 
    color: var(--accent-orange);
}

.text-cyan{
    color: var(--accent-cyan);
}
.text-orange{
    color: var(--accent-orange);
}

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


/* LEADERBOARD PREVIEW STYLING */
.leaderboard-preview {
    margin-top: 2rem;
    padding: 2rem;
}

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

.preview-header h3{
    display: flex;
    align-items: center;
    gap: 10px;
}

.view-full{
    color: var(--accent-cyan);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight:600;
}

/*Table Structure*/
.preview-table{
    width: 100%;
}

.table-header{
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    padding-bottom: 12px;
    border-bottom: 1px solid #30363d;
    color: var(--text-gray);
    font-size: 0.85rem;
    font-weight: 600;
}

.table-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid #21262d;
    transition: background 0.2s;
}

.table-row:hover{
    background: rgba(255, 255, 255, 0.02);
}

.rank-num {
    font-weight: 800;
    color: var(--accent-orange); /* Match that yellow/orange # in your photo */
    font-size: 1.1rem;
    min-width: 20px;
}

/* Verified Status Tag */
.status-tag {
    background: rgba(79, 209, 197, 0.1);
    color: var(--accent-cyan);
    border: 1px solid rgba(79, 209, 197, 0.2);
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    width: fit-content;
}

/* Medals */
.medal {
    font-size: 1.2rem;
}



/* CHALLENGES PAGE STYLES */
.filter-group {
    display: flex;
    gap: 10px;
}

.btn-filter{
    background: var(--bg-card);
    border: var(--border);
    color: var(--text-gray);
    padding: 8px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
}

.btn-filter.active {
    background: rgba(79, 209, 197, 0.1);
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
}

.challenge-list-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.challenge-item {
    padding: 2rem;
}

.challenge-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.challenge-desc {
    color: var(--text-gray);
    margin-bottom: 20px;
}

.challenge-stats-row {
    display: flex;
    gap: 40px;
    margin-bottom: 20px;
    padding: 15px 0;
    border-top: var(--border);
    border-bottom: var(--border);
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat span {
    font-size: 0.8rem;
    color: var(--text-gray);
}

.text-green { color: #48bb78; }
.badge-green {
     background: #064e3b; color: #48bb78; 
    }

    /* PODIUM STYLES */
.podium-container {
    display: flex;
    justify-content: center;
    align-items: flex-end; /* Aligns them to the bottom like a real podium */
    gap: 20px;
    margin-bottom: 3rem;
    margin-top: 1rem;
}

.podium-card {
    background: var(--bg-card);
    border: var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    width: 200px;
    transition: transform 0.3s;
}

.podium-card:hover {
    transform: translateY(-10px);
}

.podium-card.gold {
    border-color: var(--accent-orange);
    height: 320px; /* Taller for 1st place */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.podium-card.silver, .podium-card.bronze {
    height: 260px;
}

.medal-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
}

.podium-score {
    font-size: 2rem;
    font-weight: 800;
    margin: 10px 0;
}

.podium-score.large {
    font-size: 3rem;
}

/* FULL TABLE SPECIFIC GRID */
.full-grid {
    display: grid;
    grid-template-columns: 80px 2fr 1.5fr 1fr 1fr; /* Adjusted for extra "Robot Name" column */
    gap: 10px;
}



/* SUBMISSION FORM STYLES */
.submission-card {
    max-width: 800px;
    margin: 0 auto;
}

.submission-card h2 {
    margin-bottom: 1.5rem;
}

.entry-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.9rem;
    color: var(--text-gray);
    font-weight: 500;
}

.form-group input, 
.form-group select, 
.form-group textarea {
    background: var(--bg-sidebar);
    border: var(--border);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: white;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
    border-color: var(--accent-cyan);
}

/* Custom Upload Zone */
.upload-zone {
    border: 2px dashed #30363d;
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.upload-zone:hover {
    background: rgba(79, 209, 197, 0.05);
    border-color: var(--accent-cyan);
}

.upload-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 10px;
}

.sub-text {
    display: block;
    font-size: 0.75rem;
    color: var(--text-gray);
    margin-top: 5px;
}

.youtube-embed {
    margin-top: 1rem;
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #0d1117;
}

.youtube-embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.full-width {
    width: 100%;
    padding: 15px;
    font-size: 1rem;
}



/* PROFILE PAGE STYLES */
.profile-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.info-item span {
    font-size: 0.85rem;
    color: var(--text-gray);
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.stat-box {
    background: var(--bg-card);
    border: var(--border);
    padding: 2rem;
    border-radius: var(--radius-lg);
    text-align: center;
}

.stat-num {
    font-size: 2.5rem;
    font-weight: 800;
    display: block;
    margin-bottom: 5px;
}

.text-green { color: #48bb78; }

.btn-outline {
    background: transparent;
    border: var(--border);
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
}



/* SIDEBAR COUNTDOWN BOX */
.sidebar-footer {
    margin-top: auto; /* Pushes the box to the very bottom of the sidebar */
    padding-top: 2rem;
}

.countdown-card {
    background: rgba(255, 255, 255, 0.03); /* Subtle glass effect */
    border: 1px solid #30363d;
    padding: 1.5rem;
    border-radius: 12px;
}

.countdown-card .label {
    font-size: 0.7rem;
    color: var(--text-gray);
    display: block;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.countdown-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-cyan); /* The signature Roboleague cyan glow */
}



/* RESOURCES PAGE STYLES */
.hero-resource-card {
    background: linear-gradient(135deg, #182830 0%, #1c252e 100%);
    border: var(--border);
    margin-bottom: 2.5rem;
    padding: 2.5rem;
}

.resource-hero-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.resource-hero-content h2 {
    font-size: 1.8rem;
    color: var(--text-white);
}

.inline-btn {
    display: inline-block;
    text-decoration: none;
    margin-top: 10px;
}

.section-title {
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    color: var(--text-white);
}

.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.resource-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s, border-color 0.2s;
}

.resource-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-cyan);
}

.resource-type-icon {
    font-size: 1.8rem;
    margin-bottom: 12px;
}

.resource-title {
    margin: 12px 0 8px 0;
    font-size: 1.1rem;
    color: var(--text-white);
}

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

.resource-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: var(--border);
    padding-top: 12px;
    font-size: 0.8rem;
}

.resource-link {
    color: var(--accent-cyan);
    text-decoration: none;
    font-weight: 600;
}

.resource-link:hover {
    text-decoration: underline;
}

.badge-green {
    background-color: #064e3b;
    color: #48bb78;
}


/* AUTH PAGES STYLES */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--bg-darker);
    padding: 1rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h2 {
    margin: 10px 0 5px 0;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

.auth-footer a {
    text-decoration: none;
    font-weight: 600;
}

.full-width {
    width: 100%;
}


/* SIDEBAR AUTH BUTTONS */
.sidebar-auth-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 1rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 1rem;
}

.auth-nav-btn {
    text-align: center;
    text-decoration: none;
    padding: 8px 12px;
    font-size: 0.85rem;
    border-radius: var(--radius-md, 8px);
    display: block;
}


/* LOGIN & REGISTER — clean, always-visible auth shell */
body.auth-page {
  display: flex !important;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(79, 209, 197, 0.18), transparent 55%),
    var(--bg-darker);
  overflow-x: hidden;
}

body.auth-page .auth-shell {
  width: 100%;
  max-width: 420px;
  padding: 1.25rem;
  margin: 0 auto;
}

.auth-card-neon {
  background: var(--bg-card);
  border: 1px solid #30363d;
  border-radius: 16px;
  padding: 2rem 1.5rem;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

.auth-brand {
  color: var(--accent-cyan);
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 1.25rem;
}

.auth-card-neon h1 {
  margin: 0 0 0.35rem;
  font-size: 1.65rem;
  color: var(--text-white);
}

.auth-sub {
  margin: 0 0 1.5rem;
  color: var(--text-gray);
  font-size: 0.95rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  color: var(--text-gray);
  font-size: 0.85rem;
}

.auth-field input {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 10px;
  color: var(--text-white);
  padding: 0.75rem 0.9rem;
  font: inherit;
  outline: none;
  transition: border-color 0.2s ease;
}

.auth-field input:focus {
  border-color: var(--accent-cyan);
}

.auth-links {
  display: flex;
  justify-content: flex-end;
}

.auth-links a {
  color: var(--accent-cyan);
  text-decoration: none;
  font-size: 0.9rem;
}

.auth-links a:hover {
  text-decoration: underline;
}

.auth-submit {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.85rem 1rem;
  font-size: 1rem;
}

/* Legacy neon box styles kept but scoped away from auth-page */
body:not(.auth-page) .box {
  position: relative;
  width: min(380px, 100%);
  min-height: 420px;
  background: #1c1c1c;
  border-radius: 8px;
  overflow: hidden;
}

/* Height adjustment for registration form */
.box.register-box {
  min-height: 560px;
}

/* Glowing border animation */
.box::before,
.box::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 380px;
  height: 100%;
  background: linear-gradient(0deg, transparent, #4fd1c5, #4fd1c5); /* Signature Roboleague cyan */
  transform-origin: bottom right;
  animation: animate 6s linear infinite;
}

.box::after {
  background: linear-gradient(0deg, transparent, #ff2770, #ff2770);
  animation-delay: -3s;
}

@keyframes animate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Form container layer */
.box form {
  position: absolute;
  inset: 2px;
  background: #161b22;
  padding: 40px 30px;
  border-radius: 8px;
  z-index: 2;
  display: flex;
  flex-direction: column;
}

.box form h2 {
  color: #fff;
  font-weight: 500;
  text-align: center;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}

/* Input styles & animated floating label */
.inputBox {
  position: relative;
  width: 100%;
  margin-top: 25px;
}

.inputBox input {
  position: relative;
  width: 100%;
  padding: 15px 10px 10px;
  background: transparent;
  outline: none;
  border: none;
  box-shadow: none;
  color: #ffffff; /* FIXED: Changed from dark grey to white for readability */
  font-size: 0.95em;
  letter-spacing: 0.05em;
  transition: 0.5s;
  z-index: 10;
}

.inputBox span {
  position: absolute;
  left: 0;
  padding: 15px 0px 10px;
  pointer-events: none;
  color: #8f8f8f;
  font-size: 0.95em;
  letter-spacing: 0.05em;
  transition: 0.5s;
}

.inputBox input:valid ~ span,
.inputBox input:focus ~ span {
  color: #4fd1c5;
  transform: translateX(0px) translateY(-32px);
  font-size: 0.75em;
}

/* Animated bottom border line */
.inputBox i {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: #30363d;
  border-radius: 4px;
  overflow: hidden;
  transition: 0.5s;
  pointer-events: none;
}

.inputBox input:valid ~ i,
.inputBox input:focus ~ i {
  height: 38px;
  background: rgba(79, 209, 197, 0.1);
  border-bottom: 2px solid #4fd1c5;
}

/* Links & Submit button */
.links {
  display: flex;
  justify-content: space-between;
  margin-top: 15px;
}

.links a {
  font-size: 0.78em;
  color: #8f8f8f;
  text-decoration: none;
}

.links a:hover {
  color: #4fd1c5;
}

input[type="submit"] {
  border: none;
  outline: none;
  padding: 11px 25px;
  background: #4fd1c5;
  color: #0d1117;
  cursor: pointer;
  border-radius: 4px;
  font-weight: 600;
  width: 100%;
  margin-top: 25px;
  transition: 0.2s;
}

input[type="submit"]:hover {
  opacity: 0.9;
  box-shadow: 0 0 15px rgba(79, 209, 197, 0.4);
}


/* CHALLENGE STATUS BADGES & BUTTONS */
.badge-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* Backend Status Colors */
.badge.status-open { background: rgba(79, 209, 197, 0.15); color: #4fd1c5; border: 1px solid rgba(79, 209, 197, 0.3); }
.badge.status-upcoming { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge.status-judging { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge.status-closed { background: rgba(107, 114, 128, 0.15); color: #9ca3af; border: 1px solid rgba(107, 114, 128, 0.3); }
.badge.status-completed { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }

/* Card Actions */
.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 1.2rem;
}

.action-buttons .btn-join,
.action-buttons .btn-outline {
    flex: 1;
    text-align: center;
    padding: 10px;
    font-size: 0.88rem;
    cursor: pointer;
}

.btn-joined {
    background: #10b981 !important;
    color: #ffffff !important;
    cursor: default;
}

.btn-disabled {
    background: #21262d !important;
    color: #484f58 !important;
    border: 1px solid #30363d !important;
    cursor: not-allowed;
}

/* Frontend ↔ API wiring helpers */
.form-error {
    color: #f87171;
    font-size: 0.9rem;
    margin: 0.75rem 0;
}

.form-success {
    color: #34d399;
    font-size: 0.9rem;
    margin: 0.75rem 0;
}

.btn-loading {
    opacity: 0.75;
    pointer-events: none;
}

.auth-user-chip {
    color: #9ca3af;
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 0.5rem;
}

.challenge-picker {
    background: #161b22;
    color: #e6edf3;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 0.45rem 0.75rem;
    margin-left: auto;
}

.upload-zone.dragover {
    border-color: #4fd1c5;
    background: rgba(79, 209, 197, 0.08);
}

.badge.status-upcoming {
    background: rgba(96, 165, 250, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(96, 165, 250, 0.3);
}

.badge.status-closed {
    background: rgba(148, 163, 184, 0.12);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.podium-card.empty {
    opacity: 0.45;
}

/* Admin console */
.admin-panel {
    padding-bottom: 2rem;
}

.admin-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.admin-panel-head h2,
.admin-panel-head h3 {
    margin: 0;
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
    padding: 1.25rem;
}

.admin-form label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    color: #9ca3af;
    font-size: 0.85rem;
}

.admin-form input,
.admin-form select,
.admin-form textarea {
    background: #0d1117;
    color: #e6edf3;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font: inherit;
}

.admin-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.85rem;
}

.admin-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.admin-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 10px;
}

.admin-row-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.admin-inline-fields {
    display: grid;
    grid-template-columns: 1fr 1fr 5rem auto;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.checkbox-row {
    flex-direction: row !important;
    align-items: center;
    gap: 0.5rem !important;
}

.admin-status-wrap select {
    background: #0d1117;
    color: #e6edf3;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
}

.admin-criteria-block {
    border-top: 1px solid #30363d;
    padding-top: 0.75rem;
}

@media (max-width: 700px) {
    .admin-list-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .admin-inline-fields {
        grid-template-columns: 1fr;
    }
}

/* Judging workspace */
.judge-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}

.judge-card {
    background: linear-gradient(165deg, #1a2332 0%, #12171f 100%);
    border: 1px solid #30363d;
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.judge-card:hover {
    border-color: #4fd1c5;
    transform: translateY(-2px);
}

.judge-card.judge-status-judged {
    border-color: rgba(79, 209, 197, 0.35);
}

.judge-card.judge-status-pending {
    border-color: rgba(251, 146, 60, 0.4);
}

.judge-card-media .youtube-embed {
    margin: 0;
    border-radius: 0;
}

.judge-card-body {
    padding: 1rem 1.1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    flex: 1;
}

.judge-card-body h3 {
    margin: 0;
    font-size: 1.05rem;
    color: #e6edf3;
}

.judge-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.judge-score {
    font-weight: 700;
    color: #4fd1c5;
    font-variant-numeric: tabular-nums;
}

.judge-card-actions {
    margin-top: auto;
}

.judge-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.9fr);
    gap: 1.5rem;
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: linear-gradient(145deg, #161b22, #0f141b);
    border: 1px solid #30363d;
    border-radius: 16px;
}

.judge-workspace-media .youtube-embed {
    margin-top: 0;
    border: 1px solid #30363d;
}

.judge-workspace-head h3 {
    margin: 0 0 0.25rem;
}

.judge-score-form {
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
}

.judge-score-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.judge-score-field span {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.judge-score-field em {
    font-style: normal;
    color: #6b7280;
    font-size: 0.8rem;
}

.judge-watch-link {
    margin: 0.75rem 0 0;
    font-size: 0.85rem;
}

#admin-judging .challenge-picker {
    min-width: 220px;
    margin-left: 0;
}

/* ---------------------------------------------------------------------------
   Final mobile overrides (must stay last so they win the cascade)
--------------------------------------------------------------------------- */
@media (max-width: 900px) {
    body:has(.app-container) {
        display: block;
        align-items: stretch;
        justify-content: flex-start;
    }
    .app-container {
        display: block;
        width: 100%;
        min-height: 100dvh;
    }
    .main-content {
        width: 100% !important;
        max-width: 100vw;
        padding: 3.75rem 1rem 1.75rem !important;
        overflow-x: hidden;
    }
    .sidebar {
        position: fixed !important;
        inset: 0 auto 0 0;
        z-index: 50;
        width: min(300px, 88vw);
        height: 100dvh;
        max-height: 100dvh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        transform: translateX(-105%);
        transition: transform 0.22s ease;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .judge-workspace {
        grid-template-columns: 1fr;
    }
    .bottom-grid,
    .profile-grid,
    .stats-row {
        grid-template-columns: 1fr !important;
    }
    .active-challenge-card {
        flex-direction: column;
    }
    .podium-container {
        flex-direction: column;
        align-items: stretch;
    }
    .podium-card,
    .podium-card.gold {
        width: 100%;
        height: auto;
    }
    .resources-grid,
    .judge-card-grid,
    .admin-form-grid {
        grid-template-columns: 1fr !important;
    }
    .top-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    .top-bar h1 {
        font-size: 1.3rem;
        padding-left: 2.85rem;
    }
    .filter-group {
        flex-wrap: wrap;
    }
    .challenge-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .challenge-stats-row {
        flex-wrap: wrap;
        gap: 1rem;
    }
    .action-buttons {
        flex-wrap: wrap;
    }
    .admin-list-row {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 600px) {
    .main-content {
        padding: 3.4rem 0.8rem 1.25rem !important;
    }
    .table-header { display: none; }
    .table-row,
    .full-grid {
        display: flex !important;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }
    .box {
        width: min(380px, calc(100vw - 1.25rem));
    }
    .box form {
        padding: 1.5rem 1.15rem;
    }
    .holder {
        width: 100%;
        padding: 0.75rem;
        display: flex;
        justify-content: center;
    }
}

/* Store product catalog */
.store-top {
    align-items: flex-start;
    gap: 1rem;
}

.store-top-sub {
    margin-top: 0.35rem;
    font-size: 0.92rem;
}

.store-top-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.store-manage {
    margin-bottom: 1.5rem;
}

.store-form-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

.product-empty {
    grid-column: 1 / -1;
    padding: 2rem 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.product-card {
    background: linear-gradient(165deg, #1a2332 0%, #12171f 100%);
    border: 1px solid #30363d;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
    border-color: rgba(79, 209, 197, 0.45);
    transform: translateY(-3px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

.product-card.is-featured {
    border-color: rgba(255, 164, 71, 0.45);
}

.product-card-media {
    position: relative;
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 30% 20%, rgba(79, 209, 197, 0.22), transparent 55%),
                linear-gradient(135deg, #16232f, #0f141b);
}

.product-card.tone-kit .product-card-media {
    background: radial-gradient(circle at 30% 20%, rgba(96, 165, 250, 0.25), transparent 55%),
                linear-gradient(135deg, #152033, #0f141b);
}

.product-card.tone-bundle .product-card-media {
    background: radial-gradient(circle at 30% 20%, rgba(255, 164, 71, 0.22), transparent 55%),
                linear-gradient(135deg, #241910, #0f141b);
}

.product-card-media img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}

.product-card-icon {
    font-size: 2.75rem;
    line-height: 1;
}

.product-card-badges {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.product-card-body {
    padding: 1.1rem 1.15rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    flex: 1;
}

.product-card-title {
    margin: 0;
    font-size: 1.08rem;
    color: var(--text-white);
}

.product-card-desc {
    margin: 0;
    color: var(--text-gray);
    font-size: 0.9rem;
    line-height: 1.45;
    flex: 1;
}

.product-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.product-card-price {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
}

.product-card-price strong {
    font-size: 1.25rem;
    color: var(--accent-cyan);
}

.product-stock {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
}

.product-stock.in-stock {
    color: #34d399;
    background: rgba(52, 211, 153, 0.12);
}

.product-stock.out-of-stock {
    color: #f87171;
    background: rgba(248, 113, 113, 0.12);
}

.product-card-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.product-card-actions .btn-join {
    margin-top: 0;
    width: 100%;
}

.product-card-admin {
    display: flex;
    gap: 0.5rem;
}

.product-card-admin .btn-outline {
    flex: 1;
    text-align: center;
}

.admin-product-grid {
    margin-top: 1rem;
}

@media (max-width: 900px) {
    .store-top {
        flex-direction: column;
    }
    .store-top-actions {
        width: 100%;
    }
    .product-grid {
        grid-template-columns: 1fr;
    }
}
