:root {
    --neon-lime: #ccff00;
    --electric-blue: #00f0ff;
    --deep-black: #0a0a0a;
    --carbon: #141414;
    --danger-red: #ff0055;
}

body {
    font-family: 'Chakra Petch', sans-serif;
    background-color: var(--deep-black);
    color: white;
    overflow-x: hidden;
}

h1, h2, h3, .heading-font {
    font-family: 'Teko', sans-serif;
    text-transform: uppercase;
}

/* Custom Clip Paths for that aggressive sporty look */
.clip-slant {
    clip-path: polygon(0 0, 100% 0, 100% 85%, 0 100%);
}

.clip-slant-reverse {
    clip-path: polygon(0 15%, 100% 0, 100% 100%, 0 100%);
}

.clip-button {
    clip-path: polygon(10% 0, 100% 0, 100% 70%, 90% 100%, 0 100%, 0 30%);
}

/* Glitch Effect Text */
.glitch-text {
    position: relative;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch-text::before {
    left: 2px;
    text-shadow: -1px 0 var(--neon-lime);
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

.glitch-text::after {
    left: -2px;
    text-shadow: -1px 0 var(--electric-blue);
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim 2.5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% { clip: rect(14px, 9999px, 121px, 0); }
    20% { clip: rect(69px, 9999px, 21px, 0); }
    40% { clip: rect(10px, 9999px, 86px, 0); }
    60% { clip: rect(117px, 9999px, 7px, 0); }
    80% { clip: rect(48px, 9999px, 99px, 0); }
    100% { clip: rect(1px, 9999px, 114px, 0); }
}

@keyframes glitch-anim-2 {
    0% { clip: rect(111px, 9999px, 13px, 0); }
    20% { clip: rect(27px, 9999px, 111px, 0); }
    40% { clip: rect(9px, 9999px, 78px, 0); }
    60% { clip: rect(138px, 9999px, 3px, 0); }
    80% { clip: rect(66px, 9999px, 81px, 0); }
    100% { clip: rect(2px, 9999px, 13px, 0); }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--deep-black);
}
::-webkit-scrollbar-thumb {
    background: var(--neon-lime);
}

.card-hover:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 20px 40px -10px rgba(204, 255, 0, 0.2);
}

.nav-link {
    position: relative;
}
.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 0;
    background-color: var(--neon-lime);
    transition: width 0.3s ease;
}
.nav-link:hover::after {
    width: 100%;
}

.entity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2.5rem;
}

.entity-card {
    background: linear-gradient(145deg, #1a1a1a, #111);
    position: relative;
    /* Tech-inspired corner cuts */
    clip-path: polygon(
        20px 0, 100% 0,
        100% calc(100% - 20px), calc(100% - 20px) 100%,
        0 100%, 0 20px
    );
    border-left: 2px solid #333;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.entity-card:hover {
    transform: translateY(-10px);
    border-left-color: var(--neon-lime);
    box-shadow: 0 15px 30px rgba(0,0,0,0.5);
}

.entity-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 100px; height: 100px;
    background: radial-gradient(circle at top right, rgba(204,255,0,0.1), transparent 70%);
    pointer-events: none;
}

.entity-header {
    padding: 1.5rem;
    border-bottom: 1px solid #2a2a2a;
    position: relative;
}

.entity-title {
    font-size: 2.5rem;
    line-height: 1;
    margin-bottom: 0.25rem;
    color: white;
    font-style: italic;
}

.entity-subtitle {
    color: var(--electric-blue);
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 600;
}


.stats-container {
    padding: 1.5rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed #333;
}

.stat-row:last-child {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.stat-label {
    color: #888;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-family: 'Teko', sans-serif;
    font-size: 1.4rem;
    font-weight: 500;
    color: white;
}

.data-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    background: #222;
    color: #fff;
    clip-path: polygon(10% 0, 100% 0, 100% 100%, 0% 100%);
}

.text-accent-primary { color: var(--neon-lime); }
.text-accent-secondary { color: var(--electric-blue); }
.text-accent-danger { color: var(--danger-red); }

/* Currency formatting specific */
.currency-text {
    font-family: 'Chakra Petch', monospace;
    letter-spacing: -0.5px;
}

