/* ══════════════════════════════════════════════
   events.css — light theme for MateChess events
   ══════════════════════════════════════════════ */

body.ev-light {
    --ev-bg:        #f5f5f7;
    --ev-card:      #ffffff;
    --ev-border:    #e4e4e7;
    --ev-text:      #111111;
    --ev-muted:     #6b6b76;
    --ev-green:     #1b6b3a;
    --ev-green-bg:  #e8f4ee;
    --ev-green-h:   #155730;
    --ev-shadow:    0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
    --ev-shadow-md: 0 4px 14px rgba(0,0,0,.09);
    --ev-radius:    12px;
    --ev-font:      -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html:has(body.ev-light) { background: var(--ev-bg) !important; }

body.ev-light {
    background: var(--ev-bg) !important;
    color: var(--ev-text) !important;
    font-family: var(--ev-font);
}

/* Override dark glass panels */
body.ev-light .glass-panel,
body.ev-light .glass-panel-soft {
    background: var(--ev-card) !important;
    border: 1px solid var(--ev-border) !important;
    backdrop-filter: none !important;
    box-shadow: var(--ev-shadow) !important;
    border-radius: var(--ev-radius) !important;
}

/* ── Kill mobile.css legacy fixed-scroll layout ── */
body.ev-light .page-shell,
body.ev-light .events-dashboard,
body.ev-light .ev-desktop-header {
    background: var(--ev-bg) !important;
    height: auto !important;
    min-height: unset !important;
    overflow: visible !important;
    position: static !important;
    animation: none !important;
}

body.ev-light .events-scroll-area {
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    overflow: visible !important;
    padding: 0 !important;
    background: var(--ev-bg) !important;
    z-index: auto !important;
    -webkit-overflow-scrolling: auto !important;
}

/* Shared event content wrapper */
body.ev-light .ev-shared-content {
    background: var(--ev-bg);
}

/* Desktop header section hidden on mobile */
@media (max-width: 768px) {
    body.ev-light .ev-desktop-header { display: none !important; }
    body.ev-light .ev-shared-content .ev-desktop-wrap {
        padding: 8px 16px 48px !important;
    }
    body.ev-light .ev-shared-content .ev-desktop-wrap #active-events,
    body.ev-light .ev-shared-content .ev-desktop-wrap #archived-events {
        grid-template-columns: 1fr !important;
    }
}

/* ════════════════════════════════
   DESKTOP EVENTS PAGE
   ════════════════════════════════ */

body.ev-light .ev-page {
    padding-top: 0 !important;
}

/* Page header */
body.ev-light .ev-page-header {
    margin-bottom: 24px;
    padding-top: 8px;
}

body.ev-light .ev-page-header h1 {
    font-size: 30px !important;
    font-weight: 800 !important;
    letter-spacing: -0.5px;
    color: var(--ev-text) !important;
    margin: 0 0 6px !important;
    background: none !important;
    -webkit-text-fill-color: var(--ev-text) !important;
}

body.ev-light .ev-page-header p {
    font-size: 14px !important;
    color: var(--ev-muted) !important;
    margin: 0 !important;
}

/* Desktop content wrapper */
body.ev-light .ev-desktop-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 24px 80px;
    width: 100%;
    box-sizing: border-box;
}

/* ── Filter / tab bar ── */
body.ev-light .ev-filter-bar {
    display: flex !important;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

body.ev-light .ev-tab-pill {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    padding: 7px 16px !important;
    border-radius: 100px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    cursor: pointer;
    border: 1px solid var(--ev-border) !important;
    background: var(--ev-card) !important;
    color: var(--ev-text) !important;
    transition: background .12s, color .12s, border-color .12s;
    white-space: nowrap;
    min-height: unset !important;
    min-width: unset !important;
}

body.ev-light .ev-tab-pill:hover {
    border-color: var(--ev-green) !important;
    color: var(--ev-green) !important;
    background: var(--ev-card) !important;
}

body.ev-light .ev-tab-pill.active {
    background: var(--ev-green) !important;
    color: #fff !important;
    border-color: var(--ev-green) !important;
    font-weight: 600 !important;
}

/* Count badge */
body.ev-light .ev-count-badge {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.25) !important;
    color: inherit !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    min-width: 20px;
    height: 18px;
    border-radius: 10px;
    padding: 0 5px;
}
body.ev-light .ev-tab-pill:not(.active) .ev-count-badge {
    background: var(--ev-green-bg) !important;
    color: var(--ev-green) !important;
}

/* ── Event grid override ── */
body.ev-light .ev-grid,
body.ev-light #active-events,
body.ev-light #archived-events {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 18px !important;
}

