/* ==========================================
   WORLD CUP 2026 BETTING APP - STYLES
   ========================================== */

/* ---- Reset & Base ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --green-dark:   #1a4731;
    --green-mid:    #2d6a4f;
    --green-light:  #40916c;
    --green-bright: #52b788;
    --gold:         #f4a261;
    --gold-dark:    #e76f51;
    --bg:           #f0f4f0;
    --card-bg:      #ffffff;
    --text:         #1b2427;
    --text-light:   #5a6872;
    --border:       #d8e4dc;
    --radius:       12px;
    --shadow:       0 2px 12px rgba(0,0,0,.10);
    --shadow-lg:    0 6px 24px rgba(0,0,0,.14);
}

html, body {
    height: 100%;
    font-family: 'Segoe UI', 'Arial', sans-serif;
    background: var(--bg);
    color: var(--text);
    direction: rtl;
    font-size: 15px;
    line-height: 1.5;
}

section { display: block; }
.hidden { display: none !important; }

/* ==========================================
   LOGIN SCREEN
   ========================================== */

#login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--green-dark) 0%, var(--green-mid) 60%, var(--green-light) 100%);
    padding: 20px;
}

.login-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 40px 36px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-logo {
    font-size: 64px;
    margin-bottom: 12px;
    animation: bounce 1.6s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-8px); }
}

.login-card h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--green-dark);
    margin-bottom: 6px;
}

.login-subtitle {
    color: var(--text-light);
    margin-bottom: 28px;
    font-size: .95rem;
}

.field-group {
    text-align: right;
    margin-bottom: 16px;
}

.field-group label {
    display: block;
    font-weight: 600;
    font-size: .85rem;
    margin-bottom: 5px;
    color: var(--text);
}

.field-group input,
.field-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: .95rem;
    transition: border-color .2s;
    direction: rtl;
}

.field-group input:focus,
.field-group select:focus {
    outline: none;
    border-color: var(--green-light);
}

.login-hint {
    color: var(--text-light);
    font-size: .8rem;
    margin-top: 16px;
}

/* ==========================================
   BUTTONS
   ========================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .18s;
    white-space: nowrap;
}

.btn-block { width: 100%; }
.btn-sm    { padding: 6px 12px; font-size: .82rem; }
.btn-large { padding: 12px 24px; font-size: 1rem; }

.btn-primary {
    background: var(--green-mid);
    color: #fff;
}
.btn-primary:hover { background: var(--green-dark); }

.btn-secondary {
    background: var(--bg);
    color: var(--green-dark);
    border: 1.5px solid var(--green-bright);
}
.btn-secondary:hover { background: var(--border); }

.btn-danger {
    background: #e53e3e;
    color: #fff;
}
.btn-danger:hover { background: #c53030; }

.btn-ghost {
    background: transparent;
    color: var(--text-light);
    border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); }

.btn-text {
    background: transparent;
    border: none;
    color: rgba(255,255,255,.75);
    font-size: .85rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background .15s;
}
.btn-text:hover { background: rgba(255,255,255,.15); }

/* ==========================================
   APP BAR
   ========================================== */

.app-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--green-dark);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.app-bar-title {
    font-size: 1.1rem;
    font-weight: 800;
}

.app-bar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .85rem;
    color: rgba(255,255,255,.85);
}

.admin-bar { background: #2c1654; }

/* ==========================================
   TAB BAR
   ========================================== */

.tab-bar {
    display: flex;
    background: var(--card-bg);
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 53px;
    z-index: 90;
}

.tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 4px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    font-size: .78rem;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    transition: all .18s;
    margin-bottom: -2px;
}

.tab-btn .tab-icon { font-size: 1.2rem; }

.tab-btn.active {
    color: var(--green-mid);
    border-bottom-color: var(--green-mid);
}

/* ==========================================
   APP CONTENT
   ========================================== */

