/* === RESET & TOKENS (Sofascore-inspired dark theme) === */
*, *::before, *::after {
    margin: 0; padding: 0; box-sizing: border-box;
}

:root {
    --bg-base: #1a1d26;
    --bg-surface: #242833;
    --bg-elevated: #2d3140;
    --bg-hover: #353a4a;
    --bg-active: #3d4355;
    --accent: #3b82f6;
    --accent-soft: rgba(59,130,246,0.12);
    --green: #00c566;
    --red: #e63946;
    --gold: #f5a623;
    --brazil-green: #009c3b;
    --brazil-yellow: #ffdf00;
    --mexico-green: #006341;
    --mexico-red: #ce1126;
    --text-1: #f0f2f5;
    --text-2: #a1a8b8;
    --text-3: #6b7280;
    --border: rgba(255,255,255,0.06);
    --border-active: rgba(59,130,246,0.4);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Oswald', sans-serif;
    --shadow: 0 2px 8px rgba(0,0,0,0.2);
    --transition: 0.15s ease;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg-base);
    color: var(--text-1);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* === TOP NAV === */
.topnav {
    position: sticky;
    top: 0;
    z-index: 200;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
}

.topnav-inner {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
}

.topnav-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.nav-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-1);
}

.nav-badge {
    font-size: 10px;
    font-weight: 600;
    background: var(--accent);
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-2);
    padding: 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.nav-btn:hover {
    background: var(--bg-hover);
    color: var(--text-1);
}

/* === MAIN LAYOUT === */
.main-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    max-width: 1600px;
    margin: 0 auto;
    min-height: calc(100vh - 50px);
}

/* === LEFT PANEL (Match List) === */
.panel-left {
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 50px);
    position: sticky;
    top: 50px;
}

.panel-header {
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--border);
}

.panel-header h2 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-1);
}

.group-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.gf-btn {
    font-family: var(--font);
    font-size: 11px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    border: none;
    background: var(--bg-elevated);
    color: var(--text-3);
    cursor: pointer;
    transition: var(--transition);
}

.gf-btn:hover { background: var(--bg-hover); color: var(--text-2); }
.gf-btn.active { background: var(--accent); color: #fff; }

.match-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.match-list::-webkit-scrollbar { width: 4px; }
.match-list::-webkit-scrollbar-track { background: transparent; }
.match-list::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 2px; }

/* Date header */
.date-header {
    padding: 8px 12px 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.date-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Match Row (Sofascore style) */
.match-row {
    display: grid;
    grid-template-columns: 32px 1fr 40px 1fr 28px;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 2px;
}

.match-row:hover { background: var(--bg-hover); }
.match-row.selected { background: var(--accent-soft); border: 1px solid var(--border-active); }

.match-time {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-2);
    text-align: center;
}

.match-time.live { color: var(--green); }

.match-home, .match-away {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
}

.match-home { justify-content: flex-end; text-align: right; }
.match-away { justify-content: flex-start; }

.match-home img, .match-away img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    border-radius: 2px;
}

.match-vs {
    font-size: 11px;
    color: var(--text-3);
    text-align: center;
    font-weight: 600;
}

.match-vs.has-score {
    font-size: 14px;
    color: var(--text-1);
    font-family: var(--font-display);
}

.match-action {
    display: flex;
    align-items: center;
    justify-content: center;
}

.match-action button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    opacity: 0;
    transition: var(--transition);
}

.match-row:hover .match-action button { opacity: 1; }

.match-group-tag {
    font-size: 10px;
    color: var(--accent);
    font-weight: 600;
}

/* === RIGHT PANEL === */
.panel-right {
    padding: 24px;
    overflow-y: auto;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    text-align: center;
    gap: 12px;
}

.empty-icon { font-size: 48px; opacity: 0.6; }
.empty-state h3 { font-size: 18px; font-weight: 600; color: var(--text-2); }
.empty-state p { font-size: 14px; color: var(--text-3); }

/* Poster Match Header */
.poster-match-header {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.pmh-team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.pmh-team img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.pmh-team span {
    font-size: 14px;
    font-weight: 600;
}

.pmh-center {
    text-align: center;
}

.pmh-score {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-1);
}

.pmh-meta {
    font-size: 12px;
    color: var(--text-3);
    margin-top: 4px;
}

