/* ============================================================
   SGOR – Youth Girls Football Fixture Manager
   Mobile-first · Bootstrap 5 supplement · Inter typeface
   ============================================================ */

/* ── Design tokens ───────────────────────────────────────────── */
:root {
    --sgor-red:        #c0392b;
    --sgor-red-dk:     #9b2d22;
    --sgor-red-light:  rgba(192, 57, 43, 0.08);
    --sgor-red-mid:    rgba(192, 57, 43, 0.15);

    --bg:              #f4f6fb;
    --surface:         #ffffff;
    --border:          #e4e7ef;
    --border-light:    #f0f2f7;

    --text:            #1c1f2e;
    --text-muted:      #6b7280;
    --text-xmuted:     #9ca3af;

    --radius-sm:       8px;
    --radius:          12px;
    --radius-lg:       16px;
    --radius-xl:       20px;

    --shadow-sm:       0 1px 4px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.03);
    --shadow:          0 4px 16px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);
    --shadow-lg:       0 8px 32px rgba(0,0,0,0.13), 0 0 0 1px rgba(0,0,0,0.05);

    --transition:      150ms ease;
    --sidebar-width:   288px;
    --navbar-h:        56px;
}

/* ── Base & Typography ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 0.925rem;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1,h2,h3,h4,h5,h6 { font-weight: 700; line-height: 1.3; color: var(--text); }
a { color: var(--sgor-red); }
a:hover { color: var(--sgor-red-dk); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

/* ── Navbar ──────────────────────────────────────────────────── */
.sgor-navbar {
    height: var(--navbar-h);
    background: #2d2d2d !important;
    box-shadow: 0 2px 16px rgba(0,0,0,0.3);
    z-index: 1030;
}
.sgor-navbar .navbar-brand {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #fff !important;
}
.sgor-navbar .navbar-brand img {
    height: 34px;
    width: auto;
    filter: drop-shadow(0 1px 4px rgba(0,0,0,0.25));
}
.sgor-menu-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: none;
    background: rgba(255,255,255,0.18);
    color: #fff;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition);
}
.sgor-menu-btn:hover { background: rgba(255,255,255,0.3); }
.sgor-user-chip {
    font-size: 0.78rem;
    font-weight: 600;
    color: rgba(255,255,255,0.8);
    background: rgba(255,255,255,0.14);
    padding: 4px 10px;
    border-radius: 20px;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
#sgorSidebar { width: var(--sidebar-width); }

#sgorSidebar .offcanvas-header {
    background: var(--sgor-red);
    padding: 1rem 1.25rem;
    min-height: 72px;
    border-bottom: none;
}
#sgorSidebar .offcanvas-header .btn-close { filter: invert(1) brightness(2); opacity: 0.85; }

.sgor-sidebar-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255,255,255,0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #fff;
    font-weight: 700;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.3);
}
.sgor-sidebar-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}
.sgor-sidebar-role {
    font-size: 0.68rem;
    color: rgba(255,255,255,0.6);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

#sgorSidebar .offcanvas-body {
    padding: 0.625rem 0.625rem 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sgor-nav { flex: 1; list-style: none; padding: 0; margin: 0; }

.sgor-nav-section {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-xmuted);
    padding: 1rem 0.625rem 0.3rem;
    pointer-events: none;
}

.sgor-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.875rem;
    transition: background var(--transition), color var(--transition);
    position: relative;
    min-height: 44px;
    text-decoration: none;
}
.sgor-nav .nav-link i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    color: var(--text-xmuted);
    transition: color var(--transition);
}
.sgor-nav .nav-link:hover {
    background: var(--sgor-red-light);
    color: var(--sgor-red);
}
.sgor-nav .nav-link:hover i { color: var(--sgor-red); }
.sgor-nav .nav-link.active {
    background: var(--sgor-red-mid);
    color: var(--sgor-red);
    font-weight: 600;
}
.sgor-nav .nav-link.active i { color: var(--sgor-red); }
.sgor-nav .nav-link.active::before {
    content: '';
    position: absolute;
    left: -0.625rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 55%;
    background: var(--sgor-red);
    border-radius: 0 3px 3px 0;
}

