/* =====================================================================
   CRICKET AUCTION — PLAYER LIST
   Dystopian Cyberpunk × Neo-Brutalist Swiss Editorial
   Same tokens as styles2.css / the game app. Layout unchanged.
   ===================================================================== */

/* ================= RESET ================= */

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

/* ================= VARIABLES ================= */

:root {
    --void: #060607;
    --panel: #0d0d0f;
    --raised: #151518;
    --bone: #efe9dd;
    --line: #232327;
    --line-strong: #3a3a41;
    --red: #ff1f3d;
    --red-deep: #b3001e;
    --cyan: #2ff3e0;
    --amber: #ffb020;

    --font-display: "Anton", Impact, sans-serif;
    --font-body: "Archivo", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, monospace;

    --container-width: 1200px;
    --transition: 0.25s ease;

    --primary-color: var(--red);
    --text-color: rgba(239, 233, 221, 0.6);
}

/* ================= GLOBAL ================= */

html {
    scroll-behavior: smooth;
    color-scheme: dark;
}

body {
    font-family: var(--font-body);
    color: var(--bone);
    background-color: var(--void);
    position: relative;
    background-image:
        linear-gradient(rgba(239, 233, 221, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(239, 233, 221, 0.035) 1px, transparent 1px);
    background-size: 40px 40px;
    animation: moveGrid 12s linear infinite;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9000;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(0, 0, 0, 0.18) 3px
    );
}

::selection {
    background: var(--red);
    color: var(--bone);
}

:focus-visible {
    outline: 2px solid var(--red);
    outline-offset: 3px;
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) var(--void);
}
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: var(--void); }
*::-webkit-scrollbar-thumb { background: var(--line-strong); }
*::-webkit-scrollbar-thumb:hover { background: var(--red); }

@keyframes moveGrid {
    0% { background-position: 0 0; }
    100% { background-position: 200px 200px; }
}

@keyframes blink {
    to { visibility: hidden; }
}

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

ul {
    list-style: none;
}

button {
    border: none;
    outline: none;
    background: none;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

.page-transition {
    position: fixed;
    inset: 0;
    background: var(--void);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.page-transition::after {
    content: "LOADING";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.4em;
    color: var(--red);
}

.page-transition.active {
    opacity: 1;
}

/* ================= WRAPPER ================= */

.wrapper {
    min-height: 100vh;
}

/* ================= CONTAINER ================= */

.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1rem;
}

/* ================= NAVBAR ================= */

.navbar {
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(6, 6, 7, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 2px solid var(--bone);
}

.navbar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -5px;
    height: 1px;
    background: var(--red);
    opacity: 0.6;
}

.navbar-container {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ================= LOGO ================= */

.logo {
    font-family: var(--font-display);
    font-size: 1.6rem;
    letter-spacing: 0.04em;
    color: var(--bone);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.logo::before {
    content: "";
    width: 10px;
    height: 10px;
    background: var(--red);
    margin-right: 0.4rem;
    animation: blink 1.2s steps(2, start) infinite;
}

.logo span:first-child {
    color: var(--bone);
}

.logo span:last-child {
    color: var(--red);
}

/* ================= NAV LINKS ================= */

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
    counter-reset: nav;
}

.nav-link {
    position: relative;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    color: var(--text-color);
    transition: var(--transition);
    counter-increment: nav;
}

.nav-link::before {
    content: counter(nav, decimal-leading-zero) " ";
    color: var(--red);
    margin-right: 0.3rem;
}

.nav-link:hover {
    color: var(--bone);
}

.nav-link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -8px;
    width: 0;
    height: 2px;
    background: var(--red);
    transition: var(--transition);
}

.nav-link:hover::after {
    width: 100%;
}

/* Current page (PLAYER LIST is the 2nd link) stays lit */
.nav-links li:nth-child(2) .nav-link {
    color: var(--bone);
}

.nav-links li:nth-child(2) .nav-link::after {
    width: 100%;
}

/* ================= MOBILE MENU ================= */

.menu-btn {
    display: none;
    width: 44px;
    height: 44px;
    border: 2px solid var(--bone);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: background var(--transition), border-color var(--transition);
}

.menu-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--bone);
    transition: transform 0.25s ease, opacity 0.2s ease;
}

.navbar.open .menu-btn {
    background: var(--red);
    border-color: var(--red);
}