/* Poster Grid - side by side */
.poster-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Country Card */
.country-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.country-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
}

.country-header.brazil-bg {
    background: linear-gradient(135deg, rgba(0,156,59,0.15), rgba(255,223,0,0.08));
    border-bottom: 2px solid var(--brazil-green);
}

.country-header.mexico-bg {
    background: linear-gradient(135deg, rgba(0,99,65,0.15), rgba(206,17,38,0.08));
    border-bottom: 2px solid var(--mexico-green);
}

.country-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: contain;
    background: var(--bg-elevated);
    padding: 4px;
}

.country-header h4 {
    font-size: 15px;
    font-weight: 600;
}

.tz-label {
    font-size: 11px;
    color: var(--text-3);
}

/* Copy Panel */
.copy-panel {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.copy-toolbar, .image-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.toolbar-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
    flex: 1;
}

.tool-btn {
    font-family: var(--font);
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-2);
    cursor: pointer;
    transition: var(--transition);
}

.tool-btn:hover {
    background: var(--bg-hover);
    color: var(--text-1);
    border-color: var(--border-active);
}

/* Editable text area */
.copy-editable {
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-1);
    min-height: 120px;
    max-height: 400px;
    overflow-y: visible;
    outline: none;
    transition: var(--transition);
    white-space: pre-wrap;
    word-break: break-word;
}

.copy-editable:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft);
}

.copy-editable:empty::before {
    content: attr(placeholder);
    color: var(--text-3);
}

.btn-copy-full {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 10px;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.btn-copy-full:hover { background: #2563eb; }
.btn-copy-full:active { transform: scale(0.98); }

/* Image Panel */
.image-panel {
    padding: 12px 16px 16px;
}

.image-slot {
    background: var(--bg-base);
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
}

.image-slot:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.image-slot img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-sm);
}

.image-placeholder {
    text-align: center;
    color: var(--text-3);
    padding: 20px;
}

.image-placeholder span {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
}

.image-placeholder small {
    font-size: 11px;
    opacity: 0.7;
}

/* === MODAL === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 15px; font-weight: 600; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-2);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.modal-close:hover { background: var(--bg-hover); }

.modal-body {
    padding: 20px;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body img {
    max-width: 100%;
    max-height: 50vh;
    border-radius: var(--radius-md);
}

.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.modal-btn {
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    transition: var(--transition);
}

.modal-btn:hover { background: #2563eb; }
.modal-btn.secondary { background: var(--bg-elevated); color: var(--text-2); border: 1px solid var(--border); }
.modal-btn.secondary:hover { background: var(--bg-hover); }

/* === TOAST === */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--green);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    z-index: 9999;
    transition: transform 0.3s ease;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,197,102,0.3);
}

.toast.show { transform: translateX(-50%) translateY(0); }

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
    .panel-left {
        position: relative;
        top: 0;
        height: auto;
        max-height: 50vh;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
}

@media (max-width: 600px) {
    .topnav-inner { padding: 8px 12px; }
    .nav-title { font-size: 14px; }
    .panel-right { padding: 12px; }
    .poster-match-header { flex-direction: column; gap: 12px; }
}


/* === PUSH PANEL === */
.push-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    overflow: hidden;
}

.push-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: rgba(59,130,246,0.04);
}

.push-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-1);
}

.push-channels {
    display: flex;
    gap: 8px;
}

.channel-tag {
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 12px;
    background: var(--bg-elevated);
    color: var(--text-3);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition);
}

.channel-tag input { display: none; }

.channel-tag.tg.active {
    background: rgba(0,136,204,0.15);
    color: #0088cc;
    border: 1px solid rgba(0,136,204,0.3);
}

.channel-tag.wa {
    opacity: 0.5;
}

.push-body {
    padding: 16px;
}

.push-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.push-row:last-of-type { border-bottom: none; }

.push-row label:first-child {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    min-width: 80px;
}

.push-time-group {
    display: flex;
    gap: 8px;
    flex: 1;
    justify-content: flex-end;
}

.push-time-group select, .push-time-group input {
    font-family: var(--font);
    font-size: 12px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-base);
    color: var(--text-1);
    outline: none;
}

.push-time-group select:focus, .push-time-group input:focus {
    border-color: var(--accent);
}

.push-content-select {
    display: flex;
    gap: 12px;
}