.sgor-sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--border-light);
    margin-top: 0.5rem;
}
.sgor-btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.6rem;
    border-radius: var(--radius-sm);
    border: 1.5px solid #fca5a5;
    background: transparent;
    color: var(--sgor-red);
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition);
    min-height: 44px;
    font-family: inherit;
}
.sgor-btn-logout:hover {
    background: #fef2f2;
    border-color: var(--sgor-red);
    color: var(--sgor-red);
}

/* ── Page wrapper ────────────────────────────────────────────── */
.sgor-page {
    padding: 1.25rem 1rem 3rem;
    max-width: 960px;
    margin: 0 auto;
}
.sgor-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.sgor-page-title {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    margin: 0;
}
.sgor-page-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

/* ── Flash alerts ────────────────────────────────────────────── */
.alert {
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid transparent;
    padding: 0.75rem 1rem;
}
.alert-success { background:#f0fdf4; border-color:#bbf7d0; color:#15803d; }
.alert-danger  { background:#fef2f2; border-color:#fecaca; color:#b91c1c; }
.alert-warning { background:#fffbeb; border-color:#fde68a; color:#92400e; }
.alert-info    { background:#eff6ff; border-color:#bfdbfe; color:#1d4ed8; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
    border-radius: var(--radius) !important;
    border: 1px solid var(--border-light) !important;
    box-shadow: var(--shadow-sm) !important;
    background: var(--surface);
}
.card-header {
    background: var(--surface) !important;
    border-bottom: 1px solid var(--border-light) !important;
    font-weight: 700;
    font-size: 0.875rem;
    padding: 0.875rem 1.125rem !important;
}
.card-footer {
    background: #fafbfd !important;
    border-top: 1px solid var(--border-light) !important;
}

/* ── Stat cards ──────────────────────────────────────────────── */
.sgor-stat-card {
    background: var(--surface);
    border-radius: var(--radius) !important;
    border: 1px solid var(--border-light) !important;
    box-shadow: var(--shadow-sm) !important;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    overflow: hidden;
}
.sgor-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow) !important;
}
.sgor-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
}
.sgor-stat-num {
    font-size: 2.1rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--text);
}
.sgor-stat-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 5px;
}

/* ── Event cards ─────────────────────────────────────────────── */
.sgor-event-card {
    background: var(--surface);
    border-radius: var(--radius) !important;
    border: 1px solid var(--border-light) !important;
    box-shadow: var(--shadow-sm) !important;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.sgor-event-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow) !important;
    color: inherit;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    letter-spacing: -0.01em;
}
.btn-lg { min-height: 50px; font-size: 1rem; border-radius: var(--radius); }
.btn-sm { min-height: 32px; font-size: 0.8rem; padding: 0.25rem 0.75rem; }

.btn-sgor {
    background: var(--sgor-red);
    border-color: var(--sgor-red);
    color: #fff;
    box-shadow: 0 2px 8px rgba(192,57,43,0.32);
}
.btn-sgor:hover, .btn-sgor:focus {
    background: var(--sgor-red-dk);
    border-color: var(--sgor-red-dk);
    color: #fff;
    box-shadow: 0 4px 14px rgba(192,57,43,0.42);
    transform: translateY(-1px);
}
.btn-sgor:active { transform: translateY(0); box-shadow: none; }
.btn-sgor:disabled { background: var(--sgor-red); opacity: 0.5; box-shadow: none; transform: none; }

.btn-xs {
    padding: 0.2rem 0.5rem;
    font-size: 0.74rem;
    border-radius: 6px;
    min-height: 28px;
    font-weight: 600;
}

