/* ============================================================
   A NAM SPORTS — App Theme (Dark / Red)
   Global re-skin loaded AFTER each page's inline styles.
   Turns the site into a dark, glassy football-app UI with the
   brand red (#e31b23) as the accent — without touching page PHP.
   ============================================================ */

/* ---------- 1. Design tokens ---------- */
:root {
    --primary-red: #e31b23;
    --primary-dark: #b31217;
    --asn-red: #e31b23;
    --asn-red-soft: rgba(227, 27, 35, 0.16);
    --asn-red-glow: rgba(227, 27, 35, 0.38);
    --asn-grad: linear-gradient(135deg, #ff3d47 0%, #e31b23 45%, #a90f16 100%);

    --asn-bg: #0b0c12;
    --asn-bg-2: #11121b;
    --asn-surface: rgba(255, 255, 255, 0.045);
    --asn-surface-2: rgba(255, 255, 255, 0.08);
    --asn-border: rgba(255, 255, 255, 0.09);
    --asn-border-strong: rgba(255, 255, 255, 0.16);

    --asn-text: #f2f4fa;
    --asn-text-2: #a6abbd;
    --asn-text-3: #6d7282;

    /* Remap of legacy page variables (pages style themselves with these) */
    --black: #f2f4fa;          /* was text/near-black -> now light text   */
    --dark-gray: #ccd2e0;      /* secondary dark text -> soft light       */
    --gray: #a6abbd;           /* muted text -> muted light               */
    --light-gray: #191b26;     /* light panels -> elevated dark surface   */
    --border-gray: rgba(255, 255, 255, 0.10);
    --white: #ffffff;          /* kept white; light BGs re-skinned below  */

    color-scheme: dark;
}

/* ---------- 2. Base scaffold ---------- */
html { background: var(--asn-bg); }
body {
    background:
        radial-gradient(900px 480px at 85% -10%, rgba(227, 27, 35, 0.16), transparent 60%),
        radial-gradient(700px 420px at -10% 12%, rgba(227, 27, 35, 0.10), transparent 55%),
        radial-gradient(1200px 800px at 50% 115%, rgba(120, 20, 26, 0.18), transparent 60%),
        var(--asn-bg) !important;
    color: var(--asn-text) !important;
    min-height: 100vh;
}
h1, h2, h3, h4, h5, h6 { color: var(--asn-text); }
p { color: inherit; }
a { color: inherit; }
::selection { background: var(--asn-red); color: #fff; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--asn-bg-2); }
::-webkit-scrollbar-thumb { background: #2a2d3d; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--asn-red); }
img { max-width: 100%; }

/* ---------- 3. Top app bar (navbar) ---------- */
.navbar,
.navbar.sticky-top {
    background: rgba(13, 14, 21, 0.86) !important;
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--asn-border) !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45) !important;
}
.navbar-brand, .navbar-brand span, .brand-text .brand-name { color: var(--asn-text) !important; }
.navbar-brand .brand-name span, .navbar-brand span span { color: var(--asn-red) !important; }
.brand-text .brand-tagline { color: var(--asn-text-2) !important; }
.navbar-brand img {
    background: #fff;
    border-radius: 12px;
    padding: 4px;
    height: 46px !important;
}
.navbar .nav-link { color: var(--asn-text) !important; border-radius: 10px; }
.navbar .nav-link:hover { color: #ff8288 !important; }
.navbar .nav-link.active { color: var(--asn-red) !important; }
.navbar-toggler { border-color: var(--asn-border-strong) !important; }
.navbar-toggler-icon {
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(242,244,250,0.9)' stroke-width='2' stroke-linecap='round' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E") !important;
}
@media (max-width: 991.98px) {
    .navbar .navbar-collapse {
        background: rgba(17, 18, 27, 0.97);
        border: 1px solid var(--asn-border);
        border-radius: 16px;
        margin-top: 10px;
        padding: 10px 14px;
    }
}

/* ---------- 4. Breaking ticker ---------- */
.breaking-ticker { background: var(--asn-grad) !important; }
.ticker-label { background: rgba(0, 0, 0, 0.55) !important; color: #fff !important; }
.ticker-item { color: #fff !important; }

/* ---------- 5. Heroes & page headers ---------- */
.hero-section, .page-header, .article-header, .club-hero, .player-hero, .app-hero {
    background:
        linear-gradient(160deg, rgba(227, 27, 35, 0.20) 0%, rgba(11, 12, 18, 0.35) 45%, rgba(11, 12, 18, 0.9) 100%),
        radial-gradient(700px 320px at 80% 0%, rgba(227, 27, 35, 0.35), transparent 60%),
        #121320 !important;
    border-bottom: 1px solid var(--asn-border);
    position: relative;
    overflow: hidden;
}
.hero-content h1, .page-header h1 { color: #fff !important; }
.hero-content h1 span { color: var(--asn-red) !important; text-shadow: 0 0 30px var(--asn-red-glow); }
.hero-content p, .page-header p { color: rgba(255, 255, 255, 0.82) !important; }

/* ---------- 6. Section headers ---------- */
.section-header { border-left-color: var(--asn-red) !important; }
.section-header h2 { color: var(--asn-text) !important; }
.section-header p { color: var(--asn-text-2) !important; }

/* ---------- 7. Cards -> dark glass (covers every light card class) ---------- */
.match-card, .news-card, .standing-card, .fixture-card, .result-card,
.competition-card, .player-card, .club-item, .stat-card, .info-card,
.sidebar-card, .about-card, .feature-card, .fan-card, .fan-story,
.contact-form, .contact-info-card, .video-card, .featured-video-card,
.top-scorer-card, .empty-state, .filter-bar, .filter-section,
.accordion-item-custom, .related-news-card, .competition-selector,
.login-card, .gold-medal, .api-info-bar, .download-btn, .category-count,
.news-tag, .poll-progress, .quiz-option {
    background: var(--asn-surface) !important;
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border: 1px solid var(--asn-border) !important;
    color: var(--asn-text);
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.35);
}
.match-card, .news-card, .fixture-card, .result-card, .competition-card,
.player-card, .stat-card, .video-card, .top-scorer-card, .standing-card {
    border-radius: 18px !important;
    overflow: hidden;
}
.match-card:hover, .news-card:hover, .fixture-card:hover, .result-card:hover,
.competition-card:hover, .player-card:hover, .video-card:hover, .club-item:hover {
    border-color: rgba(227, 27, 35, 0.55) !important;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(227, 27, 35, 0.35), 0 0 34px rgba(227, 27, 35, 0.16) !important;
    transform: translateY(-3px);
}
.news-image, .featured-news-image, .latest-news-image { background: var(--asn-bg-2) !important; }
.news-title a, .news-title { color: var(--asn-text) !important; }
.news-title a:hover { color: #ff6b72 !important; }
.news-excerpt, .news-date { color: var(--asn-text-2) !important; }
.news-category { background: var(--asn-grad) !important; color: #fff !important; }

/* Big featured blocks that were blue/navy gradients -> red/dark */
.transfer-news-box {
    background: linear-gradient(135deg, #33080b 0%, #1a1220 55%, #12131f 100%) !important;
    border: 1px solid rgba(227, 27, 35, 0.35) !important;
    border-radius: 18px !important;
}
.live-match-card {
    background:
        radial-gradient(500px 200px at 90% 0%, rgba(227, 27, 35, 0.30), transparent 60%),
        linear-gradient(135deg, #191a28 0%, #101120 100%) !important;
    border: 1px solid rgba(227, 27, 35, 0.4) !important;
    border-left: 5px solid var(--asn-red) !important;
    border-radius: 18px !important;
}

/* ---------- 8. Standings & tables ---------- */
.standing-card-header {
    background: linear-gradient(135deg, #1a0507 0%, #14151f 70%) !important;
    border-bottom: 2px solid var(--asn-red) !important;
}
.standing-card-header h3 { color: #fff !important; }
.standing-table th {
    background: rgba(255, 255, 255, 0.06) !important;
    color: var(--asn-text-2) !important;
    border-color: var(--asn-border) !important;
}
.standing-table td { border-color: var(--asn-border) !important; color: var(--asn-text); }
table, .table { color: var(--asn-text) !important; }
.table > :not(caption) > * > * {
    background: transparent !important;
    color: var(--asn-text) !important;
    border-color: var(--asn-border) !important;
}
.table thead th, .table-light th, .table-light {
    background: rgba(255, 255, 255, 0.06) !important;
    color: var(--asn-text-2) !important;
}
.table-hover tbody tr:hover > * { background: rgba(227, 27, 35, 0.08) !important; }
.pos-champion { background: rgba(46, 204, 113, 0.10) !important; }
.pos-promotion { background: rgba(52, 152, 219, 0.10) !important; }
.pos-relegation { background: rgba(227, 27, 35, 0.10) !important; }

/* Crest / photo chips stay light so dark crests remain visible */
.team-logo-small, .team-logo-match, .team-logo, .club-logo, .club-logo-large,
.competition-logo, .player-photo, .player-photo-large, .scorer-photo, .qr-code {
    background: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.35);
}

/* ---------- 9. Buttons, pills, forms ---------- */
.btn-red, .btn-live, .btn-danger {
    background: var(--asn-grad) !important;
    border: none !important;
    color: #fff !important;
    border-radius: 999px !important;
    box-shadow: 0 8px 22px rgba(227, 27, 35, 0.35);
}
.btn-red:hover, .btn-live:hover, .btn-danger:hover {
    filter: brightness(1.1);
    box-shadow: 0 10px 26px rgba(227, 27, 35, 0.5);
}
.btn-outline-light { border-radius: 999px !important; }
.btn-light {
    background: var(--asn-surface-2) !important;
    border-color: var(--asn-border-strong) !important;
    color: var(--asn-text) !important;
    border-radius: 999px !important;
}
.btn-light:hover { background: rgba(227, 27, 35, 0.25) !important; color: #fff !important; }
.btn-outline-secondary, .btn-outline-dark {
    color: var(--asn-text) !important;
    border-color: var(--asn-border-strong) !important;
    background: var(--asn-surface) !important;
    border-radius: 999px !important;
}
.btn-outline-secondary:hover, .btn-outline-dark:hover {
    background: var(--asn-surface-2) !important;
    border-color: rgba(227, 27, 35, 0.6) !important;
    color: #fff !important;
}
.filter-btn {
    background: var(--asn-surface) !important;
    color: var(--asn-text) !important;
    border: 1px solid var(--asn-border) !important;
    border-radius: 999px !important;
}
.filter-btn:hover { border-color: rgba(227, 27, 35, 0.5) !important; color: #fff !important; }
.filter-btn.active {
    background: var(--asn-grad) !important;
    color: #fff !important;
    border-color: transparent !important;
    box-shadow: 0 6px 18px rgba(227, 27, 35, 0.4);
}
.form-control, .form-select, .form-control-custom, input, select, textarea {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid var(--asn-border-strong) !important;
    color: var(--asn-text) !important;
    border-radius: 12px;
}
.form-control:focus, .form-select:focus, textarea:focus {
    border-color: var(--asn-red) !important;
    box-shadow: 0 0 0 3px var(--asn-red-soft) !important;
    background: rgba(255, 255, 255, 0.08) !important;
}
.form-control::placeholder, textarea::placeholder { color: var(--asn-text-2) !important; }
.form-select option { background: #14151f; color: var(--asn-text); }
label, .form-label { color: var(--asn-text-2) !important; }

/* ---------- 10. Bootstrap utility & component re-skins ---------- */
.bg-light { background: var(--asn-surface) !important; }
.bg-white { background: var(--asn-bg-2) !important; }
.text-dark { color: var(--asn-text) !important; }
.text-muted, .text-secondary { color: var(--asn-text-2) !important; }
.border, .border-top, .border-bottom, .border-start, .border-end { border-color: var(--asn-border) !important; }
.card {
    background: var(--asn-surface) !important;
    border: 1px solid var(--asn-border) !important;
    color: var(--asn-text);
    border-radius: 18px;
}
.card-header { background: rgba(255, 255, 255, 0.04) !important; border-color: var(--asn-border) !important; }
.list-group-item {
    background: transparent !important;
    color: var(--asn-text) !important;
    border-color: var(--asn-border) !important;
}
.modal-content {
    background: #14151f !important;
    border: 1px solid var(--asn-border-strong) !important;
    color: var(--asn-text);
    border-radius: 18px;
}
.modal-header, .modal-footer { border-color: var(--asn-border) !important; }
.btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
.dropdown-menu {
    background: #14151f !important;
    border: 1px solid var(--asn-border-strong) !important;
}
.dropdown-item { color: var(--asn-text) !important; }
.dropdown-item:hover { background: var(--asn-red-soft) !important; color: #fff !important; }
.alert-light, .alert-secondary {
    background: var(--asn-surface) !important;
    color: var(--asn-text) !important;
    border-color: var(--asn-border) !important;
}
.breadcrumb-item, .breadcrumb-item a { color: var(--asn-text-2) !important; }
.pagination .page-link {
    background: var(--asn-surface) !important;
    border-color: var(--asn-border) !important;
    color: var(--asn-text) !important;
}
.pagination .page-item.active .page-link {
    background: var(--asn-grad) !important;
    border-color: transparent !important;
}
.accordion-item, .accordion-button {
    background: var(--asn-surface) !important;
    color: var(--asn-text) !important;
    border-color: var(--asn-border) !important;
}
.accordion-button:not(.collapsed) { background: var(--asn-red-soft) !important; color: #fff !important; }
.accordion-header-custom, .accordion-header-custom:hover { background: #14151f !important; color: var(--asn-text) !important; }
.progress { background: rgba(255, 255, 255, 0.08) !important; }
.progress-bar { background: var(--asn-grad) !important; }

/* ---------- 11. Dark blocks that used var(--black) as background ---------- */
.footer {
    background: #08090f !important;
    border-top: 1px solid var(--asn-border);
    color: var(--asn-text) !important;
}
.footer h5 { color: var(--asn-red) !important; }
.footer a { color: var(--asn-text-2) !important; }
.footer a:hover { color: #ff6b72 !important; }
.scroll-top { background: var(--asn-grad) !important; box-shadow: 0 8px 22px rgba(227, 27, 35, 0.45); }
.auto-refresh { background: rgba(13, 14, 21, 0.9) !important; border: 1px solid var(--asn-border-strong); }
.admin-login-badge a { background: rgba(13, 14, 21, 0.85) !important; }

/* ---------- 12. Misc components spotted in audit ---------- */
.position-badge { background: var(--asn-surface-2) !important; color: var(--asn-text) !important; }
.scorer-rank.gold, .gold-medal { background: linear-gradient(135deg, #d4a017, #b8860b) !important; color: #fff !important; }
.empty-state { border-radius: 18px; }
.empty-state i { color: var(--asn-text-2) !important; }
.login-footer { background: transparent !important; color: var(--asn-text-2) !important; }
.sports-bg .football, .sports-bg .trophy { opacity: 0.06 !important; }

/* ============================================================
   13. APP SHELL — bottom dock (mobile app navigation)
   ============================================================ */
@media (max-width: 991.98px) {
    body { padding-bottom: calc(86px + env(safe-area-inset-bottom, 0px)) !important; }
    .scroll-top { bottom: calc(96px + env(safe-area-inset-bottom, 0px)) !important; }
}
.asn-dock {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 1040;
    display: flex;
    gap: 4px;
    align-items: center;
    background: rgba(16, 17, 26, 0.92);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    border: 1px solid var(--asn-border-strong);
    border-radius: 24px;
    padding: 8px 10px;
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.4);
    width: min(430px, calc(100vw - 24px));
    justify-content: space-around;
}
@media (min-width: 992px) { .asn-dock { display: none; } }
.asn-dock a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 7px 12px;
    border-radius: 16px;
    color: var(--asn-text-2);
    text-decoration: none;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    min-width: 56px;
    transition: all 0.25s;
}
.asn-dock a i { font-size: 1.15rem; }
.asn-dock a.active {
    color: #fff;
    background: var(--asn-grad);
    box-shadow: 0 8px 20px rgba(227, 27, 35, 0.45);
}
.asn-dock a:not(.active):hover { color: #fff; background: var(--asn-surface-2); }
.asn-dock .asn-dock-live i { position: relative; }
.asn-dock .asn-dock-live i::after {
    content: '';
    position: absolute;
    top: -2px; right: -6px;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #ff3d47;
    animation: asnPulse 1.4s infinite;
}
@keyframes asnPulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.75); } }

/* ---------- 14. PWA install banner ---------- */
.asn-install {
    position: fixed;
    left: 50%;
    transform: translateX(-50%) translateY(140%);
    bottom: calc(104px + env(safe-area-inset-bottom, 0px));
    z-index: 1050;
    width: min(430px, calc(100vw - 24px));
    background: rgba(20, 21, 31, 0.97);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(227, 27, 35, 0.45);
    border-radius: 18px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.65);
    transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.asn-install.show { transform: translateX(-50%) translateY(0); }
.asn-install img { width: 44px; height: 44px; border-radius: 12px; background: #fff; padding: 4px; }
.asn-install .asn-install-txt { flex: 1; min-width: 0; }
.asn-install .asn-install-txt strong { display: block; font-size: 0.9rem; color: #fff; }
.asn-install .asn-install-txt span { font-size: 0.72rem; color: var(--asn-text-2); }
.asn-install button {
    border: none;
    border-radius: 999px;
    padding: 9px 16px;
    font-weight: 700;
    font-size: 0.78rem;
    cursor: pointer;
}
.asn-install .asn-install-go { background: var(--asn-grad); color: #fff; box-shadow: 0 6px 16px rgba(227, 27, 35, 0.4); }
.asn-install .asn-install-no { background: transparent; color: var(--asn-text-2); padding: 9px 8px; }

/* ---------- 15. Offline toast ---------- */
.asn-net-toast {
    position: fixed;
    top: calc(14px + env(safe-area-inset-top, 0px));
    left: 50%;
    transform: translateX(-50%) translateY(-200%);
    z-index: 2000;
    background: rgba(20, 21, 31, 0.97);
    border: 1px solid var(--asn-border-strong);
    color: var(--asn-text);
    border-radius: 999px;
    padding: 9px 18px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6);
    transition: transform 0.35s ease;
}
.asn-net-toast.show { transform: translateX(-50%) translateY(0); }
.asn-net-toast.off i { color: #ffb020; }
.asn-net-toast.on i { color: #2ecc71; }

/* ---------- 16. Polish ---------- */
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
