/* =============================================================================
   Trivela World Cup Predictions — Frontend CSS
   Mobile-first · RTL · Hebrew
   All classes prefixed: trivela-prediction- / trivela-lb- / trivela-
   ============================================================================= */

/* ── Reset / base ──────────────────────────────────────────────────────────── */
.trivela-prediction-game,
.trivela-leaderboard,
.trivela-private-league {
    direction: rtl;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    color: #1a1a2e;
    max-width: 820px;
    margin: 0 auto;
    padding: 0 16px 32px;
    box-sizing: border-box;
}

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.trivela-btn {
    display: inline-block;
    padding: 10px 22px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    text-decoration: none !important;
    transition: background 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
    line-height: 1.4;
    text-align: center;
    -webkit-appearance: none;
}

.trivela-btn-primary {
    background: #e94560;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(233,69,96,0.3);
}
.trivela-btn-primary:hover {
    background: #c9304d;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(233,69,96,0.4);
}

.trivela-btn-outline {
    background: transparent;
    color: #e94560 !important;
    border: 2px solid #e94560;
}
.trivela-btn-outline:hover {
    background: #e94560;
    color: #fff !important;
}

.trivela-btn-sm {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 6px;
    background: #f0f0f0;
    color: #444 !important;
    font-weight: 600;
}
.trivela-btn-sm:hover { background: #e0e0e0; }

/* ── Login notice ──────────────────────────────────────────────────────────── */
.trivela-login-notice {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    padding: 24px 20px;
    border-radius: 14px;
    text-align: center;
    margin-bottom: 28px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.trivela-login-notice p {
    margin: 0 0 16px;
    font-size: 16px;
    opacity: .9;
}
.trivela-login-notice .trivela-btn { margin: 4px; }

/* ── Empty state ───────────────────────────────────────────────────────────── */
.trivela-empty-state {
    text-align: center;
    padding: 48px 0;
    color: #888;
    font-size: 16px;
}

/* ── Date group ────────────────────────────────────────────────────────────── */
.trivela-date-group { margin-bottom: 28px; }

.trivela-date-header {
    font-size: 13px;
    font-weight: 700;
    color: #666;
    letter-spacing: .4px;
    padding-bottom: 8px;
    margin: 0 0 12px;
    border-bottom: 2px solid #f0f0f0;
}

/* ── Match card ─────────────────────────────────────────────────────────────── */
.trivela-match-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #ebebeb;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    margin-bottom: 10px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}
.trivela-match-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
.trivela-match-card.is-finished  { background: #fafafa; }
.trivela-match-card.is-locked    { opacity: .88; }
.trivela-match-card.is-live      { border: 2px solid #e94560; }

/* ── Match meta bar ─────────────────────────────────────────────────────────── */
.trivela-match-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 14px;
    background: #f7f8fa;
    border-bottom: 1px solid #f0f0f0;
    font-size: 12px;
}
.trivela-match-time  { font-weight: 700; color: #333; }
.trivela-match-stage {
    background: #e8f4fd;
    color: #1565c0;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 600;
}
.trivela-group-badge  { color: #888; font-size: 11px; }
.trivela-live-badge   { color: #e94560; font-weight: 700; animation: trivela-blink 1.2s step-end infinite; }
.trivela-locked-badge { color: #f59300; font-weight: 600; }
.trivela-finished-badge { color: #43a047; font-weight: 600; }

@keyframes trivela-blink {
    0%,100% { opacity: 1; }
    50%      { opacity: 0.35; }
}

/* ── Match body ─────────────────────────────────────────────────────────────── */
.trivela-match-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 16px;
}

/* ── Teams ──────────────────────────────────────────────────────────────────── */
.trivela-team {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    gap: 7px;
    text-align: center;
    min-width: 0; /* allow text truncation */
}
.trivela-team-flag {
    width: 52px;
    height: 34px;
    object-fit: cover;
    border-radius: 5px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.trivela-flag-placeholder {
    width: 52px;
    height: 34px;
    background: #e8e8e8;
    border-radius: 5px;
}
.trivela-team-name {
    font-size: 14px;
    font-weight: 800;
    line-height: 1.2;
    max-width: 100%;
    word-break: break-word;
}

/* ── Score / center area ────────────────────────────────────────────────────── */
.trivela-score-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    width: 160px;
}

/* Score inputs */
.trivela-score-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
}
.trivela-score-input {
    width: 54px;
    height: 54px;
    border: 2px solid #ddd;
    border-radius: 10px;
    text-align: center;
    font-size: 22px;
    font-weight: 800;
    color: #1a1a2e;
    background: #f8f9fa;
    transition: border-color 0.18s, background 0.18s;
    -moz-appearance: textfield;
    box-sizing: border-box;
}
.trivela-score-input::-webkit-outer-spin-button,
.trivela-score-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.trivela-score-input:focus {
    outline: none;
    border-color: #e94560;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(233,69,96,0.12);
}
.trivela-score-sep {
    font-size: 20px;
    font-weight: 800;
    color: #bbb;
}

.trivela-submit-btn {
    width: 100%;
    padding: 9px 0;
    font-size: 13px;
}

/* Real score display */
.trivela-real-score {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 34px;
    font-weight: 900;
    color: #1a1a2e;
    line-height: 1;
}
.trivela-real-score span:first-child,
.trivela-real-score span:last-child { min-width: 32px; text-align: center; }

/* User prediction result */
.trivela-user-result {
    text-align: center;
    line-height: 1.2;
}
.trivela-user-result.pts-positive .trivela-pts-value { color: #43a047; }
.trivela-user-result.pts-zero     .trivela-pts-value { color: #bbb; }
.trivela-pts-value {
    font-size: 20px;
    font-weight: 900;
    display: block;
}
.trivela-your-pred {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}
.trivela-no-pred  { font-size: 11px; color: #bbb; }

/* Locked VS badge */
.trivela-vs-badge {
    font-size: 16px;
    font-weight: 800;
    color: #ccc;
    letter-spacing: 2px;
}

/* Message box inside form */
.trivela-prediction-message {
    width: 100%;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    text-align: center;
    box-sizing: border-box;
    margin-top: 2px;
}
.trivela-msg-success { background: #e8f5e9; color: #2e7d32; }
.trivela-msg-error   { background: #ffebee; color: #b71c1c; }
.trivela-msg-warning { background: #fff8e1; color: #e65100; }


/* ═══════════════════════════════════════════════════════════════════════════════
   LEADERBOARD
   ═══════════════════════════════════════════════════════════════════════════════ */

.trivela-lb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}
.trivela-lb-title {
    font-size: 22px;
    font-weight: 900;
    margin: 0;
}
.trivela-my-stats {
    font-size: 14px;
    color: #555;
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}
.trivela-my-stat strong { color: #e94560; font-size: 16px; }
.trivela-my-stat-sep   { color: #ccc; }

.trivela-lb-wrap {
    overflow-x: auto;
    border-radius: 14px;
    box-shadow: 0 2px 14px rgba(0,0,0,0.07);
    margin-bottom: 16px;
}
.trivela-lb-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: 14px;
    min-width: 440px;
}
.trivela-lb-table thead tr {
    background: #1a1a2e;
    color: #fff;
}
.trivela-lb-table th {
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}
.trivela-lb-table td {
    padding: 11px 16px;
    border-bottom: 1px solid #f0f0f0;
    text-align: right;
}
.trivela-lb-table tbody tr:last-child td { border-bottom: none; }
.trivela-lb-table tbody tr:hover td     { background: #f7f8fa; }

.trivela-lb-me td {
    background: #fff8e1 !important;
    font-weight: 700;
}

.trivela-rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 800;
}
.trivela-rank-1     { background: #ffd700; color: #5a4000; }
.trivela-rank-2     { background: #c0c0c0; color: #3a3a3a; }
.trivela-rank-3     { background: #cd7f32; color: #fff; }
.trivela-rank-other { background: #f0f0f0; color: #777; }

.trivela-me-tag {
    font-size: 11px;
    color: #e94560;
    font-weight: 600;
    margin-right: 4px;
}
.trivela-lb-legend {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #888;
    padding: 4px 0;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   PRIVATE LEAGUES
   ═══════════════════════════════════════════════════════════════════════════════ */

.trivela-pl-section { margin-bottom: 28px; }

.trivela-section-title {
    font-size: 18px;
    font-weight: 800;
    margin: 0 0 14px;
    color: #1a1a2e;
}

.trivela-league-card {
    background: #fff;
    border-radius: 14px;
    border: 1px solid #ebebeb;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    padding: 18px 20px;
    margin-bottom: 12px;
}
.trivela-league-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.trivela-league-name {
    font-size: 17px;
    font-weight: 800;
}
.trivela-league-meta { font-size: 12px; color: #888; }
.trivela-creator-badge {
    font-size: 11px;
    background: #e94560;
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
}
.trivela-invite-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    font-size: 14px;
    flex-wrap: wrap;
}
.trivela-invite-label { color: #666; }
.trivela-invite-code {
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 4px;
    color: #1a1a2e;
    background: #f4f4f6;
    padding: 4px 14px;
    border-radius: 8px;
    border: 2px dashed #ddd;
}

/* Mini leaderboard inside league card */
.trivela-lb-mini {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 4px;
}
.trivela-lb-mini th,
.trivela-lb-mini td {
    padding: 8px 12px;
    text-align: right;
    border-bottom: 1px solid #f0f0f0;
}
.trivela-lb-mini thead { background: #f7f8fa; font-weight: 700; font-size: 12px; }
.trivela-lb-mini tbody tr:last-child td { border-bottom: none; }
.trivela-lb-mini .trivela-lb-me td { background: #fff8e1; font-weight: 700; }

.trivela-empty-msg { font-size: 13px; color: #aaa; }

/* Form cards */
.trivela-form-card {
    background: #fff;
    border-radius: 14px;
    border: 1px solid #ebebeb;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    padding: 22px 24px;
}
.trivela-form-group { margin-bottom: 16px; }
.trivela-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 6px;
    color: #444;
}
.trivela-form-group input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #ddd;
    border-radius: 9px;
    font-size: 15px;
    direction: rtl;
    box-sizing: border-box;
    transition: border-color 0.18s;
    font-family: inherit;
}
.trivela-form-group input[type="text"]:focus {
    outline: none;
    border-color: #e94560;
    box-shadow: 0 0 0 3px rgba(233,69,96,0.1);
}

/* Alert boxes */
.trivela-alert {
    padding: 11px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin: 10px 0;
}
.trivela-alert-success { background: #e8f5e9; color: #2e7d32; }
.trivela-alert-error   { background: #ffebee; color: #b71c1c; }

/* ── Toast notification ─────────────────────────────────────────────────────── */
.trivela-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a2e;
    color: #fff;
    padding: 10px 22px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    z-index: 99999;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    pointer-events: none;
    white-space: nowrap;
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 500px) {
    .trivela-team-name  { font-size: 12px; }
    .trivela-score-input { width: 46px; height: 46px; font-size: 19px; }
    .trivela-real-score  { font-size: 28px; }
    .trivela-score-area  { width: 130px; }
    .trivela-match-body  { padding: 12px 8px; }
    .trivela-lb-table td,
    .trivela-lb-table th { padding: 9px 10px; }
    .trivela-my-stats    { display: none; }
}