.profile-container {
    width: 100%;
    max-width: 950px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
}


.toggle-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: 0.375rem;
    color: #4b5563;
    background-color: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.15s, background-color 0.15s;
}
.toggle-icon-btn:hover {
    color: #1f2937;
    background-color: #f3f4f6;
}
.toggle-icon-btn.active-view {
    color: #ffffff !important;
    background-color: #4f46e5 !important;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    align-items: start;
}

.card {
    background: var(--carbon); /* Use dark background */
    border-radius: 6px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 300px; /* Slightly taller */
    padding: 0;
    border: 1px solid #2a2a2a;
    transition: transform 0.3s, border-color 0.3s;
}

.card:hover {
    transform: translateY(-4px);
    border-color: var(--neon-lime);
}

.card-photo {
    width: 100%;
    height: 180px;
    background: #0a0a0a; /* Deep black for image area */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-placeholder { padding: 12px; color: #6b7280; font-size: 0.95rem; }

.card-body {
    padding: 12px 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: white;
}

.card-name {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    font-family: 'Teko', sans-serif;
    color: var(--electric-blue);
    line-height: 1.1;
}

.card-place-inline {
    font-size: 0.85rem;
    font-weight: 400;
    color: #9ca3af;
}
.card-place, .card-profile, .card-wicket, .card-shirt, .card-hand {
    margin: 0;
    font-size: 0.9rem;
    color: #9ca3af; /* gray-400 */
}

/* New class for status background pulse */
.card-status-pulse {
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 8px;
    text-align: center;
}

#listView { display: block; }
#cardView { display: none; }

#rosterContainer.card-mode #listView { display: none; }
#rosterContainer.card-mode #cardView { display: grid; }
/* END MODIFIED FOR APEX THEME */

.apex-player-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 0.95em;
    border: 1px solid #333;
}

.apex-player-table th, .apex-player-table td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid #222;
}

.apex-player-table th {
    background-color: #1a1a1a;
    color: var(--electric-blue);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: 'Teko', sans-serif;
}

/* Base row style */
.apex-player-table tr {
    background-color: var(--carbon);
    transition: background-color 0.2s;
    color: #fff; /* Ensure text is white by default */
}
.apex-player-table tr:nth-child(even) {
    background-color: #181818;
}

.apex-player-table tr:hover {
    background-color: #2a2a2a;
}

/* Status Indicators (Dark Theme) */
.status-sold-dark {
    background-color: #132a13; /* Dark Green */
}
.status-sold-dark:hover {
    background-color: #1d3a1d !important;
}
.status-sold-dark td {
    color: var(--neon-lime); /* Highlight text */
}

.status-unsold-dark {
    background-color: #381b1b; /* Dark Red */
}
.status-unsold-dark:hover {
    background-color: #482b2b !important;
}
.status-unsold-dark td {
    color: var(--danger-red); /* Highlight text */
}

/* Status Available (Neutral) */
.status-available-dark {
    background-color: var(--carbon);
}
.status-available-dark:hover {
    background-color: #2a2a2a !important;
}
.status-available-dark td {
    color: #fff;
}

