/* ==========================================
   CISIVAZ - Match Renderer stilovi
   ==========================================
   Podržava 4 moda: mini, compact, simple, standard
   Koristi CSS varijable sa fallback-om (radi i u temi i van nje)
   ========================================== */

/* ---------- BASE ---------- */
.cvm {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs, 4px);
    width: 100%;
    box-sizing: border-box;
    font-size: 14px;
    color: var(--text-main, #23282d);
}

.cvm-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm, 8px);
    padding: var(--spacing-sm, 8px) var(--spacing-md, 12px);
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color, #e5e5e5);
    border-radius: var(--card-radius, 6px);
    box-sizing: border-box;
    width: 100%;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cvm-item:hover {
    border-color: var(--accent, #0073aa);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.cvm-empty {
    padding: 12px 16px;
    text-align: center;
    color: var(--text-muted, #999);
    font-size: 13px;
    font-style: italic;
    background: var(--bg-highlight, #f9f9f9);
    border: 1px dashed var(--border-color, #ccc);
    border-radius: var(--card-radius, 6px);
}

/* ---------- CUSTOM oznake ---------- */
.cvm .is-custom {
    color: #46b450;
    font-weight: 600;
}

.cvm-star {
    position: absolute;
    top: -4px;
    right: -4px;
    font-size: 9px;
    color: #46b450;
    background: #fff;
    border-radius: 50%;
    width: 12px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 0 0 1px #46b450;
    font-weight: bold;
    z-index: 1;
}

.cvm-logo-wrap {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
}

.cvm-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 3px;
}

/* ==========================================
   MOD: MINI (najmanji)
   ========================================== */
.cvm.cvm-mini {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
}

.cvm-mini-item {
    display: inline-flex;
    padding: 3px 8px;
    font-size: 11px;
    text-transform: uppercase;
    gap: 4px;
    background: var(--bg-highlight, #f8f9fa);
    border: 1px solid var(--border-color, #e5e5e5);
}

.cvm-mini-home,
.cvm-mini-away {
    font-weight: 600;
}

.cvm-mini-sep {
    color: var(--text-muted, #999);
}

.cvm-mini-result {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: var(--accent, #0073aa);
}

/* ==========================================
   MOD: COMPACT (mali)
   ========================================== */
.cvm-compact-item {
    padding: 6px 12px;
    font-size: 13px;
    gap: 8px;
}

.cvm-compact-item .cvm-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 40%;
}

.cvm-compact-sep {
    color: var(--text-muted, #999);
    font-weight: 400;
}

.cvm-compact-result {
    margin-left: auto;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: var(--accent, #0073aa);
}

/* ==========================================
   MOD: SIMPLE (srednji)
   ========================================== */
.cvm-simple-item {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 10px;
    align-items: center;
    padding: 8px 12px;
}

.cvm-simple-home,
.cvm-simple-away {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.cvm-simple-home {
    justify-content: flex-end;
    text-align: right;
}

.cvm-simple-away {
    justify-content: flex-start;
    text-align: left;
}

.cvm-simple-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.cvm-simple-result {
    flex: 0 0 auto;
    text-align: center;
    min-width: 50px;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: var(--accent, #0073aa);
    font-size: 15px;
}

/* ==========================================
   MOD: STANDARD (puni)
   ========================================== */
.cvm-standard-item {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 14px;
    gap: 10px;
}

.cvm-standard-header {
    display: grid;
    grid-template-columns: auto 1fr auto 1fr auto;
    grid-template-areas: "league home score away status";
    gap: 12px;
    align-items: center;
    width: 100%;
}

.cvm-standard-header .cvm-league { grid-area: league; }
.cvm-standard-header .cvm-home   { grid-area: home; justify-content: flex-end; }
.cvm-standard-header .cvm-center { grid-area: score; }
.cvm-standard-header .cvm-away   { grid-area: away; justify-content: flex-start; }
.cvm-standard-header .cvm-status { grid-area: status; }

/* --- LIGA --- */
.cvm-league {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.cvm-league-flag {
    width: 18px;
    height: 14px;
    object-fit: cover;
    border-radius: 2px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.cvm-league-logo-wrap {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
}

.cvm-league-logo {
    width: 18px;
    height: 18px;
    object-fit: contain;
    border-radius: 3px;
}

.cvm-league-emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 14px;
    font-size: 13px;
    line-height: 1;
}

.cvm-league-code {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent, #0073aa);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

/* --- TIMOVI --- */
.cvm-team {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.cvm-team-name {
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cvm-home .cvm-logo-wrap { order: 2; }
.cvm-home .cvm-team-name { order: 1; }

.cvm-away .cvm-logo-wrap { order: 1; }
.cvm-away .cvm-team-name { order: 2; }

/* --- CENTAR --- */
.cvm-center {
    font-weight: 700;
    text-align: center;
    min-width: 55px;
    font-family: 'Courier New', monospace;
}

.cvm-center .cvm-time {
    font-size: 15px;
    color: var(--text-main, #23282d);
}

.cvm-center .cvm-score {
    font-size: 18px;
    color: var(--text-main, #23282d);
}

.cvm-standard-item.is-live .cvm-score,
.cvm-item.is-live .cvm-score {
    color: #dc3232;
}

.cvm-standard-item.is-finished .cvm-score {
    color: #46b450;
}

/* --- STATUS --- */
.cvm-status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.cvm .status-scheduled { background: #e7f3ff; color: #0073aa; }
.cvm .status-live      { background: #f8d7da; color: #721c24; animation: cvm-pulse 1.5s ease-in-out infinite; }
.cvm .status-finished  { background: #d4edda; color: #155724; }
.cvm .status-postponed { background: #fff3cd; color: #856404; }
.cvm .status-unknown   { background: #e9ecef; color: #6c757d; }

@keyframes cvm-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

/* ==========================================
   KVOTE
   ========================================== */
.cvm-odds {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color, #f0f0f0);
    width: 100%;
    box-sizing: border-box;
}

.cvm-odds-group {
    background: var(--bg-highlight, #f9f9f9);
    border: 1px solid var(--border-color, #e5e5e5);
    border-radius: 4px;
    padding: 6px 8px;
}

.cvm-odds-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted, #666);
    text-align: center;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
    letter-spacing: 0.3px;
}

.cvm-odds-row {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

.cvm-odds-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 8px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color, #e5e5e5);
    border-radius: 3px;
    min-width: 52px;
}

.cvm-odds-label {
    font-size: 9px;
    color: var(--text-muted, #777);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.cvm-odds-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent, #0073aa);
    font-family: 'Courier New', monospace;
}

.cvm-odds-change {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
}

.cvm-odds-change.arrow-up   { color: #46b450; background: #d4edda; }
.cvm-odds-change.arrow-down { color: #dc3232; background: #f8d7da; }
.cvm-odds-change.arrow-same { color: #999; background: #e9ecef; }

.cvm-no-odds {
    margin-top: 8px;
    padding: 6px 12px;
    background: var(--bg-highlight, #f9f9f9);
    border: 1px dashed var(--border-color, #ccc);
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-muted, #999);
    font-style: italic;
    text-align: center;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 900px) {
    .cvm-standard-header {
        grid-template-columns: 1fr auto 1fr;
        grid-template-areas:
            "league league league"
            "home   score  away"
            "status status status";
        gap: 8px;
    }

    .cvm-standard-header .cvm-home {
        flex-direction: column-reverse;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    .cvm-standard-header .cvm-away {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    .cvm-team-name {
        text-align: center;
        font-size: 12px;
        white-space: normal;
        line-height: 1.2;
    }

    .cvm-status { text-align: center; }

    .cvm-odds { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .cvm-mini-item { font-size: 10px; }
    .cvm-simple-item { padding: 6px 10px; gap: 6px; }
    .cvm-simple-result { font-size: 13px; min-width: 42px; }
    .cvm-simple-name { font-size: 12px; }
    .cvm-simple-item .cvm-logo { width: 20px; height: 20px; }
    .cvm-standard-header .cvm-logo { width: 20px; height: 20px; }
    .cvm-team-name { font-size: 11px; }
    .cvm-center .cvm-score { font-size: 16px; }
    .cvm-center .cvm-time { font-size: 13px; }
    .cvm-odds-cell { min-width: 46px; padding: 3px 6px; }
    .cvm-odds-value { font-size: 12px; }
}