/* ============================================================
   Košarkaška liga — osnovni i javni stilovi
   ============================================================ */

:root {
    --primary:        #ea580c;   /* narandžasta (košarka) */
    --primary-dark:   #c2410c;
    --primary-soft:   #fff1e9;
    --bg:             #f1f5f9;
    --card:           #ffffff;
    --text:           #0f172a;
    --muted:          #64748b;
    --border:         #e2e8f0;
    --success:        #16a34a;
    --success-soft:   #dcfce7;
    --danger:         #dc2626;
    --danger-soft:    #fee2e2;
    --shadow:         0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-lg:      0 10px 30px rgba(15, 23, 42, .10);
    --radius:         14px;
    --radius-sm:      9px;
    --transition:     .18s cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ---------------------------- Header ----------------------------------- */
.site-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    padding: 26px 0;
    box-shadow: var(--shadow);
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .ball {
    width: 40px; height: 40px;
    background: #fff; color: var(--primary);
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 22px; font-weight: 800;
    flex: 0 0 auto;
}
.brand h1 { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; }
.brand p  { font-size: .82rem; opacity: .9; }
.header-link {
    color: #fff; text-decoration: none;
    font-size: .85rem; font-weight: 600;
    padding: 8px 14px;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 999px;
    transition: background var(--transition);
}
.header-link:hover { background: rgba(255, 255, 255, .15); }

/* ---------------------------- Tabovi ----------------------------------- */
.tabs {
    display: flex;
    gap: 6px;
    background: var(--card);
    padding: 6px;
    border-radius: 999px;
    box-shadow: var(--shadow);
    margin: 22px auto;
    max-width: 360px;
}
.tab-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: .95rem;
    font-weight: 700;
    padding: 11px 10px;
    border-radius: 999px;
    cursor: pointer;
    transition: var(--transition);
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(234, 88, 12, .35);
}

.tab-panel { display: none; animation: fadeIn .25s ease; }
.tab-panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

main { padding-bottom: 60px; }

/* ------------------------ Logo / placeholder --------------------------- */
.team-logo {
    width: 30px; height: 30px;
    border-radius: 50%;
    object-fit: cover;
    background: #fff;
    border: 1px solid var(--border);
    flex: 0 0 auto;
}
.team-logo.placeholder {
    display: grid; place-items: center;
    color: #fff;
    font-size: .72rem;
    font-weight: 800;
    border: none;
    text-transform: uppercase;
}

/* --------------------------- Kolo kartice ------------------------------ */
.round {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 14px;
    overflow: hidden;
}
.round-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    cursor: pointer;
    user-select: none;
    transition: background var(--transition);
}
.round-head:hover { background: var(--primary-soft); }
.round-head h3 { font-size: 1rem; font-weight: 800; }
.round-head .meta { font-size: .78rem; color: var(--muted); }
.round-head .chev { transition: transform var(--transition); color: var(--muted); }
.round.open .round-head .chev { transform: rotate(180deg); }
.round-body { display: none; padding: 4px 12px 14px; }
.round.open .round-body { display: block; }

/* --------------------------- Meč kartica ------------------------------- */
.match {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}
.match + .match { border-top: 1px solid var(--border); }
.match:hover { background: #f8fafc; }

.match .side { display: flex; align-items: center; gap: 9px; min-width: 0; }
.match .side.home { justify-content: flex-end; text-align: right; }
.match .side.away { justify-content: flex-start; text-align: left; }
.match .side .name {
    font-size: .9rem; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.match .center { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.score-inputs { display: flex; align-items: center; gap: 6px; }
.score-inputs input {
    width: 46px; height: 38px;
    text-align: center;
    font-size: 1rem; font-weight: 700;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
    -moz-appearance: textfield;
}
.score-inputs input::-webkit-outer-spin-button,
.score-inputs input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.score-inputs input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(234, 88, 12, .15);
}
.score-inputs .sep { color: var(--muted); font-weight: 700; }

/* --------------------------- Save dugme -------------------------------- */
.btn {
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .65; cursor: not-allowed; }

.btn-save {
    background: var(--primary);
    color: #fff;
    font-size: .8rem;
    padding: 8px 16px;
    min-width: 78px;
}
.btn-save:hover:not(:disabled) { background: var(--primary-dark); }
.btn-save.success { background: var(--success); }

.spinner {
    width: 14px; height: 14px;
    border: 2px solid rgba(255, 255, 255, .5);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------- Tabela lige ------------------------------- */
.table-wrap {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}
table.standings {
    width: 100%;
    border-collapse: collapse;
    min-width: 620px;
}
table.standings thead th {
    position: sticky;
    top: 0;
    background: var(--text);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: 12px 8px;
    text-align: center;
    white-space: nowrap;
}
table.standings thead th.team-col { text-align: left; }
table.standings tbody td {
    padding: 11px 8px;
    text-align: center;
    font-size: .88rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
table.standings tbody tr:hover { background: var(--primary-soft); }
table.standings tbody tr:last-child td { border-bottom: none; }
table.standings .pos {
    font-weight: 800;
    width: 34px;
    color: var(--muted);
}
table.standings .team-col {
    text-align: left;
}
table.standings .team-cell {
    display: flex; align-items: center; gap: 9px;
    font-weight: 700;
}
table.standings .pts { font-weight: 800; color: var(--primary); font-size: .95rem; }
table.standings .group-badge {
    display: inline-block;
    font-size: .62rem; font-weight: 800;
    padding: 2px 6px; border-radius: 6px;
    background: var(--border); color: var(--muted);
    margin-left: 6px;
}
.rank-1 .pos { color: #d97706; }

/* ------------------------ Toast poruke --------------------------------- */
#toast-wrap {
    position: fixed;
    bottom: 20px; left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex; flex-direction: column; gap: 8px;
    width: calc(100% - 32px);
    max-width: 420px;
}
.toast {
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    font-size: .88rem; font-weight: 600;
    color: #fff;
    box-shadow: var(--shadow-lg);
    animation: toastIn .25s ease;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ----------------------------- Prazno stanje --------------------------- */
.empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--muted);
}
.empty .big { font-size: 2.4rem; margin-bottom: 8px; }
.loading-block { text-align: center; padding: 40px; color: var(--muted); }

/* ----------------------------- Responsive ------------------------------ */
@media (max-width: 560px) {
    .brand h1 { font-size: 1.1rem; }
    .match { grid-template-columns: 1fr; gap: 8px; text-align: center; }
    .match .side.home, .match .side.away { justify-content: center; text-align: center; }
    .match .center { order: 3; margin-top: 4px; }
    .match .side .name { white-space: normal; }
    .round-head { padding: 14px; }
    .tabs { margin: 16px auto; }
}