@media (max-width: 1024px) {
    body.ev-light .ev-grid,
    body.ev-light #active-events,
    body.ev-light #archived-events {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ── Event cards — override style.css dark styles ── */
body.ev-light .event-card,
body.ev-light .tournament-card {
    background: var(--ev-card) !important;
    border: 1px solid var(--ev-border) !important;
    border-radius: var(--ev-radius) !important;
    box-shadow: var(--ev-shadow) !important;
    padding: 0 !important;
    gap: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    color: var(--ev-text) !important;
    transition: box-shadow .15s, transform .15s !important;
}

body.ev-light .event-card:hover,
body.ev-light .tournament-card:hover {
    box-shadow: var(--ev-shadow-md) !important;
    transform: translateY(-2px) !important;
    border-color: var(--ev-border) !important;
}

body.ev-light .tournament-card-top {
    padding: 16px 16px 12px !important;
    border-bottom: 1px solid var(--ev-border);
    gap: 10px !important;
    align-items: flex-start;
}

body.ev-light .event-card-title h3,
body.ev-light .tournament-card-title h3 {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: var(--ev-text) !important;
    margin: 0 !important;
    line-height: 1.3;
    background: none !important;
    -webkit-text-fill-color: var(--ev-text) !important;
}

body.ev-light .event-id {
    font-size: 11px !important;
    color: var(--ev-muted) !important;
    margin-top: 4px;
}

body.ev-light .tournament-card-summary {
    padding: 12px 16px !important;
    flex: 1;
    color: var(--ev-text) !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
    gap: 0 !important;
}

/* Stats chips — override green pills */
body.ev-light .tournament-card-stats {
    display: flex !important;
    flex-direction: column !important;
    gap: 5px !important;
    flex-wrap: nowrap !important;
}

body.ev-light .tournament-card-stats span {
    display: flex !important;
    align-items: center;
    gap: 5px;
    font-size: 12px !important;
    font-weight: 400 !important;
    color: var(--ev-muted) !important;
    background: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    -webkit-text-fill-color: var(--ev-muted) !important;
}

body.ev-light .event-countdown {
    font-size: 12px !important;
    color: var(--ev-green) !important;
    font-weight: 600 !important;
    background: none !important;
    -webkit-text-fill-color: var(--ev-green) !important;
}

body.ev-light .tournament-card-footer {
    padding: 12px 16px !important;
    border-top: 1px solid var(--ev-border);
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    justify-content: flex-start !important;
    flex-wrap: wrap;
}

/* ── Buttons inside event cards ── */
body.ev-light .event-card .btn,
body.ev-light .tournament-card .btn,
body.ev-light .tournament-card button {
    padding: 7px 14px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border-radius: 7px !important;
    min-height: unset !important;
    min-width: unset !important;
    width: auto !important;
    cursor: pointer !important;
}

body.ev-light .event-card .btn-primary,
body.ev-light .tournament-card .btn-primary {
    background: var(--ev-green) !important;
    color: #fff !important;
    border: none !important;
}
body.ev-light .event-card .btn-primary:hover,
body.ev-light .tournament-card .btn-primary:hover {
    background: var(--ev-green-h) !important;
}

body.ev-light .event-card .btn-secondary,
body.ev-light .tournament-card .btn-secondary {
    background: var(--ev-card) !important;
    color: var(--ev-green) !important;
    border: 1px solid var(--ev-green) !important;
}
body.ev-light .event-card .btn-secondary:hover,
body.ev-light .tournament-card .btn-secondary:hover {
    background: var(--ev-green-bg) !important;
}

body.ev-light .event-card .btn-danger,
body.ev-light .tournament-card .btn-danger {
    background: #fdf0f0 !important;
    color: #b91c1c !important;
    border: 1px solid #f5c6c6 !important;
}

/* ── Badges ── */
body.ev-light .event-card .badge-success,
body.ev-light .tournament-card .badge-success {
    background: var(--ev-green-bg) !important;
    color: var(--ev-green) !important;
    font-size: 11px !important;
    padding: 3px 9px !important;
    border-radius: 20px !important;
    border: none !important;
    font-weight: 700 !important;
    min-height: unset !important;
    min-width: unset !important;
}

body.ev-light .event-card .badge-info,
body.ev-light .tournament-card .badge-info {
    background: #e8f0fe !important;
    color: #1a56db !important;
    font-size: 11px !important;
    padding: 3px 9px !important;
    border-radius: 20px !important;
    border: none !important;
    font-weight: 700 !important;
    min-height: unset !important;
    min-width: unset !important;
}

body.ev-light .event-card .badge-warning,
body.ev-light .tournament-card .badge-warning {
    background: #fff7e6 !important;
    color: #b45309 !important;
    font-size: 11px !important;
    padding: 3px 9px !important;
    border-radius: 20px !important;
    border: none !important;
    font-weight: 700 !important;
    min-height: unset !important;
    min-width: unset !important;
}

/* ── Empty/loading state ── */
body.ev-light .ev-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--ev-muted);
    font-size: 14px;
    grid-column: 1 / -1;
}