.app-content {
    padding: 16px;
    max-width: 680px;
    margin: 0 auto;
    padding-bottom: 40px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ==========================================
   STAGE FILTER
   ========================================== */

.stage-filter {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 16px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.stage-filter::-webkit-scrollbar { display: none; }

.filter-btn {
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    background: var(--card-bg);
    color: var(--text-light);
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--green-mid);
    color: #fff;
    border-color: var(--green-mid);
}

/* ==========================================
   MATCH STAGE GROUP HEADER
   ========================================== */

.stage-group-header {
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-light);
    padding: 12px 4px 6px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
    margin-top: 20px;
}

.stage-group-header:first-child { margin-top: 0; }

/* ==========================================
   MATCH CARD
   ========================================== */

.match-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 10px;
    overflow: hidden;
    border: 1.5px solid var(--border);
    transition: box-shadow .18s;
}

.match-card:hover { box-shadow: var(--shadow-lg); }

.match-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    font-size: .78rem;
    color: var(--text-light);
}

.match-date-str { font-weight: 600; }

.match-status-badge {
    font-size: .72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}

.badge-upcoming {
    background: #e8f5e9;
    color: var(--green-mid);
}

.badge-completed {
    background: #f5f5f5;
    color: #777;
}

.badge-locked {
    background: #fff3e0;
    color: #e65100;
}

.match-card-body {
    padding: 16px 14px;
}

.match-teams-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.match-team {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
}

.team-flag { font-size: 2rem; }
.team-name {
    font-size: .88rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

/* Middle area: shows "vs", the result, or the bet form */
.match-middle {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 90px;
    text-align: center;
}

.vs-text {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-light);
}

/* Actual result display */
.result-score {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--green-dark);
    letter-spacing: 2px;
}

/* Bet entry form inside card */
.bet-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bet-score-input {
    width: 48px;
    height: 44px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    transition: border-color .2s;
}

.bet-score-input:focus {
    outline: none;
    border-color: var(--green-light);
}

.bet-sep {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-light);
}

.btn-save-bet {
    padding: 7px 14px;
    background: var(--green-mid);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .18s;
    margin-top: 6px;
    width: 100%;
}
.btn-save-bet:hover { background: var(--green-dark); }

/* Saved bet display */
.my-bet-score {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--green-mid);
    letter-spacing: 2px;
}

.my-bet-label {
    font-size: .72rem;
    color: var(--text-light);
    font-weight: 600;
}

.bet-edit-link {
    background: none;
    border: none;
    color: var(--green-light);
    font-size: .75rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 2px;
}

/* Points badge under the match */
.match-points-row {
    margin-top: 10px;
    text-align: center;
    padding: 6px;
    border-radius: 8px;
    font-size: .85rem;
    font-weight: 700;
}

.points-3  { background: #e8f5e9; color: #2e7d32; }
.points-1  { background: #fff3e0; color: #e65100; }
.points-0  { background: #fafafa; color: #9e9e9e; }
.points-na { background: #fafafa; color: #bdbdbd; font-style: italic; }

/* Locked message */
.bet-locked-msg {
    font-size: .78rem;
    color: #e65100;
    font-weight: 600;
}

/* ==========================================
   LEADERBOARD
   ========================================== */

.leaderboard-header {
    margin-bottom: 16px;
}
.leaderboard-header h2 { font-size: 1.3rem; margin-bottom: 6px; }

.scoring-legend {
    display: flex;
    gap: 12px;
    font-size: .8rem;
    color: var(--text-light);
    flex-wrap: wrap;
}

.legend-sep { color: var(--border); }

.leaderboard-table {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1.5px solid var(--border);
}

.leaderboard-row {
    display: flex;
    align-items: center;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
    transition: background .12s;
}

.leaderboard-row:last-child { border-bottom: none; }
.leaderboard-row:hover { background: var(--bg); }

.leaderboard-row.is-me {
    background: #e8f5e9;
    font-weight: 700;
}

.lb-rank {
    font-size: 1.1rem;
    min-width: 32px;
    text-align: center;
}

.lb-name { flex: 1; font-weight: 600; }
.lb-me-tag {
    font-size: .72rem;
    background: var(--green-bright);
    color: #fff;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 700;
}

.lb-points {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--green-dark);
    min-width: 40px;
    text-align: left;
}

.lb-pts-label {
    font-size: .75rem;
    color: var(--text-light);
}

/* ==========================================
   MY BETS TAB
   ========================================== */

.my-bets-title { font-size: 1.2rem; margin-bottom: 16px; }

.my-bet-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 10px;
    border: 1.5px solid var(--border);
    padding: 14px 16px;
}

.my-bet-match-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 4px;
}

.my-bet-teams {
    font-weight: 700;
    font-size: .95rem;
}

.my-bet-date { font-size: .78rem; color: var(--text-light); }

.my-bet-scores-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.my-bet-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.my-bet-col-label {
    font-size: .72rem;
    color: var(--text-light);
    font-weight: 600;
}

.my-bet-col-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--green-mid);
}