/* ── Forms ───────────────────────────────────────────────────── */
.form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.35rem;
    display: block;
}
.form-control,
.form-select {
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    font-family: inherit;
    font-size: 1rem;
    color: var(--text);
    background: var(--surface);
    transition: border-color var(--transition), box-shadow var(--transition);
    min-height: 42px;
}
.form-control:focus,
.form-select:focus {
    border-color: var(--sgor-red);
    box-shadow: 0 0 0 3px rgba(192,57,43,0.12);
    outline: none;
    background: var(--surface);
}
.form-control::placeholder { color: var(--text-xmuted); }
textarea.form-control { min-height: unset; }

.input-group-text {
    border: 1.5px solid var(--border);
    background: var(--border-light);
    color: var(--text-muted);
    font-size: 0.9rem;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.input-group > .form-control:not(:first-child),
.input-group > .form-select:not(:first-child) {
    border-left: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; min-height: unset; }

.form-check-input:checked {
    background-color: var(--sgor-red);
    border-color: var(--sgor-red);
}
.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(192,57,43,0.15);
    border-color: var(--sgor-red);
}
.form-text { font-size: 0.775rem; color: var(--text-muted); }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    letter-spacing: 0.01em;
    border-radius: 6px;
    padding: 0.28em 0.6em;
    font-size: 0.72rem;
}

/* ── Tables ──────────────────────────────────────────────────── */
.table { font-size: 0.875rem; }
.table > :not(caption) > * > * { padding: 0.7rem 0.875rem; vertical-align: middle; }
.table thead th {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    background: #f8fafd;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}
.table-hover > tbody > tr:hover > * { background-color: #fafbfd; }

/* ── List groups ─────────────────────────────────────────────── */
.list-group-item {
    border-color: var(--border-light);
    font-size: 0.875rem;
    padding: 0.7rem 1rem;
}
.list-group-item:first-child { border-top: none; }

/* ── Login ───────────────────────────────────────────────────── */
.sgor-login-page {
    background: linear-gradient(150deg, #c0392b 0%, #e74c3c 45%, #8e1b10 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
}
.sgor-login-container {
    width: 100%;
    max-width: 420px;
}
.sgor-login-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 60px rgba(0,0,0,0.28), 0 4px 16px rgba(0,0,0,0.12);
    padding: 2.25rem 2rem 2rem;
    border: none;
}
.sgor-login-logo {
    height: 88px;
    width: auto;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15));
}
.sgor-login-card .form-control { min-height: 50px; font-size: 1rem; }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination { gap: 3px; }
.page-link {
    border-radius: var(--radius-sm) !important;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.page-link:hover { background: var(--sgor-red-light); color: var(--sgor-red); border-color: var(--border); }
.page-item.active .page-link { background: var(--sgor-red); border-color: var(--sgor-red); color: #fff; }

/* ── Score inputs ────────────────────────────────────────────── */
.sgor-score-input { text-align: center; font-weight: 700; font-size: 1rem; }

/* ── Maps ────────────────────────────────────────────────────── */
#locationsMap { min-height: 320px; }

/* ── Toast ───────────────────────────────────────────────────── */
.toast { border-radius: var(--radius); font-size: 0.875rem; font-weight: 500; box-shadow: var(--shadow-lg); }

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 575.98px) {
    .sgor-page { padding: 0.875rem 0.875rem 2.5rem; }
    .sgor-page-title { font-size: 1.2rem; }
    .sgor-stat-num { font-size: 1.75rem; }
    .btn { min-height: 44px; }
    .btn-sm { min-height: 38px; font-size: 0.825rem; }
    .btn-xs { min-height: 30px; }
    .form-control, .form-select { min-height: 46px; }
    .table-responsive-mobile { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ── Misc ────────────────────────────────────────────────────── */
.cursor-pointer { cursor: pointer; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.text-muted { color: var(--text-muted) !important; }