body.ev-light .ev-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--ev-border);
    border-top-color: var(--ev-green);
    border-radius: 50%;
    animation: ev-spin .7s linear infinite;
    margin: 0 auto 12px;
}

@keyframes ev-spin { to { transform: rotate(360deg); } }

/* ── More buttons ── */
body.ev-light .ev-more-btn {
    padding: 8px 20px !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border: 1px solid var(--ev-border) !important;
    background: var(--ev-card) !important;
    color: var(--ev-text) !important;
    cursor: pointer;
    min-height: unset !important;
    transition: background .12s;
}
body.ev-light .ev-more-btn:hover {
    background: var(--ev-green-bg) !important;
    border-color: var(--ev-green) !important;
    color: var(--ev-green) !important;
}

body.ev-light .form-label {
    color: var(--ev-text) !important;
    -webkit-text-fill-color: var(--ev-text) !important;
}

body.ev-light .form-input {
    background: var(--ev-bg) !important;
    border: 1px solid var(--ev-border) !important;
    color: var(--ev-text) !important;
    border-radius: 8px !important;
}

/* ── Empty state (injected by setEmptyState() in script.js) ── */
body.ev-light .ev-grid .empty-state,
body.ev-light #active-events .empty-state,
body.ev-light #archived-events .empty-state {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    text-align: center;
    padding: 48px 24px;
    grid-column: 1 / -1;
    color: var(--ev-muted) !important;
    -webkit-text-fill-color: var(--ev-muted) !important;
}
body.ev-light .ev-grid .empty-state h3,
body.ev-light #active-events .empty-state h3,
body.ev-light #archived-events .empty-state h3 {
    color: var(--ev-text) !important;
    -webkit-text-fill-color: var(--ev-text) !important;
    font-size: 17px !important;
    font-weight: 600 !important;
    margin-bottom: 6px !important;
    background: none !important;
}
body.ev-light .ev-grid .empty-state .muted,
body.ev-light #active-events .empty-state .muted,
body.ev-light #archived-events .empty-state .muted {
    color: var(--ev-muted) !important;
    -webkit-text-fill-color: var(--ev-muted) !important;
    font-size: 13px !important;
    background: none !important;
}

body.ev-light .form-input:focus {
    border-color: var(--ev-green) !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(27,107,58,.1) !important;
}

body.ev-light .btn-create-event {
    background: var(--ev-green) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 12px 24px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    min-height: unset !important;
    cursor: pointer !important;
}

/* ═══════════════════════════════════════
   MOBILE EVENTS PAGE
   ═══════════════════════════════════════ */

body.ev-light .ev-mobile-page {
    background: var(--ev-bg) !important;
    min-height: 100dvh;
    padding-top: 56px;
}

@media (min-width: 769px) {
    body.ev-light .ev-mobile-page { display: none !important; }
}

/* Tab toggle: Upcoming / Archive */
body.ev-light .ev-mobile-tabs {
    display: flex;
    border-bottom: 1px solid var(--ev-border);
    background: var(--ev-card) !important;
    padding: 0 16px;
    gap: 0;
}

body.ev-light .ev-mobile-tab {
    flex: 1;
    padding: 12px 0;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: var(--ev-muted) !important;
    border: none !important;
    background: transparent !important;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    transition: color .12s, border-color .12s;
    min-height: unset !important;
}

body.ev-light .ev-mobile-tab.active {
    color: var(--ev-green) !important;
    border-bottom-color: var(--ev-green) !important;
}

/* Mobile event cards — same event-card from script.js */
@media (max-width: 768px) {
    body.ev-light .event-card,
    body.ev-light .tournament-card {
        border-radius: 14px !important;
    }

    body.ev-light .tournament-card-stats {
        flex-direction: column !important;
        gap: 4px !important;
    }
}

/* ── Create Event button ──────────────────────── */
body.ev-light .ev-create-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    background: var(--ev-green);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    white-space: nowrap;
}
body.ev-light .ev-create-btn:hover {
    background: var(--ev-green-h);
}

/* ── Create Event modal overlay ──────────────── */
body.ev-light .ev-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

body.ev-light .ev-modal-box {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px 28px 24px;
}

body.ev-light .ev-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

body.ev-light .ev-modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--ev-text);
    margin: 0;
}

body.ev-light .ev-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ev-muted);
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: background .12s, color .12s;
}
body.ev-light .ev-modal-close:hover {
    background: #f0f0f2;
    color: var(--ev-text);
}

body.ev-light .ev-modal-subtitle {
    font-size: 13px;
    color: var(--ev-muted);
    margin: 0 0 20px;
}

@media (max-width: 540px) {
    body.ev-light .ev-modal-box {
        padding: 20px 16px 20px;
        border-radius: 14px;
    }
}
