:root {
    --bg: #081329;
    --card: #071123;
    --accent: #7c3aed;
    --muted: #94a3b8;
    --glass: rgba(255, 255, 255, 0.03);
}

* {
    box-sizing: border-box;
    font-family: Inter, system-ui, Segoe UI, Roboto, Arial;
}

body {
    margin: 0;
    background: linear-gradient(180deg, #071021 0%, #081329 60%);
    color: #e6eef8;
    min-height: 100vh;
    padding: 12px;
    display: flex;
    justify-content: center;
}

.wrap {
    width: 100%;
    max-width: 980px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

h1 {
    margin: 0;
    font-size: 20px;
}

.muted {
    color: var(--muted);
    font-size: 13px;
}

.card {
    width: 100%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 6px 20px rgba(2, 6, 23, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.top-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.row-item {
    flex: 1;
    min-width: 180px;
}

/* inputs, selects, buttons */
input,
select,
button {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: transparent;
    color: inherit;
}

/* select: zatvoren = bijeli tekst; otvoren/fokusiran = crni tekst */
.card select {
    color: #fff;
}

.card select:focus,
.card select:active {
    color: #000;
}

/* opcije u listboxu čitljive */
.card select option {
    color: #000;
    background: #fff;
}

/* optional: force native appearance tweaks for some browsers */
.card select::-ms-expand {
    display: block;
}

.card select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* buttons */
.btn {
    cursor: pointer;
    border: 0;
    padding: 10px 12px;
    border-radius: 10px;
}

.btn-primary {
    background: linear-gradient(90deg, var(--accent), #5b21b6);
    color: white;
}

.btn-ghost {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.small-btn {
    padding: 8px;
}

/* players grid (2 columns compact) */
.players-grid {
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    max-height: 360px;
    overflow: auto;
}

.player-cell {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-radius: 8px;
    background: var(--glass);
    font-size: 14px;
}

.player-cell-text {
    max-width: calc(100% - 40px);
    overflow: hidden;
}

.player-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trash {
    background: #ef4444;
    color: white;
    border-radius: 8px;
    padding: 6px 8px;
    border: 0;
    cursor: pointer;
    font-size: 14px;
}

/* db-checkbox modal */
.db-checkboxes {
    margin-top: 10px;
    max-height: 240px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 6px;
}

.db-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.02);
}

.db-checkbox input {
    width: 16px;
    height: 16px;
}

/* switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #333;
    border-radius: 24px;
    transition: .2s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: .2s;
}

.switch input:checked+.slider {
    background: var(--accent);
}

.switch input:checked+.slider:before {
    transform: translateX(20px);
}

/* modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

.modal-card {
    width: 100%;
    max-width: 620px;
    background: var(--card);
    border-radius: 12px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.disc {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 6px solid rgba(255, 255, 255, 0.04);
    border-top-color: var(--accent);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.tease {
    margin-top: 10px;
    color: var(--muted);
}

.teams {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.team {
    flex: 1;
    background: rgba(255, 255, 255, 0.02);
    padding: 8px;
    border-radius: 8px;
    min-height: 140px;
    overflow: auto;
}

.member {
    padding: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    margin-bottom: 8px;
}

.tag {
    background: rgba(255, 255, 255, 0.04);
    padding: 6px 8px;
    border-radius: 999px;
    font-size: 12px;
    color: var(--muted);
}

/* responsive */
@media (max-width:700px) {
    .top-row {
        flex-direction: column;
        align-items: stretch;
    }

    .players-grid {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .modal-card {
        max-width: 92%;
    }

    .disc {
        width: 56px;
        height: 56px;
        border-width: 5px;
    }

    .team {
        min-height: 90px;
    }

    .players-grid {
        max-height: 320px;
    }
}