/* MinneMUDAC — shared styles */

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

:root {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface2: #334155;
    --border: #475569;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --accent: #3b82f6;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,.4);
}

html, body {
    height: 100%;
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* ── Layout helpers ─────────────────────────────── */
.flex       { display: flex; }
.flex-col   { flex-direction: column; }
.flex-1     { flex: 1; min-height: 0; }
.gap-1      { gap: 6px; }
.gap-2      { gap: 12px; }
.gap-3      { gap: 18px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.overflow-y { overflow-y: auto; }
.w-full     { width: 100%; }
.p-2        { padding: 12px; }
.p-3        { padding: 18px; }
.text-sm    { font-size: 0.85rem; }
.text-xs    { font-size: 0.75rem; }
.bold       { font-weight: 700; }
.text-muted { color: var(--text-muted); }
.rounded    { border-radius: var(--radius); }
.text-center { text-align: center; }

/* ── Header bar ─────────────────────────────────── */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    gap: 10px;
}
.topbar h1 { font-size: 1.1rem; font-weight: 700; white-space: nowrap; }
.topbar .div-selector { display: flex; gap: 6px; flex-wrap: wrap; }
.div-btn {
    padding: 5px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text);
    cursor: pointer;
    font-size: 0.85rem;
    transition: background .15s;
}
.div-btn.active { background: var(--accent); border-color: var(--accent); }

/* ── Status dot ─────────────────────────────────── */
.status-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
    background: #64748b;
}
.status-dot.ok   { background: #22c55e; }
.status-dot.warn { background: #eab308; }
.status-dot.err  { background: #ef4444; }

/* ── Table tile ─────────────────────────────────── */
.tile {
    border-radius: var(--radius);
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    transition: filter .15s, opacity .15s;
    border: 2px solid transparent;
    min-height: 80px;
    text-align: center;
    font-weight: 700;
    position: relative;
    overflow: hidden;
}
.tile:active { filter: brightness(1.2); }
.tile .tile-num  { font-size: 1.4rem; line-height: 1; }
.tile .tile-team { font-size: 0.7rem; font-weight: 400; opacity: .85; }
.tile .tile-timer { font-size: 0.85rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile.selected  { border-color: #fff !important; }
.tile.grayed    { opacity: 0.32; pointer-events: none; }
.tile.inactive  { opacity: 0.2; pointer-events: none; }

/* available */
.tile.available { background: var(--surface2); color: var(--text); }

/* break */
.tile.break { background: #374151; color: #9ca3af; }

/* pitching — colors come from JS via inline style */
.tile.pitching  { color: #000; }
.tile.conferring { color: #000; }

/* blinking */
@keyframes blink { 0%,100% { opacity:1; } 50% { opacity:.3; } }
.blinking { animation: blink 0.8s step-end infinite; }

/* ── Team list item ──────────────────────────────── */
.team-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    background: var(--surface);
    border: 2px solid transparent;
    transition: background .1s;
}
.team-item:active { background: var(--surface2); }
.team-item.selected { border-color: var(--accent); background: #1e3a5f; }
.team-item .team-num { font-size: 1.1rem; font-weight: 700; }
.team-item .pitch-count {
    font-size: 0.8rem;
    background: var(--surface2);
    border-radius: 12px;
    padding: 2px 8px;
    font-variant-numeric: tabular-nums;
}
.team-item.behind .team-num { color: #f97316; }
.team-item.pitching-now { border-color: #64748b; opacity: .5; pointer-events: none; }

/* ── Action buttons ──────────────────────────────── */
.action-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 10px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.action-btn {
    flex: 1;
    min-width: 90px;
    max-width: 160px;
    padding: 14px 10px;
    border-radius: var(--radius);
    border: none;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter .15s;
    color: #fff;
}
.action-btn:disabled { opacity: .35; pointer-events: none; }
.action-btn:active   { filter: brightness(1.2); }
.btn-confirming  { background: #06b6d4; color: #000; }
.btn-available   { background: #22c55e; color: #000; }
.btn-break       { background: #6b7280; }
.btn-conflict    { background: #ef4444; }
.btn-warn-ack    { background: #eab308; color: #000; }

/* ── Grid columns ────────────────────────────────── */
.table-grid {
    display: grid;
    gap: 8px;
    padding: 10px;
    align-content: start;
}
.cols-1 { grid-template-columns: 1fr; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-5 { grid-template-columns: repeat(5, 1fr); }

@media (max-width: 480px) {
    .cols-4, .cols-5 { grid-template-columns: repeat(3, 1fr); }
}

/* ── Toast ───────────────────────────────────────── */
#toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity .3s;
    pointer-events: none;
    z-index: 100;
    white-space: nowrap;
}
#toast.show { opacity: 1; }

/* ── Section labels ───────────────────────────────── */
.section-label {
    font-size: 0.7rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 6px 12px 2px;
    flex-shrink: 0;
}

/* ── Scrollbar ────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Admin form styles ────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 0.85rem; color: var(--text-muted); }
input[type=text], input[type=number], input[type=password],
input[type=color], select, textarea {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 10px;
    border-radius: var(--radius);
    font-size: 0.95rem;
    width: 100%;
}
input[type=color] { padding: 2px 4px; height: 36px; cursor: pointer; }
button.submit-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
}
button.submit-btn:hover { filter: brightness(1.15); }
button.danger-btn {
    background: #ef4444;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    cursor: pointer;
}

/* ── Connection indicator ─────────────────────────── */
#conn-status {
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
