/* =============================================================
   THEME + LAYOUT
   ============================================================= */

html {
    height: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #12151a;
    color: #e0e0e0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body > .container,
body > #wrapper,
body > .d-flex:not(#wrapper) {
    flex: 1 0 auto;
}

footer {
    margin-top: auto;
    flex-shrink: 0;
}

/* ---------- Navbar ---------- */
.navbar {
    background-color: #0a0c0f !important;
    border-bottom: 1px solid #1e2228;
}

.navbar-dark .navbar-brand,
.navbar-dark .nav-link,
.navbar-light .navbar-brand,
.navbar-light .nav-link,
.navbar-text,
.navbar .navbar-text {
    color: #c8cdd3 !important;
}

.navbar .nav-link:hover { color: #ffffff !important; }
.navbar .nav-link.active { color: #ffffff !important; }

.site-logo {
    height: 32px;
    width: 32px;
    object-fit: contain;
    margin-right: 10px;
    border-radius: 4px;
    background: #16191d;
    padding: 2px;
}

.navbar-brand {
    display: flex !important;
    align-items: center;
    font-weight: 600;
}

/* ---------- Sidebar ---------- */
#sidebar-wrapper {
    background-color: #0d1014 !important;
    border-right: 1px solid #1e2228;
}

.nav-link {
    color: #adb5bd;
    border-radius: 4px;
    padding: 8px 12px;
}

.nav-link:hover {
    color: #ffffff;
    background-color: #1a1e23;
}

.nav-link.active {
    color: #ffffff !important;
    background-color: #252a30;
}

/* ---------- Cards ---------- */
.card {
    background-color: #1c2026;
    border: 1px solid #2a2f36;
    color: #e0e0e0;
    box-shadow: none;
}

.card-header {
    background-color: #16191d;
    border-bottom: 1px solid #2a2f36;
    color: #c8cdd3;
    font-weight: 600;
}

.card.text-white { background-color: #1c2026 !important; }
.card.text-white.bg-primary { border-left: 4px solid #4a5d8a !important; }
.card.text-white.bg-warning { border-left: 4px solid #8a7644 !important; }
.card.text-white.bg-success { border-left: 4px solid #3d7250 !important; }
.card.text-white.bg-primary .card-title { color: #8a9dd6 !important; }
.card.text-white.bg-warning .card-title { color: #d6bd7f !important; }
.card.text-white.bg-success .card-title { color: #7fb28f !important; }
.card.text-white .card-text { color: #8a939e !important; }

/* ---------- Tables ---------- */
.table {
    background-color: transparent;
    color: #e0e0e0;
    --bs-table-bg: transparent;
    --bs-table-color: #e0e0e0;
    --bs-table-border-color: #2a2f36;
}

.table > :not(caption) > * > * {
    background-color: transparent;
    color: #e0e0e0;
    border-color: #2a2f36;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: #16191d;
    color: #e0e0e0;
    box-shadow: none;
}

.table-striped > tbody > tr:nth-of-type(even) > * {
    background-color: #1c2026;
    color: #e0e0e0;
}

.table-hover > tbody > tr:hover > * {
    background-color: #252a30;
    color: #ffffff;
}

.table thead th {
    color: #8a939e !important;
    border-bottom: 2px solid #2a2f36 !important;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

/* ---------- Form fields (EXCLUDING checkboxes/radios!) ---------- */
input:not([type="checkbox"]):not([type="radio"]),
textarea,
select,
.form-control,
.form-select {
    background-color: #16191d !important;
    border: 1px solid #2a2f36 !important;
    color: #e0e0e0 !important;
    border-radius: 4px;
    box-shadow: none !important;
}

input:not([type="checkbox"]):not([type="radio"]):focus,
textarea:focus,
select:focus,
.form-control:focus,
.form-select:focus {
    background-color: #1a1e23 !important;
    border-color: #4a5158 !important;
    color: #ffffff !important;
    box-shadow: 0 0 0 0.15rem rgba(100, 110, 120, 0.25) !important;
}

input:not([type="checkbox"]):not([type="radio"])::placeholder,
textarea::placeholder {
    color: #6c757d !important;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] { -moz-appearance: textfield; }

/* Autofill keeps dark bg */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px #16191d inset !important;
    -webkit-text-fill-color: #e0e0e0 !important;
    caret-color: #e0e0e0;
    transition: background-color 5000s ease-in-out 0s;
}

.form-label { color: #adb5bd; font-size: 0.9rem; }

/* ---------- Toggle switches (form-check-input) ---------- */
.form-check-input {
    width: 42px !important;
    height: 22px !important;
    background-color: #343a40 !important;
    border: 1px solid #4a5158 !important;
    background-image: none !important;
    border-radius: 11px !important;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s;
    box-shadow: none !important;
}

.form-check-input::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: #adb5bd;
    transition: transform 0.2s;
}

.form-check-input:checked {
    background-color: #3a5a8a !important;
    border-color: #3a5a8a !important;
    background-image: none !important;
}

.form-check-input:checked::before {
    transform: translateX(20px);
    background-color: #ffffff;
}

.form-check-input:focus {
    box-shadow: 0 0 0 0.15rem rgba(100, 110, 120, 0.25) !important;
    outline: none;
}

/* ---------- Validation ---------- */
.field-error { color: #d47a7a; font-size: 0.8rem; margin-top: 4px; display: none; }
.field-error.show { display: block; }
.is-invalid { border-color: #8a3a3a !important; }
.is-valid { border-color: #3d7250 !important; }

/* ---------- Buttons ---------- */
.btn { border-radius: 4px; font-weight: 500; padding: 7px 18px; font-size: 0.9rem; }
.btn-primary { background-color: #3a4250; border-color: #3a4250; color: #e0e0e0; }
.btn-primary:hover, .btn-primary:focus { background-color: #4a5363; border-color: #4a5363; color: #ffffff; }
.btn-success { background-color: #2c4a37; border-color: #2c4a37; color: #d4edda; }
.btn-success:hover, .btn-success:focus { background-color: #375c44; border-color: #375c44; color: #ffffff; }
.btn-danger { background-color: #4a2c2c; border-color: #4a2c2c; color: #f5c6cb; }
.btn-danger:hover, .btn-danger:focus { background-color: #5c3636; border-color: #5c3636; color: #ffffff; }
.btn-warning { background-color: #4a3e2c; border-color: #4a3e2c; color: #fff3cd; }
.btn-warning:hover { background-color: #5c4e38; border-color: #5c4e38; color: #ffffff; }
.btn-info { background-color: #2c4247; border-color: #2c4247; color: #d1ecf1; }
.btn-info:hover { background-color: #375257; border-color: #375257; color: #ffffff; }
.btn-dark { background-color: #16191d; border-color: #2a2f36; color: #e0e0e0; }
.btn-dark:hover { background-color: #252a30; border-color: #3a4047; color: #ffffff; }

.btn-outline-primary { color: #8a9dd6; border-color: #3a4250; }
.btn-outline-primary:hover { background-color: #3a4250; color: #ffffff; border-color: #3a4250; }
.btn-outline-secondary { color: #adb5bd; border-color: #343a40; }
.btn-outline-secondary:hover { background-color: #343a40; color: #ffffff; border-color: #343a40; }
.btn-outline-danger { color: #d47a7a; border-color: #4a2c2c; }
.btn-outline-danger:hover { background-color: #4a2c2c; color: #ffffff; border-color: #4a2c2c; }
.btn-outline-success { color: #8ab898; border-color: #2c4a37; }
.btn-outline-success:hover { background-color: #2c4a37; color: #ffffff; border-color: #2c4a37; }
.btn-outline-info { color: #8ab8c8; border-color: #2c4247; }
.btn-outline-info:hover { background-color: #2c4247; color: #ffffff; border-color: #2c4247; }
.btn-outline-dark { color: #adb5bd; border-color: #343a40; }
.btn-outline-dark:hover { background-color: #343a40; color: #ffffff; }
.btn-outline-light { color: #adb5bd; border-color: #495057; }
.btn-outline-light:hover { background-color: #343a40; color: #ffffff; border-color: #343a40; }

/* ---------- Badges ---------- */
.badge.bg-secondary { background-color: #343a40 !important; color: #c8cdd3 !important; }
.badge.bg-warning { background-color: #4a3e2c !important; color: #fff3cd !important; }
.badge.bg-success { background-color: #2c4a37 !important; color: #d4edda !important; }
.badge.bg-danger { background-color: #4a2c2c !important; color: #f5c6cb !important; }
.badge.bg-primary { background-color: #3a4250 !important; color: #d6dde6 !important; }
.badge.bg-info { background-color: #2c4247 !important; color: #d1ecf1 !important; }

/* ---------- Modals ---------- */
.modal-content { background-color: #1c2026; color: #e0e0e0; border: 1px solid #2a2f36; }
.modal-header { border-bottom: 1px solid #2a2f36; }
.modal-footer { border-top: 1px solid #2a2f36; }
.modal-header .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

/* ---------- Dropdowns ---------- */
.dropdown-menu { background-color: #1c2026; border: 1px solid #2a2f36; color: #e0e0e0; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); }
.dropdown-item { color: #e0e0e0; }
.dropdown-item:hover { background-color: #252a30; color: #ffffff; }
.dropdown-header { color: #8a939e; }
.dropdown-divider { border-color: #2a2f36; }

/* ---------- Progress ---------- */
.progress { background-color: #16191d; }
.progress-bar.bg-success { background-color: #3d7250 !important; }
.progress-bar.bg-danger { background-color: #6b3838 !important; }

/* ---------- Misc ---------- */
.text-muted { color: #8a939e !important; }
a { color: #8a9dd6; text-decoration: none; }
a:hover { color: #a8b8e0; }
.bg-white { background-color: #1c2026 !important; }
.bg-light { background-color: #12151a !important; }
.bg-dark { background-color: #0a0c0f !important; }
.border-bottom { border-color: #2a2f36 !important; }
.border-top { border-color: #2a2f36 !important; }
h1, h2, h3, h4, h5, h6 { color: #e0e0e0; }
hr { border-color: #2a2f36; }

.toast.bg-success { background-color: #2c4a37 !important; color: #ffffff !important; }
.toast.bg-danger { background-color: #4a2c2c !important; color: #ffffff !important; }
.toast.bg-warning { background-color: #4a3e2c !important; color: #ffffff !important; }
.toast.bg-info { background-color: #2c4247 !important; color: #ffffff !important; }

.spinner-overlay { display: flex; justify-content: center; align-items: center; padding: 40px 20px; }
.spinner { width: 36px; height: 36px; border: 3px solid #2a2f36; border-top-color: #6a7a8c; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.podium-card { text-align: center; padding: 20px 10px; border-radius: 6px; background-color: #16191d; border: 1px solid #2a2f36; }
.podium-rank { font-size: 2rem; font-weight: 700; margin-bottom: 8px; }
.podium-rank.rank-1 { color: #d4af37; }
.podium-rank.rank-2 { color: #a8a8a8; }
.podium-rank.rank-3 { color: #b87333; }
.podium-team { font-weight: 600; font-size: 1.05rem; margin-bottom: 4px; color: #e0e0e0; }
.podium-points { color: #8a939e; font-size: 0.9rem; }

.countdown-badge { background-color: #2c4247; color: #d1ecf1; padding: 2px 8px; border-radius: 10px; font-size: 0.75rem; font-weight: 500; margin-left: 6px; display: inline-block; white-space: nowrap; }
.movement-arrow { font-size: 0.9rem; font-weight: 700; margin-right: 6px; display: inline-block; width: 14px; text-align: center; }
.movement-up { color: #7fb28f; }
.movement-down { color: #d47a7a; }
.movement-flat { color: #6c757d; }

/* ---------- Settings rows ---------- */
.settings-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #2a2f36;
}
.settings-toggle-row:last-child { border-bottom: none; }
.settings-toggle-row .settings-label { font-weight: 500; }
.settings-toggle-row .settings-hint { color: #8a939e; font-size: 0.8rem; margin: 0; }

/* ---------- User offcanvas ---------- */
#userSidebar { background-color: #0d1014; color: #e0e0e0; }
#userSidebar .nav-link { color: #adb5bd; padding: 10px 15px; border-radius: 4px; }
#userSidebar .nav-link:hover { background-color: #1a1e23; color: #ffffff; }
#userSidebar .nav-link.active { background-color: #252a30; color: #ffffff; }

.user-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    border: 1px solid #2a2f36;
    background-color: transparent;
    color: #e0e0e0;
    cursor: pointer;
}
.user-menu-btn:hover { background-color: #1a1e23; }

/* =============================================================
   LIGHT MODE (uses !important everywhere for reliability)
   ============================================================= */

body.light-mode {
    background-color: #f4f6f8 !important;
    color: #212529 !important;
}

body.light-mode .navbar,
body.light-mode .navbar.bg-dark,
body.light-mode .navbar.bg-white {
    background-color: #ffffff !important;
    border-bottom: 1px solid #dee2e6 !important;
}

body.light-mode .navbar .navbar-brand,
body.light-mode .navbar .nav-link,
body.light-mode .navbar-text,
body.light-mode .navbar .navbar-text {
    color: #212529 !important;
}

body.light-mode .navbar .nav-link:hover { color: #0d6efd !important; }

body.light-mode #sidebar-wrapper {
    background-color: #ffffff !important;
    border-right: 1px solid #dee2e6 !important;
}

body.light-mode #sidebar-wrapper h5,
body.light-mode #sidebar-wrapper .text-white {
    color: #212529 !important;
}

body.light-mode #sidebar-wrapper .nav-link,
body.light-mode #sidebar-wrapper .nav-link.text-white {
    color: #495057 !important;
}

body.light-mode #sidebar-wrapper .nav-link:hover {
    color: #212529 !important;
    background-color: #f4f6f8 !important;
}

body.light-mode #sidebar-wrapper .nav-link.active {
    color: #0d6efd !important;
    background-color: #e7f1ff !important;
}

body.light-mode .card,
body.light-mode .card.text-white {
    background-color: #ffffff !important;
    border: 1px solid #dee2e6 !important;
    color: #212529 !important;
}

body.light-mode .card-header {
    background-color: #f8f9fa !important;
    border-bottom: 1px solid #dee2e6 !important;
    color: #212529 !important;
}

body.light-mode .card.text-white .card-text { color: #6c757d !important; }

body.light-mode .table {
    color: #212529 !important;
    --bs-table-bg: transparent;
    --bs-table-color: #212529;
    --bs-table-border-color: #dee2e6;
}

body.light-mode .table > :not(caption) > * > * {
    background-color: transparent !important;
    color: #212529 !important;
    border-color: #dee2e6 !important;
}

body.light-mode .table-striped > tbody > tr:nth-of-type(odd) > * { background-color: #f8f9fa !important; }
body.light-mode .table-striped > tbody > tr:nth-of-type(even) > * { background-color: #ffffff !important; }
body.light-mode .table-hover > tbody > tr:hover > * { background-color: #e7f1ff !important; color: #0d6efd !important; }
body.light-mode .table thead th { color: #495057 !important; border-bottom: 2px solid #dee2e6 !important; }

body.light-mode input:not([type="checkbox"]):not([type="radio"]),
body.light-mode textarea,
body.light-mode select,
body.light-mode .form-control,
body.light-mode .form-select {
    background-color: #ffffff !important;
    border: 1px solid #ced4da !important;
    color: #212529 !important;
}

body.light-mode input:not([type="checkbox"]):not([type="radio"]):focus,
body.light-mode textarea:focus,
body.light-mode select:focus,
body.light-mode .form-control:focus,
body.light-mode .form-select:focus {
    border-color: #86b7fe !important;
    box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, 0.25) !important;
}

body.light-mode input:-webkit-autofill,
body.light-mode input:-webkit-autofill:hover,
body.light-mode input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
    -webkit-text-fill-color: #212529 !important;
    caret-color: #212529;
}

body.light-mode .form-check-input {
    background-color: #ced4da !important;
    border: 1px solid #adb5bd !important;
}
body.light-mode .form-check-input:checked {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
}
body.light-mode .form-check-input::before { background-color: #ffffff; }

body.light-mode .form-label { color: #495057 !important; }

body.light-mode .dropdown-menu { background-color: #ffffff !important; border: 1px solid #dee2e6 !important; color: #212529 !important; }
body.light-mode .dropdown-item { color: #212529 !important; }
body.light-mode .dropdown-item:hover { background-color: #f4f6f8 !important; }
body.light-mode .dropdown-header { color: #6c757d !important; }
body.light-mode .dropdown-divider { border-color: #dee2e6 !important; }

body.light-mode .modal-content { background-color: #ffffff !important; color: #212529 !important; border: 1px solid #dee2e6 !important; }
body.light-mode .modal-header,
body.light-mode .modal-footer { border-color: #dee2e6 !important; }
body.light-mode .modal-header .btn-close { filter: none !important; }

body.light-mode .progress { background-color: #e9ecef !important; }
body.light-mode .text-muted { color: #6c757d !important; }

body.light-mode h1,
body.light-mode h2,
body.light-mode h3,
body.light-mode h4,
body.light-mode h5,
body.light-mode h6 { color: #212529 !important; }

body.light-mode hr { border-color: #dee2e6 !important; }
body.light-mode .bg-white { background-color: #ffffff !important; }
body.light-mode .bg-light { background-color: #f4f6f8 !important; }
body.light-mode .border-bottom { border-color: #dee2e6 !important; }
body.light-mode .border-top { border-color: #dee2e6 !important; }

body.light-mode .settings-toggle-row { border-color: #dee2e6 !important; }
body.light-mode .settings-toggle-row .settings-hint { color: #6c757d !important; }

body.light-mode .podium-card { background-color: #f8f9fa !important; border: 1px solid #dee2e6 !important; }
body.light-mode .podium-team { color: #212529 !important; }
body.light-mode .spinner { border-color: #dee2e6; border-top-color: #6c757d; }
body.light-mode .field-error { color: #dc3545; }
body.light-mode footer { background-color: #212529 !important; color: #dee2e6 !important; }

body.light-mode #userSidebar { background-color: #ffffff !important; color: #212529 !important; }
body.light-mode #userSidebar .nav-link { color: #495057 !important; }
body.light-mode #userSidebar .nav-link:hover { background-color: #f4f6f8 !important; color: #212529 !important; }
body.light-mode #userSidebar .nav-link.active { background-color: #e7f1ff !important; color: #0d6efd !important; }
body.light-mode .user-menu-btn { border-color: #dee2e6 !important; color: #212529 !important; }
body.light-mode .user-menu-btn:hover { background-color: #f4f6f8 !important; }

body.light-mode .countdown-badge { background-color: #cfe2ff !important; color: #084298 !important; }

/* =============================================================
   COMPACT MODE
   ============================================================= */

body.compact-mode .table > :not(caption) > * > * { padding: 0.3rem 0.5rem; }
body.compact-mode .card-body { padding: 0.75rem; }
body.compact-mode .card-header { padding: 0.5rem 0.75rem; }
body.compact-mode .form-control,
body.compact-mode .form-select { padding: 0.25rem 0.5rem; font-size: 0.85rem; }
body.compact-mode .btn { padding: 4px 12px; font-size: 0.8rem; }

/* =============================================================
   REDUCE MOTION
   ============================================================= */

body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
}

/* =============================================================
   USERS TABLE + SIDEBAR WIDTH RESPONSIVE
   ============================================================= */

.users-table-wrap { overflow-x: auto; }
.users-table-wrap table { min-width: 720px; }
.users-table-wrap .user-team-select { min-width: 150px; max-width: 220px; }
.users-table-wrap td, .users-table-wrap th { vertical-align: middle; }

@media (max-width: 1200px) and (min-width: 993px) {
    #sidebar-wrapper { width: 220px !important; }
}

@media (max-width: 992px) and (min-width: 769px) {
    #sidebar-wrapper { width: 190px !important; padding: 0.75rem !important; }
    #sidebar-wrapper h5 { font-size: 1rem; }
    #sidebar-wrapper .nav-link { padding: 6px 10px; font-size: 0.85rem; }
}

@media (max-width: 768px) {
    #sidebar-wrapper {
        position: fixed; top: 0; left: 0; bottom: 0; z-index: 1050;
        transform: translateX(-100%); transition: transform 0.3s ease-in-out; overflow-y: auto;
    }
    #sidebar-wrapper.show { transform: translateX(0); }
    #page-content-wrapper { width: 100% !important; }
    .table-responsive { overflow-x: auto; }
}

@media (min-width: 769px) {
    #sidebar-wrapper.hidden { display: none; }
}

@media print {
    body * { visibility: hidden; }
    .printable, .printable * { visibility: visible; }
    .printable { position: absolute; left: 0; top: 0; width: 100%; color: #000 !important; }
    .printable table, .printable th, .printable td { color: #000 !important; background-color: #fff !important; border-color: #000 !important; }
    .navbar, .btn, .no-print, #sidebar-wrapper, .toast-container { display: none !important; }
    body { background-color: #fff; }
    .card { box-shadow: none; border: 1px solid #000; background-color: #fff; }
    .card-header { background-color: #fff; color: #000; }
}
/* =============================================================
   FINAL FIXES
   ============================================================= */

/* --- Number inputs: force dark, kill Chrome's native white background --- */
body:not(.light-mode) input[type="number"],
body:not(.light-mode) input[type="number"]:focus,
body:not(.light-mode) input[type="number"]:hover {
    background-color: #16191d !important;
    background-image: none !important;
    color: #e0e0e0 !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    box-shadow: none !important;
}

body.light-mode input[type="number"] {
    background-color: #ffffff !important;
    color: #212529 !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

/* Kill Chrome's yellow/white autofill background on EVERY input */
body:not(.light-mode) input:-webkit-autofill,
body:not(.light-mode) input:-webkit-autofill:hover,
body:not(.light-mode) input:-webkit-autofill:focus,
body:not(.light-mode) input:-webkit-autofill:active,
body:not(.light-mode) textarea:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px #16191d inset !important;
    box-shadow: 0 0 0 1000px #16191d inset !important;
    -webkit-text-fill-color: #e0e0e0 !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    transition: background-color 5000s ease-in-out 0s !important;
    caret-color: #e0e0e0;
}

/* --- Button colors: dark mode (using CSS variables so Bootstrap can't override) --- */
body:not(.light-mode) .btn-primary {
    --bs-btn-bg: #3a4250;
    --bs-btn-border-color: #3a4250;
    --bs-btn-color: #e0e0e0;
    --bs-btn-hover-bg: #4a5363;
    --bs-btn-hover-border-color: #4a5363;
    --bs-btn-hover-color: #ffffff;
    background-color: #3a4250 !important;
    border-color: #3a4250 !important;
    color: #e0e0e0 !important;
}
body:not(.light-mode) .btn-primary:hover { background-color: #4a5363 !important; color: #ffffff !important; }

body:not(.light-mode) .btn-success {
    background-color: #2c4a37 !important;
    border-color: #2c4a37 !important;
    color: #d4edda !important;
}
body:not(.light-mode) .btn-success:hover { background-color: #375c44 !important; color: #ffffff !important; }

body:not(.light-mode) .btn-danger {
    background-color: #4a2c2c !important;
    border-color: #4a2c2c !important;
    color: #f5c6cb !important;
}

body:not(.light-mode) .btn-warning {
    background-color: #4a3e2c !important;
    border-color: #4a3e2c !important;
    color: #fff3cd !important;
}

/* --- Button colors: light mode (clean, high contrast) --- */
body.light-mode .btn-primary {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
    color: #ffffff !important;
    font-weight: 500;
}
body.light-mode .btn-primary:hover { background-color: #0b5ed7 !important; border-color: #0b5ed7 !important; }

body.light-mode .btn-success {
    background-color: #198754 !important;
    border-color: #198754 !important;
    color: #ffffff !important;
    font-weight: 500;
}
body.light-mode .btn-success:hover { background-color: #157347 !important; border-color: #157347 !important; }

body.light-mode .btn-danger {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    color: #ffffff !important;
    font-weight: 500;
}
body.light-mode .btn-danger:hover { background-color: #bb2d3b !important; border-color: #bb2d3b !important; }

body.light-mode .btn-warning {
    background-color: #ffc107 !important;
    border-color: #ffc107 !important;
    color: #000000 !important;
    font-weight: 600;
}
body.light-mode .btn-warning:hover { background-color: #ffca2c !important; }

body.light-mode .btn-info {
    background-color: #0dcaf0 !important;
    border-color: #0dcaf0 !important;
    color: #000000 !important;
    font-weight: 500;
}

body.light-mode .btn-dark {
    background-color: #212529 !important;
    border-color: #212529 !important;
    color: #ffffff !important;
}

/* --- Navbar buttons: Menu / Matches / Logout --- */
/* Dark mode */
.navbar .btn-outline-secondary {
    color: #e0e0e0 !important;
    border-color: #4a5158 !important;
    background-color: #1a1e23 !important;
    font-weight: 500;
}
.navbar .btn-outline-secondary:hover {
    background-color: #252a30 !important;
    border-color: #5a6068 !important;
    color: #ffffff !important;
}
.navbar .btn-outline-danger {
    color: #f5c6cb !important;
    border-color: #5a3636 !important;
    background-color: #2a1c1c !important;
    font-weight: 500;
}
.navbar .btn-outline-danger:hover {
    background-color: #4a2c2c !important;
    color: #ffffff !important;
}

/* Light mode */
body.light-mode .navbar .btn-outline-secondary {
    color: #212529 !important;
    border-color: #adb5bd !important;
    background-color: #f8f9fa !important;
}
body.light-mode .navbar .btn-outline-secondary:hover {
    background-color: #e9ecef !important;
    border-color: #6c757d !important;
    color: #000000 !important;
}
body.light-mode .navbar .btn-outline-danger {
    color: #dc3545 !important;
    border-color: #dc3545 !important;
    background-color: #ffffff !important;
}
body.light-mode .navbar .btn-outline-danger:hover {
    background-color: #dc3545 !important;
    color: #ffffff !important;
}

/* --- Modal footer buttons: prominent in both modes --- */
.modal-footer .btn {
    padding: 8px 22px;
    font-weight: 600;
    min-width: 110px;
}

body:not(.light-mode) .modal-footer .btn-primary {
    background-color: #3a5a8a !important;
    border-color: #3a5a8a !important;
    color: #ffffff !important;
}
body:not(.light-mode) .modal-footer .btn-primary:hover {
    background-color: #4a6a9a !important;
    border-color: #4a6a9a !important;
}

body.light-mode .modal-footer .btn-primary {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
    color: #ffffff !important;
}

.modal-footer .btn-secondary {
    background-color: #495057 !important;
    border-color: #495057 !important;
    color: #ffffff !important;
}
.modal-footer .btn-secondary:hover {
    background-color: #5a6169 !important;
    border-color: #5a6169 !important;
}

/* --- Outline primary/secondary buttons (Save / Edit in tables) --- */
body.light-mode .btn-outline-primary {
    color: #0d6efd !important;
    border-color: #0d6efd !important;
    background-color: #ffffff !important;
}
body.light-mode .btn-outline-primary:hover {
    background-color: #0d6efd !important;
    color: #ffffff !important;
}

body.light-mode .btn-outline-danger {
    color: #dc3545 !important;
    border-color: #dc3545 !important;
    background-color: #ffffff !important;
}
body.light-mode .btn-outline-danger:hover {
    background-color: #dc3545 !important;
    color: #ffffff !important;
}

body.light-mode .btn-outline-success {
    color: #198754 !important;
    border-color: #198754 !important;
    background-color: #ffffff !important;
}
body.light-mode .btn-outline-success:hover {
    background-color: #198754 !important;
    color: #ffffff !important;
}

/* --- Compact switch: make the whole thing clickable and colorful --- */
.form-check-input:checked {
    background-color: #4a7fc1 !important;
    border-color: #4a7fc1 !important;
}

body.light-mode .form-check-input:checked {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
}

/* =============================================================
   NAVBAR: force horizontal layout at every window size
   ============================================================= */

.navbar .navbar-nav {
    flex-direction: row !important;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

/* Navbar link base style */
.navbar .nav-link {
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: 500;
    transition: background-color 0.15s, color 0.15s;
}

/* Dark mode: navbar links */
body:not(.light-mode) .navbar .nav-link {
    color: #c8cdd3 !important;
    background-color: transparent;
}
body:not(.light-mode) .navbar .nav-link:hover {
    color: #ffffff !important;
    background-color: #1a1e23;
}
body:not(.light-mode) .navbar .nav-link.active {
    color: #ffffff !important;
    background-color: #2a3038;
}

/* Light mode: navbar is white, links are dark */
body.light-mode .navbar,
body.light-mode .navbar.bg-dark {
    background-color: #ffffff !important;
    border-bottom: 1px solid #dee2e6 !important;
}
body.light-mode .navbar .navbar-brand {
    color: #212529 !important;
}
body.light-mode .navbar .nav-link {
    color: #495057 !important;
    background-color: transparent;
}
body.light-mode .navbar .nav-link:hover {
    color: #0d6efd !important;
    background-color: #f4f6f8;
}
body.light-mode .navbar .nav-link.active {
    color: #0d6efd !important;
    background-color: #e7f1ff;
}
body.light-mode .navbar .btn-outline-light {
    color: #212529 !important;
    border-color: #adb5bd !important;
    background-color: #f8f9fa !important;
}
body.light-mode .navbar .btn-outline-light:hover {
    background-color: #e9ecef !important;
    border-color: #6c757d !important;
    color: #000 !important;
}

/* Navbar in dark mode: brand is light, button is light */
body:not(.light-mode) .navbar .navbar-brand {
    color: #ffffff !important;
}
body:not(.light-mode) .navbar .btn-outline-light {
    color: #f5c6cb !important;
    border-color: #6a4040 !important;
    background-color: transparent;
}
body:not(.light-mode) .navbar .btn-outline-light:hover {
    background-color: #4a2c2c !important;
    color: #ffffff !important;
    border-color: #4a2c2c !important;
}

/* Mobile: shrink navbar a bit */
@media (max-width: 768px) {
    .navbar .navbar-nav {
        gap: 4px;
    }
    .navbar .nav-link {
        padding: 5px 8px;
        font-size: 0.85rem;
    }
    .navbar .navbar-brand {
        font-size: 1rem;
    }
}

/* =============================================================
   NAVBAR BUTTONS: Menu / Matches / Logout pills
   ============================================================= */

/* Admin + user: Menu and Matches buttons */
body:not(.light-mode) .navbar .btn-outline-secondary {
    color: #e0e0e0 !important;
    border-color: #4a5158 !important;
    background-color: #1a1e23 !important;
    font-weight: 500;
}
body:not(.light-mode) .navbar .btn-outline-secondary:hover {
    background-color: #252a30 !important;
    border-color: #5a6068 !important;
    color: #ffffff !important;
}

body.light-mode .navbar .btn-outline-secondary {
    color: #212529 !important;
    border-color: #adb5bd !important;
    background-color: #f8f9fa !important;
}
body.light-mode .navbar .btn-outline-secondary:hover {
    background-color: #e9ecef !important;
    border-color: #6c757d !important;
    color: #000000 !important;
}

body:not(.light-mode) .navbar .btn-outline-danger {
    color: #f5c6cb !important;
    border-color: #5a3636 !important;
    background-color: #2a1c1c !important;
}
body:not(.light-mode) .navbar .btn-outline-danger:hover {
    background-color: #4a2c2c !important;
    color: #ffffff !important;
}

body.light-mode .navbar .btn-outline-danger {
    color: #dc3545 !important;
    border-color: #dc3545 !important;
    background-color: #ffffff !important;
}
body.light-mode .navbar .btn-outline-danger:hover {
    background-color: #dc3545 !important;
    color: #ffffff !important;
}

/* =============================================================
   OTHER WINDOW-WIDTH FIXES
   ============================================================= */

/* Make sure the "Home" link stays visible in both themes */
.navbar .nav-link.active {
    opacity: 1 !important;
    font-weight: 600;
}

/* User menu button (hamburger) */
body.light-mode .user-menu-btn {
    border-color: #dee2e6 !important;
    color: #212529 !important;
}
body.light-mode .user-menu-btn:hover {
    background-color: #f4f6f8 !important;
}

/* =============================================================
   FOOTER: proper colors in light mode
   ============================================================= */

/* Override the earlier rule that made the footer dark in light mode */
body.light-mode footer,
body.light-mode footer.bg-dark {
    background-color: #212529 !important;
    color: #dee2e6 !important;
    border-top: 3px solid #0d6efd !important;
}

body.light-mode footer a,
body.light-mode footer .text-light {
    color: #e9ecef !important;
}

body.light-mode footer a:hover {
    color: #ffffff !important;
    text-decoration: underline;
}

/* Dark mode: existing footer look is fine, but add a subtle top accent */
body:not(.light-mode) footer {
    background-color: #0a0c0f !important;
    color: #adb5bd !important;
    border-top: 3px solid #3a5a8a !important;
}

body:not(.light-mode) footer a,
body:not(.light-mode) footer .text-light {
    color: #adb5bd !important;
}

body:not(.light-mode) footer a:hover {
    color: #ffffff !important;
}

/* =============================================================
   PUBLIC LANDING PAGE
   ============================================================= */

/* Hero */
.hero-section {
    background: linear-gradient(135deg, #0a0c0f 0%, #1c2026 60%, #2a2410 100%);
    color: #ffffff;
    padding: 60px 30px;
    text-align: center;
    border-radius: 10px;
    margin-bottom: 40px;
    border: 1px solid #3a2f10;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, #d4af37, transparent);
}

.hero-badge {
    display: inline-block;
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #d4af37;
    border: 1px solid #d4af37;
    padding: 4px 14px;
    border-radius: 20px;
    margin-bottom: 20px;
    font-weight: 600;
}

.hero-title {
    font-size: 2.75rem;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.15;
    color: #ffffff;
}

.hero-title .hero-gold {
    color: #d4af37;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: #c8cdd3;
    max-width: 620px;
    margin: 0 auto 30px auto;
    line-height: 1.6;
}

.hero-cta {
    display: inline-flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.hero-cta .btn {
    padding: 12px 28px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 6px;
}

.hero-gold-btn {
    background-color: #d4af37 !important;
    border-color: #d4af37 !important;
    color: #0a0c0f !important;
}

.hero-gold-btn:hover {
    background-color: #e8c455 !important;
    border-color: #e8c455 !important;
    color: #0a0c0f !important;
}

.hero-ghost-btn {
    background-color: transparent !important;
    border: 1px solid #4a5158 !important;
    color: #e0e0e0 !important;
}

.hero-ghost-btn:hover {
    background-color: #252a30 !important;
    color: #ffffff !important;
    border-color: #6a7178 !important;
}

/* Info cards row (fee, prize, teams, match time) */
.info-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.info-card {
    background-color: #1c2026;
    border: 1px solid #2a2f36;
    border-radius: 8px;
    padding: 22px 18px;
    text-align: center;
    position: relative;
}

body.light-mode .info-card {
    background-color: #ffffff;
    border-color: #dee2e6;
}

.info-icon {
    font-size: 1.6rem;
    color: #d4af37;
    margin-bottom: 10px;
    display: block;
    line-height: 1;
}

.info-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #8a939e;
    margin-bottom: 8px;
    display: block;
}

body.light-mode .info-label {
    color: #6c757d;
}

.info-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #e0e0e0;
    margin: 0;
}

body.light-mode .info-value {
    color: #212529;
}

.info-value small {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
    color: #8a939e;
    margin-top: 4px;
}

body.light-mode .info-value small {
    color: #6c757d;
}

/* Section headings */
.section-heading {
    text-align: center;
    margin-bottom: 30px;
}

.section-heading h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.section-heading p {
    color: #8a939e;
    margin: 0;
}

body.light-mode .section-heading p {
    color: #6c757d;
}

/* How it works steps */
.steps-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.step-card {
    background-color: #1c2026;
    border: 1px solid #2a2f36;
    border-radius: 8px;
    padding: 28px 22px;
    text-align: center;
    position: relative;
    height: 100%;
}

body.light-mode .step-card {
    background-color: #ffffff;
    border-color: #dee2e6;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: #d4af37;
    color: #0a0c0f;
    font-weight: 700;
    font-size: 1.15rem;
    margin-bottom: 16px;
}

.step-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #e0e0e0;
}

body.light-mode .step-title {
    color: #212529;
}

.step-desc {
    font-size: 0.9rem;
    color: #8a939e;
    margin: 0;
    line-height: 1.5;
}

body.light-mode .step-desc {
    color: #6c757d;
}

/* Contact strip in footer */
.footer-contact {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.footer-contact a {
    color: #adb5bd;
    text-decoration: none;
}

.footer-contact a:hover {
    color: #d4af37;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    .hero-subtitle {
        font-size: 1rem;
    }
    .hero-section {
        padding: 40px 20px;
    }
    .info-value {
        font-size: 1.25rem;
    }
}

/* =============================================================
   SVG INFO ICONS
   ============================================================= */

.info-icon-svg {
    display: block;
    margin: 0 auto 12px auto;
    color: #d4af37;
}

body.light-mode .info-icon-svg {
    color: #b8912c;
}

/* Remove the old emoji rule if it exists */
.info-icon {
    display: none;
}

/* =============================================================
   TOURNAMENT CARD STATUS
   ============================================================= */

.status-banner {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.status-banner.status-open {
    background-color: #2c4a37;
    color: #7fb28f;
}

.status-banner.status-soon {
    background-color: #4a3e2c;
    color: #d6bd7f;
}

.status-banner.status-closed {
    background-color: #4a2c2c;
    color: #d47a7a;
}

.status-banner.status-active {
    background-color: #2c4247;
    color: #8ab8c8;
}

body.light-mode .status-banner.status-open {
    background-color: #d4edda;
    color: #155724;
}

body.light-mode .status-banner.status-soon {
    background-color: #fff3cd;
    color: #856404;
}

body.light-mode .status-banner.status-closed {
    background-color: #f8d7da;
    color: #721c24;
}

body.light-mode .status-banner.status-active {
    background-color: #cce5ff;
    color: #004085;
}

.countdown-line {
    font-size: 0.85rem;
    color: #8a939e;
    margin-bottom: 10px;
}

body.light-mode .countdown-line {
    color: #6c757d;
}

/* =============================================================
   SHOP INFO CARD  (physical payment location)
   ============================================================= */

.shop-card {
    background: #1a1d22;
    border: 1px solid #2c3138;
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

body.light-mode .shop-card {
    background: #ffffff;
    border-color: #e2e6ec;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.shop-banner {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.9rem;
}

.shop-banner strong {
    font-size: 0.95rem;
}

.shop-banner-alert {
    background: #4a2c2c;
    color: #f2c6c6;
    border-bottom: 1px solid #5c3333;
}

body.light-mode .shop-banner-alert {
    background: #fff3cd;
    color: #856404;
    border-bottom-color: #ffeaa7;
}

.shop-banner-ok {
    background: #2c4a37;
    color: #b9e2c5;
    border-bottom: 1px solid #33553f;
}

body.light-mode .shop-banner-ok {
    background: #d4edda;
    color: #155724;
    border-bottom-color: #c3e6cb;
}

.shop-banner-neutral {
    background: #2f333a;
    color: #b7bcc4;
    border-bottom: 1px solid #3a3f47;
}

body.light-mode .shop-banner-neutral {
    background: #e9ecef;
    color: #495057;
    border-bottom-color: #dee2e6;
}

.shop-header {
    padding: 18px 20px 8px;
}

.shop-badge {
    display: inline-block;
    padding: 6px 14px;
    background: #d4b155;
    color: #16191d;
    font-weight: 700;
    font-size: 0.95rem;
    border-radius: 6px;
    letter-spacing: 0.3px;
}

.shop-tagline {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #8a939e;
    text-transform: lowercase;
}

body.light-mode .shop-tagline {
    color: #6c757d;
}

.shop-body {
    padding: 12px 20px 20px;
}

.shop-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 10px 0;
    color: #d4d8de;
    font-size: 0.9rem;
    line-height: 1.45;
}

body.light-mode .shop-row {
    color: #2c3138;
}

.shop-row svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: #d4b155;
}

.shop-row-hours {
    align-items: flex-start;
}

.shop-hours-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #8a939e;
    margin-bottom: 4px;
}

body.light-mode .shop-hours-title {
    color: #6c757d;
}

.shop-hours-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.shop-hours-list li {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 2px 0;
    font-size: 0.9rem;
}

.shop-hours-days {
    color: #8a939e;
}

body.light-mode .shop-hours-days {
    color: #6c757d;
}

.shop-row-contact {
    border-top: 1px solid #2c3138;
    margin-top: 8px;
    padding-top: 14px;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

body.light-mode .shop-row-contact {
    border-top-color: #e2e6ec;
}

.shop-contact-link {
    color: #d4b155;
    text-decoration: none;
    font-weight: 500;
}

.shop-contact-link:hover {
    text-decoration: underline;
}

.shop-contact-sep {
    color: #4a5158;
}

/* =============================================================
   MOBILE POLISH  (below 768px)
   ============================================================= */

@media (max-width: 767.98px) {

    /* --- General spacing --- */
    .container {
        padding-left: 14px;
        padding-right: 14px;
    }

    .card-body {
        padding: 16px;
    }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.1rem; }
    h4 { font-size: 1rem; }
    h5 { font-size: 0.95rem; }

    /* --- Navbar --- */
    .navbar-brand {
        font-size: 1rem;
    }
    .navbar-nav .nav-link {
        padding: 8px 10px;
        font-size: 0.95rem;
    }

    /* --- Hero --- */
    .hero-section {
        padding: 40px 20px;
    }
    .hero-title {
        font-size: 1.9rem;
        line-height: 1.2;
    }
    .hero-subtitle {
        font-size: 0.95rem;
    }
    .hero-cta {
        flex-direction: column;
        gap: 10px;
    }
    .hero-cta .btn {
        width: 100%;
    }

    /* --- Info cards stack --- */
    .info-row {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    .info-value {
        font-size: 1.1rem;
    }

    /* --- Steps stack --- */
    .steps-row {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    /* --- Tournament cards full width --- */
    #tournamentList .col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* --- All tables become horizontally scrollable --- */
    .table-responsive,
    .card-body > table,
    .card > .card-body > table,
    #teamsCard .table,
    #resultsCard .table,
    #standingsCard .table,
    .printable .table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    .table thead th,
    .table tbody td {
        font-size: 0.85rem;
        padding: 8px 10px;
    }

    /* Hide the more obscure columns on tiny screens */
    .table thead th.col-hide-xs,
    .table tbody td.col-hide-xs {
        display: none;
    }

    /* --- Bigger touch targets on buttons --- */
    .btn-sm {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    .btn {
        padding: 10px 16px;
    }

    /* --- Form controls easier to tap --- */
    .form-control,
    .form-select {
        font-size: 16px; /* prevents iOS zoom on focus */
        padding: 10px 12px;
        min-height: 44px;
    }

    /* --- Shop card tighter on mobile --- */
    .shop-header {
        padding: 14px 16px 6px;
    }
    .shop-body {
        padding: 10px 16px 16px;
    }
    .shop-hours-list li {
        font-size: 0.85rem;
    }

    /* --- Modals full width --- */
    .modal-dialog {
        margin: 8px;
    }

    /* --- Spacing on stacked dashboard stats --- */
    .row.g-3 > [class*="col-"] {
        margin-bottom: 0;
    }
}

@media (max-width: 400px) {
    .info-row {
        grid-template-columns: 1fr;
    }
    .hero-title {
        font-size: 1.6rem;
    }
}
/* =============================================================
   PUBLIC SHOP PHOTO  —  framed, captioned, refined
   ============================================================= */

.shop-public-figure {
    max-width: 420px;
    width: 100%;
    margin: 0 0 28px 0;
}

.shop-public-photo {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    /* Subtle gold border — brands the frame without shouting */
    border: 1px solid rgba(212, 177, 85, 0.28);
    /* Layered shadow for depth */
    box-shadow:
        0 14px 36px rgba(0, 0, 0, 0.42),
        0 3px 8px rgba(0, 0, 0, 0.28);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.shop-public-photo:hover {
    transform: translateY(-3px);
    border-color: rgba(212, 177, 85, 0.5);
    box-shadow:
        0 20px 44px rgba(0, 0, 0, 0.5),
        0 4px 10px rgba(0, 0, 0, 0.35);
}

.shop-public-photo img {
    width: 100%;
    height: auto;      /* natural aspect, no crop */
    display: block;
}

/* Caption strip below the photo — magazine-style */
.shop-public-caption {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    font-size: 0.85rem;
    color: #8a939e;
    letter-spacing: 0.2px;
}

body.light-mode .shop-public-caption {
    color: #6c757d;
}

.shop-public-caption-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #d4b155;
    flex-shrink: 0;
    box-shadow: 0 0 8px rgba(212, 177, 85, 0.6);
}

/* Gold accent line above the greeting */
.shop-public-accent {
    width: 40px;
    height: 3px;
    background: #d4b155;
    border-radius: 2px;
    margin-bottom: 14px;
}

@media (max-width: 480px) {
    .shop-public-figure {
        max-width: 100%;
    }
    .shop-public-photo:hover {
        transform: none;   /* skip the lift on touch devices */
    }
}

/* ---- Hero text ---- */

.shop-public-hero {
    margin-bottom: 20px;
}

.shop-public-greeting {
    font-size: 1.2rem;
    font-weight: 700;
    color: #d4b155;
    margin-bottom: 8px;
    letter-spacing: 0.2px;
}

body.light-mode .shop-public-greeting {
    color: #a37b1b;
}

.shop-public-intro {
    color: #b7bcc4;
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0;
}

body.light-mode .shop-public-intro {
    color: #495057;
}

/* ---- Details block ---- */

.shop-public-details .shop-row {
    border-bottom: 1px solid #2c3138;
}

body.light-mode .shop-public-details .shop-row {
    border-bottom-color: #e2e6ec;
}

.shop-public-details .shop-row:last-of-type {
    border-bottom: none;
}

/* ---- Stack on mobile / tablet ---- */

@media (max-width: 768px) {
    .shop-public {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .shop-public-photo {
        max-width: 320px;
    }
}

/* ---- Hero text ---- */

.shop-public-hero {
    margin-bottom: 22px;
}

.shop-public-greeting {
    font-size: 1.35rem;
    font-weight: 700;
    color: #d4b155;
    margin-bottom: 10px;
    letter-spacing: 0.2px;
}

body.light-mode .shop-public-greeting {
    color: #a37b1b;
}

.shop-public-intro {
    color: #b7bcc4;
    font-size: 0.98rem;
    line-height: 1.6;
    margin: 0;
    max-width: 640px;
}

body.light-mode .shop-public-intro {
    color: #495057;
}

/* ---- Details block (reuses .shop-row from the dashboard card) ---- */

.shop-public-details {
    /* No border/background — just plain rows */
}

.shop-public-details .shop-row {
    border-bottom: 1px solid #2c3138;
}

body.light-mode .shop-public-details .shop-row {
    border-bottom-color: #e2e6ec;
}

.shop-public-details .shop-row:last-of-type {
    border-bottom: none;
}

/* ---- Directions button (shared by both cards) ---- */

.shop-directions-btn {
    display: inline-block;
    margin-top: 14px;
    padding: 10px 18px;
    background: #d4b155;
    color: #16191d;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 8px;
    text-decoration: none;
    transition: transform 0.1s ease, background 0.15s ease;
}

.shop-directions-btn:hover {
    background: #e0bd64;
    color: #16191d;
    text-decoration: none;
    transform: translateY(-1px);
}

body.light-mode .shop-directions-btn {
    background: #a37b1b;
    color: #ffffff;
}

body.light-mode .shop-directions-btn:hover {
    background: #8b6915;
    color: #ffffff;
}

.shop-contact-link svg {
    vertical-align: -3px;
    margin-right: 4px;
}

/* ---- Mobile ---- */

@media (max-width: 480px) {
    .shop-public-greeting {
        font-size: 1.15rem;
    }
    .shop-public-intro {
        font-size: 0.9rem;
    }
    .shop-public-photo-overlay {
        left: 10px;
        bottom: 10px;
        padding: 8px 12px;
    }
    .shop-public-photo-name {
        font-size: 0.95rem;
    }
    .shop-public-photo-tagline {
        font-size: 0.7rem;
    }
}

/* =============================================================
   TEAM MANAGER DASHBOARD
   ============================================================= */

.tm-container {
    max-width: 1160px;
}

/* --- Page header --- */
.tm-page-header {
    margin-bottom: 24px;
}
.tm-page-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    margin: 0 0 6px 0;
    color: #e7e9ec;
}
body.light-mode .tm-page-title { color: #16191d; }

.tm-page-subtitle {
    color: #8a939e;
    font-size: 0.95rem;
    margin: 0;
}
body.light-mode .tm-page-subtitle { color: #6c757d; }

/* --- TEAM HERO --- */
.tm-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 24px;
    background: linear-gradient(135deg, #1c2026 0%, #171a1f 100%);
    border: 1px solid #262b32;
    border-radius: 14px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
body.light-mode .tm-hero {
    background: linear-gradient(135deg, #ffffff 0%, #f4f5f7 100%);
    border-color: #e2e6ec;
}

.tm-hero-left {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
    flex: 1;
}

.tm-hero-logo {
    width: 88px;
    height: 88px;
    object-fit: cover;      /* fills the whole box, edge to edge */
    border-radius: 12px;
    background: #101317;
    flex-shrink: 0;         /* no padding — logo touches the border */
    border: 2px solid #262b32;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

body.light-mode .tm-hero-logo {
    background: #f4f5f7;
    border-color: #e2e6ec;
}
body.light-mode .tm-hero-logo {
    background: #f4f5f7;
    border-color: #e2e6ec;
}

.tm-hero-identity { min-width: 0; }

.tm-hero-eyebrow {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #d4b155;
    font-weight: 600;
    margin-bottom: 4px;
}

.tm-hero-name {
    font-size: 1.55rem;
    font-weight: 700;
    margin: 0 0 6px 0;
    color: #e7e9ec;
    letter-spacing: -0.2px;
    line-height: 1.15;
    word-break: break-word;
}
body.light-mode .tm-hero-name { color: #16191d; }

.tm-hero-meta {
    margin: 0;
    font-size: 0.88rem;
    color: #8a939e;
    word-break: break-word;
}
body.light-mode .tm-hero-meta { color: #6c757d; }

.tm-hero-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.tm-switcher {
    max-width: 220px;
    min-width: 160px;
}

/* --- Gold button (accent) --- */
.btn-gold {
    background: #d4b155;
    color: #16191d;
    border: 1px solid #d4b155;
    font-weight: 600;
    border-radius: 8px;
    padding: 8px 16px;
    transition: background 0.15s ease, transform 0.1s ease;
}
.btn-gold:hover {
    background: #e0bd64;
    border-color: #e0bd64;
    color: #16191d;
    transform: translateY(-1px);
}
body.light-mode .btn-gold {
    background: #a37b1b;
    border-color: #a37b1b;
    color: #ffffff;
}
body.light-mode .btn-gold:hover {
    background: #8b6915;
    border-color: #8b6915;
    color: #ffffff;
}

/* --- STAT TILES --- */
.tm-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.tm-stat {
    display: flex;
    gap: 12px;
    padding: 16px 18px;
    background: #1a1d22;
    border: 1px solid #262b32;
    border-radius: 12px;
    transition: border-color 0.15s ease;
    min-width: 0;
}
.tm-stat:hover { border-color: #333942; }
body.light-mode .tm-stat {
    background: #ffffff;
    border-color: #e2e6ec;
}

.tm-stat-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(212, 177, 85, 0.12);
    color: #d4b155;
    border-radius: 9px;
}
body.light-mode .tm-stat-icon {
    background: rgba(163, 123, 27, 0.12);
    color: #a37b1b;
}

.tm-stat-content {
    min-width: 0;
    flex: 1;
}

.tm-stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #8a939e;
    font-weight: 600;
    margin-bottom: 4px;
}
body.light-mode .tm-stat-label { color: #6c757d; }

.tm-stat-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: #e7e9ec;
    line-height: 1.25;
    word-break: break-word;
}
body.light-mode .tm-stat-value { color: #16191d; }

.tm-stat-value small {
    font-size: 0.75rem;
    font-weight: 500;
    color: #8a939e;
}

.tm-stat-value-sm {
    font-size: 0.85rem;
    font-weight: 600;
    color: #b7bcc4;
    line-height: 1.4;
}
body.light-mode .tm-stat-value-sm { color: #495057; }

.tm-stat-sub {
    font-size: 0.78rem;
    color: #8a939e;
    margin-top: 2px;
}
body.light-mode .tm-stat-sub { color: #6c757d; }

/* --- CARDS --- */
.tm-card {
    background: #1a1d22;
    border: 1px solid #262b32;
    border-radius: 12px;
    overflow: hidden;
}
body.light-mode .tm-card {
    background: #ffffff;
    border-color: #e2e6ec;
}

.tm-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.015);
    border-bottom: 1px solid #262b32;
    font-weight: 600;
    font-size: 0.95rem;
    color: #e7e9ec;
    letter-spacing: 0.2px;
}
body.light-mode .tm-card-header {
    background: #f8f9fb;
    border-bottom-color: #e2e6ec;
    color: #16191d;
}

.tm-card-hint {
    font-size: 0.78rem;
    font-weight: 400;
    color: #8a939e;
}

.tm-card-body {
    padding: 18px;
}
.tm-card-body-flush {
    padding: 0;
}

/* --- Key/value pairs (payment card) --- */
.tm-kv {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid #262b32;
}
.tm-kv:last-child { border-bottom: none; }
body.light-mode .tm-kv { border-bottom-color: #e2e6ec; }

.tm-kv-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #8a939e;
    font-weight: 600;
    flex-shrink: 0;
}
body.light-mode .tm-kv-label { color: #6c757d; }

.tm-kv-value {
    text-align: right;
    color: #e7e9ec;
    font-weight: 600;
    font-size: 0.9rem;
    word-break: break-word;
}
body.light-mode .tm-kv-value { color: #16191d; }

.tm-kv-value-lg {
    font-size: 1.25rem;
    color: #d4b155;
}
body.light-mode .tm-kv-value-lg { color: #a37b1b; }

.tm-kv-value-muted {
    font-weight: 400;
    color: #b7bcc4;
    font-size: 0.85rem;
}

/* --- Help card --- */
.tm-card-help {
    background: linear-gradient(135deg, rgba(212, 177, 85, 0.08), rgba(212, 177, 85, 0.02));
    border-color: rgba(212, 177, 85, 0.25);
}
body.light-mode .tm-card-help {
    background: linear-gradient(135deg, #fff9e8, #fffdf6);
    border-color: rgba(163, 123, 27, 0.25);
}

.tm-help-title {
    font-weight: 700;
    color: #d4b155;
    margin-bottom: 6px;
    font-size: 0.95rem;
}
body.light-mode .tm-help-title { color: #a37b1b; }

.tm-help-text {
    color: #b7bcc4;
    font-size: 0.85rem;
    line-height: 1.55;
    margin: 0;
}
body.light-mode .tm-help-text { color: #495057; }

/* --- Table tuning --- */
.tm-table {
    margin-bottom: 0;
    color: #d4d8de;
}
body.light-mode .tm-table { color: #2c3138; }

.tm-table thead th {
    background: transparent;
    color: #8a939e;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    font-weight: 600;
    border-bottom: 1px solid #262b32;
    padding: 12px 16px;
}
body.light-mode .tm-table thead th {
    color: #6c757d;
    border-bottom-color: #e2e6ec;
}

.tm-table tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid #22262c;
    vertical-align: middle;
    font-size: 0.9rem;
}
body.light-mode .tm-table tbody td { border-bottom-color: #eef0f3; }

.tm-table tbody tr:last-child td { border-bottom: none; }

.tm-table tbody tr:hover td {
    background: rgba(212, 177, 85, 0.03);
}
body.light-mode .tm-table tbody tr:hover td {
    background: #fafbfc;
}

/* --- Form labels --- */
.tm-form-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #8a939e;
    font-weight: 600;
    margin-bottom: 4px;
}
body.light-mode .tm-form-label { color: #6c757d; }

/* --- Mobile --- */
@media (max-width: 991.98px) {
    .tm-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 575.98px) {
    .tm-stats {
        grid-template-columns: 1fr;
    }
    .tm-hero {
        padding: 18px;
        flex-direction: column;
        align-items: flex-start;
    }
    .tm-hero-actions {
        width: 100%;
    }
    .tm-hero-actions .btn-gold,
    .tm-hero-actions .tm-switcher {
        flex: 1;
        max-width: none;
    }
    .tm-hero-name {
        font-size: 1.25rem;
    }
    .tm-hero-logo {
        width: 56px;
        height: 56px;
    }
}

/* =============================================================
   LIGHT MODE — HOME HERO FIX
   ============================================================= */

body.light-mode .hero-section {
    background: linear-gradient(135deg, #ffffff 0%, #f4f5f7 60%, #fbf7ec 100%) !important;
    border: 1px solid #e2e6ec !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.05);
}

body.light-mode .hero-title {
    color: #16191d !important;
}

body.light-mode .hero-gold {
    color: #a37b1b !important;
}

body.light-mode .hero-subtitle {
    color: #495057 !important;
}

body.light-mode .hero-badge {
    background: rgba(212, 177, 85, 0.15) !important;
    border-color: rgba(163, 123, 27, 0.4) !important;
    color: #8b6915 !important;
}

body.light-mode .hero-ghost-btn {
    color: #16191d !important;
    border-color: #c8ccd3 !important;
}
body.light-mode .hero-ghost-btn:hover {
    background: #16191d !important;
    color: #ffffff !important;
    border-color: #16191d !important;
}

body.light-mode .hero-gold-btn {
    background: #a37b1b !important;
    color: #ffffff !important;
    border-color: #a37b1b !important;
}
body.light-mode .hero-gold-btn:hover {
    background: #8b6915 !important;
    border-color: #8b6915 !important;
}

/* =============================================================
   THEMED BANNERS  (replaces Bootstrap's blue/pink alerts)
   ============================================================= */

.tm-banner {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.92rem;
    line-height: 1.5;
    margin-bottom: 16px;
    border-left: 3px solid #d4b155;
    background: #1e2127;
    color: #d4d8de;
}

body.light-mode .tm-banner {
    background: #f4f5f7;
    color: #2c3138;
}

.tm-banner strong {
    color: #e7e9ec;
    font-weight: 600;
}

body.light-mode .tm-banner strong {
    color: #16191d;
}

/* Info — subtle gold accent */
.tm-banner-info {
    border-left-color: #d4b155;
    background: linear-gradient(90deg, rgba(212, 177, 85, 0.08), rgba(212, 177, 85, 0.02));
}

body.light-mode .tm-banner-info {
    background: linear-gradient(90deg, #fbf7ec, #fffdf6);
}

/* Warning — amber, only used for "match soon" */
.tm-banner-warning {
    border-left-color: #d68b3a;
    background: linear-gradient(90deg, rgba(214, 139, 58, 0.1), rgba(214, 139, 58, 0.02));
}

body.light-mode .tm-banner-warning {
    background: linear-gradient(90deg, #fff8ec, #fffdf8);
}

/* Danger — muted red, used only for "registration closed" */
.tm-banner-danger {
    border-left-color: #c25858;
    background: linear-gradient(90deg, rgba(194, 88, 88, 0.1), rgba(194, 88, 88, 0.02));
}

body.light-mode .tm-banner-danger {
    background: linear-gradient(90deg, #fdeeee, #fef9f9);
}

/* Neutral — for informational one-liners */
.tm-banner-neutral {
    border-left-color: #4a5158;
    background: #1c1f24;
    color: #b7bcc4;
}

body.light-mode .tm-banner-neutral {
    background: #f4f5f7;
    color: #495057;
}

/* Mobile */
@media (max-width: 575.98px) {
    .tm-banner {
        font-size: 0.86rem;
        padding: 10px 14px;
    }
}

/* =============================================================
   AUDIT LOG
   ============================================================= */

.audit-details {
    font-size: 0.85rem;
    line-height: 1.5;
    max-width: 420px;
    word-break: break-word;
}

.audit-details > div {
    padding: 1px 0;
}

#auditLogTable td {
    vertical-align: middle;
}

#auditLogTable tbody tr:hover {
    background: rgba(212, 177, 85, 0.04);
}

/* =============================================================
   OTHER TEAMS LIST
   ============================================================= */

.tm-other-team {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid #262b32;
    flex-wrap: wrap;
}
.tm-other-team:last-child { border-bottom: none; padding-bottom: 0; }
.tm-other-team:first-child { padding-top: 0; }

body.light-mode .tm-other-team { border-bottom-color: #e2e6ec; }

.tm-other-team-main { min-width: 0; flex: 1; }

.tm-other-team-name {
    font-weight: 600;
    color: #e7e9ec;
    font-size: 0.98rem;
    margin-bottom: 3px;
}
body.light-mode .tm-other-team-name { color: #16191d; }

.tm-other-team-meta {
    font-size: 0.85rem;
    color: #8a939e;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
body.light-mode .tm-other-team-meta { color: #6c757d; }

.tm-other-team-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

@media (max-width: 575.98px) {
    .tm-other-team { flex-direction: column; align-items: stretch; }
    .tm-other-team-actions { width: 100%; }
    .tm-other-team-actions .btn { flex: 1; }
}

/* =============================================================
   PUBLIC TOURNAMENT DASHBOARD
   ============================================================= */

.tm-tourney-dash {
    border: 1px solid #262b32;
}

body.light-mode .tm-tourney-dash { border-color: #e2e6ec; }

.tm-tourney-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: center;
    padding: 8px 0;
}

@media (max-width: 767.98px) {
    .tm-tourney-hero { grid-template-columns: 1fr; gap: 20px; }
}

.tm-tourney-status-row { margin-bottom: 10px; }

.tm-tourney-status-row .badge {
    font-size: 0.8rem;
    padding: 6px 12px;
    letter-spacing: 0.3px;
}

.tm-tourney-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tm-tourney-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.92rem;
    color: #b7bcc4;
}

body.light-mode .tm-tourney-meta-item { color: #495057; }

.tm-tourney-meta-item svg {
    color: #d4b155;
    flex-shrink: 0;
}

.tm-tourney-progress {
    display: flex;
    flex-direction: column;
}

.tm-tourney-count {
    font-size: 2rem;
    font-weight: 700;
    color: #e7e9ec;
    line-height: 1;
}
body.light-mode .tm-tourney-count { color: #16191d; }

.tm-tourney-count-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #8a939e;
    margin-top: 4px;
    margin-bottom: 14px;
}

.tm-progress {
    height: 10px;
    border-radius: 6px;
    background: #262b32;
}
body.light-mode .tm-progress { background: #eef0f3; }

.tm-tourney-sub {
    margin-top: 10px;
    font-size: 0.85rem;
    color: #8a939e;
}
body.light-mode .tm-tourney-sub { color: #6c757d; }

/* =============================================================
   TOASTS  — natural, muted palette to match the site theme
   ============================================================= */

/* Base look for any toast */
.toast {
    background: #1a1d22;
    border: 1px solid #262b32;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.42);
    color: #d4d8de;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    overflow: hidden;
}

body.light-mode .toast {
    background: #ffffff;
    border-color: #e2e6ec;
    color: #2c3138;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

/* Thin accent stripe on the left of every toast */
.toast::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 3px;
    background: #d4b155;
}

/* =========================================
   SUCCESS — muted olive green
   ========================================= */
.toast.bg-success,
.toast.toast-success,
.toast.text-bg-success {
    background: linear-gradient(90deg, #253a2c 0%, #1f2f25 100%) !important;
    border-color: #2e4636 !important;
    color: #c1ddca !important;
}
.toast.bg-success::before,
.toast.toast-success::before,
.toast.text-bg-success::before {
    background: #7fb28f;
}

body.light-mode .toast.bg-success,
body.light-mode .toast.toast-success,
body.light-mode .toast.text-bg-success {
    background: linear-gradient(90deg, #ecf6ee 0%, #f6fbf7 100%) !important;
    border-color: #c9e2cf !important;
    color: #245a33 !important;
}
body.light-mode .toast.bg-success::before,
body.light-mode .toast.toast-success::before {
    background: #4a8a5c;
}

/* =========================================
   DANGER — muted brick red
   ========================================= */
.toast.bg-danger,
.toast.toast-danger,
.toast.text-bg-danger {
    background: linear-gradient(90deg, #3a2626 0%, #2e1e1e 100%) !important;
    border-color: #4a2f2f !important;
    color: #e3bcbc !important;
}
.toast.bg-danger::before,
.toast.toast-danger::before,
.toast.text-bg-danger::before {
    background: #c25858;
}

body.light-mode .toast.bg-danger,
body.light-mode .toast.toast-danger,
body.light-mode .toast.text-bg-danger {
    background: linear-gradient(90deg, #fbecec 0%, #fdf5f5 100%) !important;
    border-color: #ecc9c9 !important;
    color: #7a2a2a !important;
}
body.light-mode .toast.bg-danger::before,
body.light-mode .toast.toast-danger::before {
    background: #a84343;
}

/* =========================================
   WARNING — warm amber
   ========================================= */
.toast.bg-warning,
.toast.toast-warning,
.toast.text-bg-warning {
    background: linear-gradient(90deg, #3a3024 0%, #2e261c 100%) !important;
    border-color: #4a3e2c !important;
    color: #e0cc9a !important;
}
.toast.bg-warning::before,
.toast.toast-warning::before,
.toast.text-bg-warning::before {
    background: #d6bd7f;
}

body.light-mode .toast.bg-warning,
body.light-mode .toast.toast-warning,
body.light-mode .toast.text-bg-warning {
    background: linear-gradient(90deg, #fbf6ea 0%, #fdfbf4 100%) !important;
    border-color: #ecdcb4 !important;
    color: #6b531a !important;
}
body.light-mode .toast.bg-warning::before,
body.light-mode .toast.toast-warning::before {
    background: #a37b1b;
}

/* =========================================
   INFO — gold accent
   ========================================= */
.toast.bg-info,
.toast.toast-info,
.toast.text-bg-info {
    background: linear-gradient(90deg, #2e2a1e 0%, #262218 100%) !important;
    border-color: #443c28 !important;
    color: #ded1a4 !important;
}
.toast.bg-info::before,
.toast.toast-info::before,
.toast.text-bg-info::before {
    background: #d4b155;
}

body.light-mode .toast.bg-info,
body.light-mode .toast.toast-info,
body.light-mode .toast.text-bg-info {
    background: linear-gradient(90deg, #fbf7ec 0%, #fdfcf6 100%) !important;
    border-color: #e8dbb7 !important;
    color: #6b531a !important;
}
body.light-mode .toast.bg-info::before,
body.light-mode .toast.toast-info::before {
    background: #a37b1b;
}

/* =========================================
   INNER ELEMENTS (if toast.js uses header + body)
   ========================================= */

.toast-header {
    background: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    color: inherit !important;
    font-weight: 600;
    padding: 10px 14px;
}

body.light-mode .toast-header {
    border-bottom-color: rgba(0, 0, 0, 0.06) !important;
}

.toast-body {
    padding: 12px 14px;
    font-size: 0.92rem;
    line-height: 1.5;
}

/* Close button — visible on dark themes */
.toast .btn-close {
    filter: invert(1) brightness(0.7);
    opacity: 0.6;
}
.toast .btn-close:hover {
    opacity: 1;
}

body.light-mode .toast .btn-close {
    filter: none;
    opacity: 0.5;
}
body.light-mode .toast .btn-close:hover {
    opacity: 0.9;
}

/* Softer entrance / exit */
.toast.fade {
    transition: opacity 0.22s ease, transform 0.22s ease;
}
.toast.fade:not(.show) {
    transform: translateX(8px);
    opacity: 0;
}

/* =============================================================
   TOURNAMENT CARD TROPHY
   ============================================================= */

.tourney-card {
    position: relative;
    overflow: hidden;
}

.tourney-trophy {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    color: #d4b155;
    opacity: 0.35;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.tourney-card:hover .tourney-trophy {
    opacity: 0.65;
    transform: scale(1.08);
}

body.light-mode .tourney-trophy {
    color: #a37b1b;
    opacity: 0.4;
}

body.light-mode .tourney-card:hover .tourney-trophy {
    opacity: 0.7;
}

/* Slightly less padding on the right of the card title row so it
   doesn't collide with the trophy on narrow cards */
.tourney-card .card-title {
    padding-right: 44px;
}

/* =============================================================
   FORM VALIDATION — mature style
   Replaces Bootstrap's cartoonish green checkmark / red X
   ============================================================= */

/* Remove Bootstrap's default tick/X icons on inputs */
.form-control.is-valid,
.form-control.is-invalid,
.was-validated .form-control:valid,
.was-validated .form-control:invalid,
.form-select.is-valid,
.form-select.is-invalid {
    background-image: none !important;
    padding-right: 0.75rem;
}

/* --- VALID STATE: subtle green left accent + soft glow --- */
.form-control.is-valid,
.form-select.is-valid {
    border-color: #3d6b4e !important;
    background-color: rgba(61, 107, 78, 0.04);
    box-shadow: inset 3px 0 0 #4a8a5c;
}

.form-control.is-valid:focus,
.form-select.is-valid:focus {
    border-color: #4a8a5c !important;
    box-shadow: inset 3px 0 0 #4a8a5c, 0 0 0 0.2rem rgba(74, 138, 92, 0.15);
}

body.light-mode .form-control.is-valid,
body.light-mode .form-select.is-valid {
    border-color: #a8d0b5 !important;
    background-color: #f6fbf7;
    box-shadow: inset 3px 0 0 #4a8a5c;
}

/* --- INVALID STATE: subtle red left accent --- */
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #7a3232 !important;
    background-color: rgba(122, 50, 50, 0.05);
    box-shadow: inset 3px 0 0 #a84343;
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
    border-color: #a84343 !important;
    box-shadow: inset 3px 0 0 #a84343, 0 0 0 0.2rem rgba(168, 67, 67, 0.15);
}

body.light-mode .form-control.is-invalid,
body.light-mode .form-select.is-invalid {
    border-color: #e2b6b6 !important;
    background-color: #fdf5f5;
    box-shadow: inset 3px 0 0 #a84343;
}

/* --- FIELD ERROR MESSAGE: small, muted, sits under the field --- */
.field-error {
    display: none;
    font-size: 0.78rem;
    color: #c25858;
    margin-top: 4px;
    line-height: 1.35;
    letter-spacing: 0.1px;
}

.field-error.show {
    display: block;
}

body.light-mode .field-error {
    color: #8b3535;
}

/* Elements with a title tooltip get a subtle info cursor */
th[title],
[data-tip] {
    cursor: help;
}

th[title] {
    text-decoration: underline dotted rgba(212, 177, 85, 0.4);
    text-underline-offset: 4px;
}

th[title]:hover {
    text-decoration-color: rgba(212, 177, 85, 0.9);
    color: #d4b155;
}

/* =============================================================
   ABBREVIATION TOOLTIP BADGE  (mobile + desktop)
   ============================================================= */

th[title] {
    position: relative;
    white-space: nowrap;
}

.abbr-tip-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    margin-left: 4px;
    border-radius: 50%;
    background: rgba(212, 177, 85, 0.18);
    color: #d4b155;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    vertical-align: middle;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s ease, transform 0.15s ease;
}

.abbr-tip-badge:hover,
.abbr-tip-badge:focus {
    background: rgba(212, 177, 85, 0.4);
    outline: none;
    transform: scale(1.08);
}

body.light-mode .abbr-tip-badge {
    background: rgba(163, 123, 27, 0.15);
    color: #a37b1b;
}

body.light-mode .abbr-tip-badge:hover,
body.light-mode .abbr-tip-badge:focus {
    background: rgba(163, 123, 27, 0.35);
}

/* ---- The popup bubble ---- */

.abbr-tip-bubble {
    position: fixed;
    z-index: 10000;
    max-width: 260px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #1a1d22;
    border: 1px solid #2c3138;
    color: #d4d8de;
    font-size: 0.82rem;
    line-height: 1.35;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity 0.12s ease;
    pointer-events: none;
    -webkit-user-select: none;
    user-select: none;
}

body.light-mode .abbr-tip-bubble {
    background: #ffffff;
    border-color: #e2e6ec;
    color: #2c3138;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* On mobile, show a slightly larger badge so it's easier to tap */
@media (max-width: 575.98px) {
    .abbr-tip-badge {
        width: 17px;
        height: 17px;
        font-size: 11px;
    }
    .abbr-tip-bubble {
        max-width: 220px;
        font-size: 0.8rem;
    }
}

/* Remove the dotted underline from the previous attempt — the badge is
   now the visual cue, so the underline is redundant. */
th[title] {
    text-decoration: none !important;
}

/* =============================================================
   PASSWORD STRENGTH METER
   ============================================================= */

.pw-strength-bar {
    width: 100%;
    height: 5px;
    background: #262b32;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

body.light-mode .pw-strength-bar { background: #e2e6ec; }

.pw-strength-fill {
    height: 100%;
    width: 0%;
    transition: width 0.25s ease, background 0.25s ease;
}

.pw-strength-fill.pw-weak   { background: #c25858; }
.pw-strength-fill.pw-fair   { background: #d6bd7f; }
.pw-strength-fill.pw-good   { background: #7fb28f; }
.pw-strength-fill.pw-strong { background: #4a8a5c; }

.pw-strength-label {
    font-size: 0.78rem;
    color: #8a939e;
    margin-bottom: 8px;
}

body.light-mode .pw-strength-label { color: #6c757d; }

.pw-rules {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.8rem;
}

.pw-rules li {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #8a939e;
    padding: 1px 0;
}

body.light-mode .pw-rules li { color: #6c757d; }

.pw-rule-icon {
    display: inline-flex;
    width: 14px;
    justify-content: center;
    font-weight: 700;
}

.pw-rules li.pw-rule-ok { color: #7fb28f; }
.pw-rules li.pw-rule-ok .pw-rule-icon { color: #4a8a5c; }

body.light-mode .pw-rules li.pw-rule-ok { color: #2c6a41; }

/* Other Teams cards — allow the three buttons to wrap nicely on narrow screens */
.tm-other-team-actions {
    flex-wrap: wrap;
}
.tm-other-team-actions .btn {
    white-space: nowrap;
}

/* =============================================================
   ABBREVIATION TOOLTIP BADGE (mobile + desktop)
   ============================================================= */

th[title] {
    position: relative;
    white-space: nowrap;
    text-decoration: none !important;
}

.abbr-tip-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    margin-left: 4px;
    border-radius: 50%;
    background: rgba(212, 177, 85, 0.18);
    color: #d4b155;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    vertical-align: middle;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s ease, transform 0.15s ease;
}

.abbr-tip-badge:hover,
.abbr-tip-badge:focus {
    background: rgba(212, 177, 85, 0.4);
    outline: none;
    transform: scale(1.08);
}

body.light-mode .abbr-tip-badge {
    background: rgba(163, 123, 27, 0.15);
    color: #a37b1b;
}

.abbr-tip-bubble {
    position: fixed;
    z-index: 10000;
    max-width: 260px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #1a1d22;
    border: 1px solid #2c3138;
    color: #d4d8de;
    font-size: 0.82rem;
    line-height: 1.35;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    opacity: 1;
    pointer-events: none;
    -webkit-user-select: none;
    user-select: none;
}

body.light-mode .abbr-tip-bubble {
    background: #ffffff;
    border-color: #e2e6ec;
    color: #2c3138;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

@media (max-width: 575.98px) {
    .abbr-tip-badge {
        width: 17px;
        height: 17px;
        font-size: 11px;
    }
    .abbr-tip-bubble {
        max-width: 220px;
        font-size: 0.8rem;
    }
}

/* =============================================================
   PAGINATION
   ============================================================= */

.pg-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0 4px;
    flex-wrap: wrap;
}

.pg-info {
    font-size: 0.82rem;
    color: #8a939e;
}

body.light-mode .pg-info { color: #6c757d; }

.pg-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.pg-btn {
    min-width: 32px;
    height: 30px;
    padding: 0 9px;
    border-radius: 6px;
    background: transparent;
    border: 1px solid #2c3138;
    color: #b7bcc4;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.pg-btn:hover:not(:disabled) {
    background: rgba(212, 177, 85, 0.1);
    border-color: #d4b155;
    color: #d4b155;
}

.pg-btn.active {
    background: #d4b155;
    border-color: #d4b155;
    color: #16191d;
    font-weight: 700;
}

.pg-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.pg-ellipsis {
    color: #8a939e;
    padding: 0 4px;
    user-select: none;
}

body.light-mode .pg-btn {
    border-color: #e2e6ec;
    color: #495057;
}
body.light-mode .pg-btn:hover:not(:disabled) {
    background: rgba(163, 123, 27, 0.08);
    border-color: #a37b1b;
    color: #a37b1b;
}
body.light-mode .pg-btn.active {
    background: #a37b1b;
    border-color: #a37b1b;
    color: #ffffff;
}

/* =============================================================
   ANALYTICS CHARTS
   ============================================================= */

.an-chart-wrap {
    position: relative;
    height: 260px;
}

@media (max-width: 575.98px) {
    .an-chart-wrap {
        height: 220px;
    }
}

/* =============================================================
   LEGAL PAGES (Terms / Privacy)
   ============================================================= */

.legal-body h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #d4b155;
    margin-top: 28px;
    margin-bottom: 10px;
    letter-spacing: 0.2px;
}

.legal-body h2:first-child {
    margin-top: 0;
}

.legal-body h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #e7e9ec;
    margin-top: 18px;
    margin-bottom: 8px;
}

body.light-mode .legal-body h3 {
    color: #16191d;
}

.legal-body p,
.legal-body li {
    font-size: 0.92rem;
    line-height: 1.65;
    color: #b7bcc4;
}

body.light-mode .legal-body p,
body.light-mode .legal-body li {
    color: #495057;
}

.legal-body ul {
    padding-left: 22px;
    margin-bottom: 12px;
}

.legal-body li {
    margin-bottom: 5px;
}

.legal-body a {
    color: #d4b155;
    text-decoration: none;
}

.legal-body a:hover {
    text-decoration: underline;
}

body.light-mode .legal-body a {
    color: #a37b1b;
}

.legal-body strong {
    color: #e7e9ec;
    font-weight: 600;
}

body.light-mode .legal-body strong {
    color: #16191d;
}

/* =============================================================
   TOURNAMENT CHAMPION
   ============================================================= */

.champion-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, rgba(212,177,85,.18), rgba(212,177,85,.04));
    border: 1px solid rgba(212,177,85,.45);
    border-radius: 12px;
    flex-wrap: wrap;
}

body.light-mode .champion-banner {
    background: linear-gradient(135deg, #fbf3d9, #fffdf6);
    border-color: rgba(163,123,27,.35);
}

.champion-icon {
    font-size: 2.2rem;
    line-height: 1;
    flex-shrink: 0;
}

.champion-text {
    flex: 1;
    min-width: 0;
}

.champion-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #a37b1b;
    font-weight: 700;
    margin-bottom: 2px;
}

body.light-mode .champion-label { color: #8b6915; }

.champion-team {
    font-size: 1.25rem;
    font-weight: 700;
    color: #d4b155;
    line-height: 1.2;
}

body.light-mode .champion-team { color: #8b6915; }

.champion-link {
    color: #d4b155;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
}

.champion-link:hover { text-decoration: underline; }
body.light-mode .champion-link { color: #8b6915; }

.champion-chip {
    display: inline-block;
    padding: 4px 10px;
    margin-bottom: 8px;
    border-radius: 20px;
    background: rgba(212,177,85,.15);
    border: 1px solid rgba(212,177,85,.5);
    color: #d4b155;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}

body.light-mode .champion-chip {
    background: #fbf3d9;
    border-color: rgba(163,123,27,.35);
    color: #8b6915;
}

@media (max-width: 575.98px) {
    .champion-banner { padding: 12px 14px; gap: 12px; }
    .champion-icon { font-size: 1.7rem; }
    .champion-team { font-size: 1.05rem; }
}