.navbar.open .menu-btn span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.navbar.open .menu-btn span:nth-child(2) { opacity: 0; }
.navbar.open .menu-btn span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 768px) {
    .menu-btn {
        display: flex;
    }

    /* Dropdown panel under the navbar */
    .navbar.open .nav-links {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        margin-top: 2px;
        background: var(--void);
        border-bottom: 2px solid var(--red);
        box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
    }

    .navbar.open .nav-links li {
        border-top: 1px solid var(--line);
    }

    .navbar.open .nav-link {
        display: block;
        padding: 1.1rem 1.5rem;
        font-size: 0.85rem;
    }

    .navbar.open .nav-link::after {
        display: none;
    }

    .navbar.open .nav-link:active {
        background: var(--raised);
    }

    /* Keep the logo from crowding the menu button on tiny phones */
    .logo {
        font-size: 1.35rem;
    }
}

/* ================= PAGE HEADER ================= */

.page-header {
    text-align: center;
    padding: 3rem 2rem 2.5rem;
    position: relative;
}

/* Kicker */
.page-header::before {
    content: "PLAYER REGISTRY";
    display: block;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.5em;
    color: var(--red);
    margin-bottom: 1rem;
}

.page-header h1 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(3.5rem, 9vw, 6.5rem);
    line-height: 0.9;
    letter-spacing: 0.02em;
    color: var(--bone);
    margin-bottom: 1rem;
}

.page-header p {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: rgba(239, 233, 221, 0.55);
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.page-header::after {
    content: "";
    display: block;
    width: 80px;
    height: 4px;
    background: var(--red);
    margin: 1.5rem auto 0;
    box-shadow: 88px 0 0 -1px var(--bone), -88px 0 0 -1px var(--bone);
}

/* ================= PLAYER COUNT ================= */

.players-count {
    text-align: center;
    font-family: var(--font-mono);
    color: rgba(239, 233, 221, 0.5);
    font-size: 0.75rem;
    letter-spacing: 4px;
    margin-bottom: 2rem;
}

/* ================= CONTROLS ================= */

.controls {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem 3rem;
}

/* ================= SEARCH ================= */

#searchInput {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 1px solid var(--line-strong);
    border-left: 4px solid var(--line-strong);
    background: var(--panel);
    color: var(--bone);
    caret-color: var(--red);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    outline: none;
    margin-bottom: 1.5rem;
    transition: border-color 0.2s ease, background 0.2s ease;
}

#searchInput::placeholder {
    color: rgba(239, 233, 221, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

#searchInput:focus {
    border-color: var(--bone);
    border-left-color: var(--red);
    background: var(--raised);
}

/* ================= FILTERS ================= */

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.filter-btn {
    padding: 0.8rem 1.4rem;
    border: 2px solid var(--line-strong);
    background: transparent;
    color: rgba(239, 233, 221, 0.65);
    font-family: var(--font-display);
    font-size: 1rem;
    letter-spacing: 0.08em;
    transition: background var(--transition), color var(--transition), border-color var(--transition),
        transform 0.12s ease, box-shadow 0.12s ease;
}

.filter-btn:hover {
    color: var(--bone);
    border-color: var(--bone);
}

.filter-btn.active {
    background: var(--red);
    color: var(--bone);
    border-color: var(--red);
    box-shadow: 4px 4px 0 0 var(--bone);
    transform: translate(-2px, -2px);
}

/* ================= TABLE SECTION ================= */

.table-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem 6rem;
}

/* ================= TABLE ================= */

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--panel);
    border: 1px solid var(--line-strong);
    box-shadow: 8px 8px 0 0 var(--red);
}

/* ================= TABLE HEADER ================= */

thead {
    background: var(--bone);
    color: var(--void);
}

th {
    padding: 1.1rem 1.25rem;
    text-align: left;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.25em;
    text-transform: uppercase;
}

/* ================= TABLE BODY ================= */

td {
    padding: 0.95rem 1.25rem;
    border-bottom: 1px solid var(--line);
    color: rgba(239, 233, 221, 0.85);
}

td:first-child {
    color: var(--bone);
    font-weight: 600;
}

td:nth-child(2) {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(239, 233, 221, 0.55);
}