.my-bet-col-value.result-val { color: var(--text); }

/* ==========================================
   ADMIN PANEL
   ========================================== */

.admin-auth-card {
    max-width: 360px;
    margin: 40px auto;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 32px 28px;
    box-shadow: var(--shadow);
    text-align: center;
}

.admin-auth-card h2 { margin-bottom: 20px; }

.admin-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
    border: 1.5px solid var(--border);
}

.admin-section h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--green-dark);
}

.add-match-form input,
.add-match-form select {
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: .88rem;
    flex: 1;
    min-width: 0;
    direction: rtl;
}

.add-match-form input:focus,
.add-match-form select:focus {
    outline: none;
    border-color: var(--green-light);
}

.form-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.vs-label {
    font-weight: 800;
    color: var(--text-light);
    flex-shrink: 0;
}

.admin-match-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    gap: 10px;
    flex-wrap: wrap;
}

.admin-match-row:last-child { border-bottom: none; }

.admin-match-info {
    flex: 1;
    min-width: 0;
}

.admin-match-teams {
    font-weight: 700;
    font-size: .9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-match-meta {
    font-size: .75rem;
    color: var(--text-light);
    margin-top: 2px;
}

.admin-match-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.admin-result-badge {
    font-size: .82rem;
    font-weight: 700;
    color: var(--green-mid);
    padding: 2px 8px;
    background: #e8f5e9;
    border-radius: 8px;
}

/* ==========================================
   MODALS
   ========================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 28px 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.modal-card h3 {
    font-size: 1.1rem;
    margin-bottom: 6px;
    color: var(--green-dark);
}

.modal-subtitle {
    font-size: .85rem;
    color: var(--text-light);
    margin-bottom: 20px;
}

.result-form {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 20px 0;
}

.result-team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.result-team-name {
    font-weight: 700;
    font-size: .9rem;
    text-align: center;
    max-width: 100px;
}

.score-big {
    width: 64px;
    height: 56px;
    text-align: center;
    font-size: 1.6rem;
    font-weight: 800;
    border: 2px solid var(--border);
    border-radius: 10px;
    color: var(--green-dark);
}

.score-big:focus {
    outline: none;
    border-color: var(--green-light);
}

.result-sep {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-light);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-direction: column;
}

/* ==========================================
   MISC
   ========================================== */

.state-msg {
    text-align: center;
    color: var(--text-light);
    padding: 40px 20px;
    font-size: .95rem;
}

.error-msg {
    color: #e53e3e;
    font-size: .83rem;
    margin-bottom: 10px;
    text-align: right;
}

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

@media (max-width: 420px) {
    .app-content { padding: 12px; }
    .match-card-body { padding: 12px 10px; }
    .team-flag { font-size: 1.6rem; }
    .team-name { font-size: .8rem; }
    .result-score { font-size: 1.3rem; }
    .my-bet-score { font-size: 1.1rem; }
    .btn-save-bet { font-size: .78rem; padding: 6px 10px; }
}