.push-content-select label {
    font-size: 12px;
    color: var(--text-2);
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.push-content-select input[type="radio"] {
    accent-color: var(--accent);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg-elevated);
    border-radius: 20px;
    transition: var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background: var(--text-3);
    border-radius: 50%;
    transition: var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(16px);
    background: #fff;
}

.push-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.btn-push {
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    flex: 1;
    background: #0088cc;
    color: #fff;
}

.btn-push:hover { background: #006da3; transform: translateY(-1px); }
.btn-push:active { transform: translateY(0); }

.btn-push.secondary {
    background: var(--bg-elevated);
    color: var(--text-2);
    border: 1px solid var(--border);
}

.btn-push.secondary:hover {
    background: var(--bg-hover);
    color: var(--text-1);
}

.push-status {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-3);
    min-height: 18px;
}

.push-status.success { color: var(--green); }
.push-status.error { color: var(--red); }
.push-status.pending { color: var(--gold); }

/* === SCORE POSTER PANEL === */
.score-poster-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    overflow: hidden;
}

.score-poster-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: rgba(245,166,35,0.04);
}

.score-poster-body {
    padding: 16px;
}

.score-poster-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.score-poster-slot {
    background: var(--bg-base);
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    transition: var(--transition);
}

.score-poster-slot img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-sm);
}

.score-poster-slot.has-image {
    border-style: solid;
    border-color: var(--gold);
}

.score-poster-placeholder {
    text-align: center;
    color: var(--text-3);
    padding: 20px;
}

.score-poster-placeholder span {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
}

.score-poster-placeholder small {
    font-size: 11px;
    opacity: 0.7;
}

.score-poster-actions {
    display: flex;
    gap: 8px;
}

/* === SCHEDULED JOBS LIST === */
.scheduled-list {
    margin-top: 12px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.scheduled-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: var(--bg-base);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    font-size: 12px;
}

.scheduled-item .si-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-2);
}

.scheduled-item .si-time {
    color: var(--gold);
    font-weight: 600;
}

.scheduled-item .si-cancel {
    background: none;
    border: none;
    color: var(--red);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
}

.scheduled-item .si-cancel:hover {
    background: rgba(230,57,70,0.1);
}

/* Loading spinner for generation */
.generating {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--gold);
    font-size: 13px;
}

.generating .spin {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }


/* === SCORE SECTION INSIDE COUNTRY CARD === */
.score-section {
    padding: 12px 16px 16px;
    border-top: 1px solid var(--border);
    background: rgba(245,166,35,0.02);
}

.btn-push-score {
    width: 100%;
    margin-top: 8px;
}


/* === TIMEZONE SWITCHER === */
.panel-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.tz-switcher {
    display: flex;
    gap: 4px;
    background: var(--bg-base);
    border-radius: 6px;
    padding: 2px;
}

.tz-btn {
    font-family: var(--font);
    font-size: 11px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: var(--text-3);
    cursor: pointer;
    transition: var(--transition);
}

.tz-btn:hover { color: var(--text-2); }
.tz-btn.active {
    background: var(--accent);
    color: #fff;
}


/* === MATCH HEADER TIME & TZ SWITCH === */
.pmh-time {
    font-size: 16px;
    font-weight: 600;
    color: var(--gold);
    margin-top: 8px;
    letter-spacing: 0.5px;
}

.pmh-tz-switch {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 8px;
    background: var(--bg-base);
    border-radius: 6px;
    padding: 2px;
    display: inline-flex;
}


.push-tz-hint {
    font-size: 11px;
    color: var(--gold);
    font-weight: 500;
    white-space: nowrap;
}


/* === ODDS PANEL (Sofascore style) === */
.pmh-odds {
    margin-top: 12px;
    width: 100%;
    max-width: 320px;
}

.odds-label {
    font-size: 12px;
    color: var(--text-3);
    margin-bottom: 6px;
    font-weight: 500;
}

.odds-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.odds-cell {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 4px;
    text-align: center;
    transition: var(--transition);
}

.odds-cell:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.odds-type {
    display: block;
    font-size: 11px;
    color: var(--text-3);
    margin-bottom: 2px;
    font-weight: 600;
}

.odds-value {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-1);
    outline: none;
    min-width: 40px;
}

.odds-value:focus {
    color: var(--gold);
}