tbody tr {
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

tbody tr:nth-child(even) {
    background: rgba(239, 233, 221, 0.018);
}

tbody tr:hover {
    background: rgba(255, 31, 61, 0.08);
    box-shadow: inset 3px 0 0 var(--red);
}

/* ================= ROLE BADGE ================= */

.role-badge {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    border: 1px solid rgba(255, 31, 61, 0.55);
    background: rgba(255, 31, 61, 0.08);
    color: var(--red);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

/* ================= PRICE ================= */

.price {
    font-family: var(--font-display);
    font-size: 1.25rem;
    letter-spacing: 0.03em;
    color: var(--bone);
}

/* ================= SORT BUTTON ================= */

#sortBtn {
    border: 1px solid var(--void);
    background: none;
    color: var(--void);
    cursor: pointer;
    margin-left: 8px;
    padding: 0.1rem 0.4rem;
    font-family: var(--font-mono);
    transition: background 0.2s ease, color 0.2s ease;
}

#sortBtn:hover {
    background: var(--red);
    border-color: var(--red);
    color: var(--bone);
}

/* ================= FOOTER ================= */

.footer {
    background: var(--void);
    color: var(--bone);
    text-align: center;
    padding: 1.25rem;
    border-top: 2px solid var(--bone);
}

.footer p {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: rgba(239, 233, 221, 0.55);
    letter-spacing: 0.15em;
}

/* ================= RESPONSIVE ================= */

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .page-header {
        padding: 4rem 1rem 3rem;
    }

    .page-header h1 {
        font-size: 3rem;
    }

    .filters {
        justify-content: center;
    }

    .table-section {
        overflow-x: auto;
        /* room for the hard shadow so it isn't clipped */
        padding-right: calc(2rem + 8px);
        padding-bottom: calc(6rem + 8px);
    }

    table {
        min-width: 700px;
    }
}

/* ================= PHONES: TABLE → CARDS ================= */
/* Below 640px every row becomes a stacked card (labels come from the
   data-label attributes players.js writes), so there's no sideways
   scrolling. The sort control moves into a sticky bar above the list. */

@media (max-width: 640px) {
    .controls {
        padding: 0 1rem 2rem;
    }

    .filters {
        gap: 0.5rem;
    }

    .filter-btn {
        flex: 1 1 calc(50% - 0.5rem);
        padding: 0.7rem 0.5rem;
        font-size: 0.9rem;
    }

    .filter-btn[data-role="All"] {
        flex-basis: 100%;
    }

    .table-section {
        overflow-x: visible;
        padding: 0 1rem 4rem;
    }

    table {
        min-width: 0;
        border: none;
        background: transparent;
        box-shadow: none;
    }

    table,
    tbody,
    tr,
    td {
        display: block;
        width: 100%;
    }

    /* Header row collapses to just the sort control */
    thead {
        display: block;
        position: sticky;
        top: 82px;
        z-index: 5;
        margin-bottom: 0.75rem;
    }

    thead tr {
        display: flex;
    }

    thead th {
        display: none;
    }

    thead th:last-child {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 0.7rem 1rem;
    }

    tbody tr {
        position: relative;
        background: var(--panel) !important;
        border: 1px solid var(--line-strong);
        border-left: 3px solid var(--red);
        margin-bottom: 0.75rem;
        padding: 0.85rem 1rem;
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "name  price"
            "meta  role";
        gap: 0.4rem 0.75rem;
        align-items: center;
    }

    tbody tr:hover {
        box-shadow: 4px 4px 0 0 var(--red);
    }

    td {
        padding: 0;
        border: none;
        width: auto;
        min-width: 0;
    }

    /* iOS Safari zooms on focus when inputs are under 16px */
    #searchInput {
        font-size: 16px;
    }

    td:nth-child(1) { grid-area: name; font-size: 1rem; }
    td:nth-child(2) { grid-area: meta; }
    td:nth-child(3) { grid-area: role; justify-self: end; }
    td:nth-child(4) { grid-area: price; justify-self: end; }
}

@media (prefers-reduced-motion: reduce) {
    body,
    .logo::before {
        animation: none !important;
    }
}

/* Policy links + support link (same look as the home page footer) */
.footer-legal {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1.5rem;
    margin-bottom: 0.9rem;
}

.footer-legal a {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(239, 233, 221, 0.5);
    transition: color 0.2s ease;
}

.footer-legal a:hover {
    color: var(--red);
}

/* Small "buy me a coffee" button in the footer. Opens Razorpay's hosted
   Payment Page in a new tab — no payment code or keys live on this site. */
.coffee-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 1rem;
    padding: 0.5rem 0.9rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--amber);
    border: 1px solid rgba(255, 176, 32, 0.5);
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.coffee-btn:hover {
    color: var(--void);
    background: var(--amber);
    border-color: var(--amber);
}