@media print {
    /* --- 1. PAGE SETUP --- */
    @page {
        size: A4;
        margin: 1cm;
    }

    body {
        background-color: white !important;
        color: black !important;
        font-family: Arial, sans-serif !important;
        -webkit-print-color-adjust: exact !important;
    }

    /* --- 2. HIDE EVERYTHING ELSE --- */
    .relative.h-\[40vh\],
    .view-controls-container,
    footer, header,
    #cardView,
    thead,
    #noPlayersFoundList {
        display: none !important;
    },
    #noPlayersFoundCard {
        display: none !important;
    }

    section, .max-w-7xl, #rosterContainer, #listView {
        display: block !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
        height: auto !important;
    }

    .entity-card {
        background: white !important;
        page-break-inside: avoid !important;
    }

    .fin-stats {
        display: none !important;
    }

    .print {
        background: white !important;
        color: black !important;
        page-break-inside: avoid !important;
    }
    /* --- 3. MAIN LAYOUT: 3 PLAYERS PER ROW --- */
    #playerTableBody {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10px !important;
        width: 100% !important;
    }

    /* --- 4. PLAYER CARD STYLING --- */
    #playerTableBody tr {
        display: grid !important;
        grid-template-columns: 110px 1fr !important;
        grid-template-rows: min-content min-content min-content min-content !important;
        align-content: center !important;

        height: 130px !important;
        border: 1px solid #000 !important;
        background: white !important;
        padding: 8px !important;
        page-break-inside: avoid !important;
        overflow: hidden;
    }

    /* *** FILTER FIX: FORCE HIDDEN ROWS TO STAY HIDDEN *** */
    /* This overrides the 'display: grid' above if JS has hidden the row */
    #playerTableBody tr[style*="display: none"],
    #playerTableBody tr[style*="display:none"] {
        display: none !important;
    }

    /* Reset all cells */
    #playerTableBody td {
        display: block !important;
        border: none !important;
        padding: 0 !important;
        text-align: left !important;
    }

    /* --- 5. LEFT COLUMN: PHOTO --- */
    #playerTableBody td:nth-child(2) {
        grid-column: 1 / 2 !important;
        grid-row: 1 / span 4 !important;
        padding-right: 10px !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    #playerTableBody td:nth-child(2) .card-photo,
    #playerTableBody td:nth-child(2) .w-12 {
        width: 100px !important;
        height: 100px !important;
        border: 1px solid #ccc !important;
        border-radius: 4px !important;
        overflow: hidden !important;
    }

    #playerTableBody td:nth-child(2) img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }

    /* --- 6. RIGHT COLUMN: TEXT FIELDS --- */

    /* ID */
    #playerTableBody td:nth-child(1) {
        grid-column: 2 !important;
        font-size: 9pt !important;
        color: #666 !important;
        margin-bottom: 2px !important;
    }
    #playerTableBody td:nth-child(1)::before { content: "ID: "; }

    /* NAME */
    #playerTableBody td:nth-child(3) {
        grid-column: 2 !important;
        font-size: 13pt !important;
        font-weight: bold !important;
        color: black !important;
        margin-bottom: 5px !important;
        line-height: 1.1 !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* PROFILE */
    #playerTableBody td:nth-child(5) {
        grid-column: 2 !important;
        font-size: 10pt !important;
        color: black !important;
        margin-bottom: 3px !important;
    }
    #playerTableBody td:nth-child(5)::before {
        content: "Profile: ";
        color: #666;
    }

    /* WICKET KEEPER */
    #playerTableBody td:nth-child(6) {
        grid-column: 2 !important;
        font-size: 10pt !important;
        color: black !important;
        display: flex !important;
        align-items: center;
    }
    #playerTableBody td:nth-child(6)::before {
        content: "WK: ";
        color: #666;
        margin-right: 4px;
    }
    #playerTableBody td:nth-child(6) svg {
        display: inline-block !important;
        width: 14px !important;
        height: 14px !important;
        color: black !important;
        stroke: black !important;
    }

    /* --- 7. HIDE UNUSED COLUMNS --- */
    #playerTableBody td:nth-child(4),
    #playerTableBody td:nth-child(7),
    #playerTableBody td:nth-child(8),
    #playerTableBody td:nth-child(9)
    { display: none !important; }
}

    /* Blog Specific Layout Adjustments */
    .blog-title {
        color: var(--neon-lime);
        font-size: 4.5rem;
        margin-bottom: 0.5rem;
    }

    .blog-container {
        max-width: 900px;
        margin: 0 auto;
        padding: 2rem 1rem;
    }

    .match-report {
        margin-bottom: 4rem;
        border-left: 3px solid var(--electric-blue);
        padding-left: 1.5rem;
    }

    .image-placeholder {
        background: var(--carbon);
        display: flex;
        align-items: center;
        justify-content: center;
        border: 1px dashed #333;
        margin: 2rem 0;
        position: relative;
        overflow: hidden;
    }

    .match-title {
        color: var(--neon-lime);
        font-size: 2.5rem;
        margin-bottom: 0.5rem;
    }

    .performer-badge {
        background: rgba(0, 240, 255, 0.1);
        border: 1px solid var(--electric-blue);
        padding: 1rem;
        margin-top: 1rem;
        display: inline-block;
        clip-path: polygon(0 0, 95% 0, 100% 30%, 100% 100%, 5% 100%, 0 70%);
    }