/* Loaded after page-level styles to force readable contrast in raceface mode. */
body.raceface-theme .page-container,
body.raceface-theme .page-container p,
body.raceface-theme .page-container span,
body.raceface-theme .page-container label,
body.raceface-theme .page-container small,
body.raceface-theme .page-container li,
body.raceface-theme .page-container td,
body.raceface-theme .page-container th,
body.raceface-theme .page-container strong {
    color: var(--rf-text-primary);
}

body.raceface-theme .page-container h1,
body.raceface-theme .page-container h2,
body.raceface-theme .page-container h3,
body.raceface-theme .page-container h4,
body.raceface-theme .page-container h5,
body.raceface-theme .page-container h6 {
    color: var(--rf-text-primary) !important;
}

body.raceface-theme .page-container .text-muted,
body.raceface-theme .page-container .stat-label,
body.raceface-theme .page-container .card-section-text,
body.raceface-theme .page-container .race-meta,
body.raceface-theme .page-container .event-location {
    color: var(--rf-text-dim) !important;
}

/* Login / Register / Search / Profile card surfaces that were hardcoded white. */
body.raceface-theme .login-card,
body.raceface-theme .register-card,
body.raceface-theme .profile-card,
body.raceface-theme .card,
body.raceface-theme .card-modern,
body.raceface-theme .races-filters-sidebar,
body.raceface-theme .races-content,
body.raceface-theme .race-card,
body.raceface-theme .form-wrapper,
body.raceface-theme .upload-container,
body.raceface-theme .table-responsive,
body.raceface-theme .photo-detail-container {
    background: var(--rf-dark-card) !important;
    border-color: var(--rf-dark-border) !important;
    color: var(--rf-text-primary) !important;
}

/* Generic hardcoded inline light backgrounds. */
body.raceface-theme .page-container [style*="background: white"],
body.raceface-theme .page-container [style*="background:white"],
body.raceface-theme .page-container [style*="background-color: white"],
body.raceface-theme .page-container [style*="background-color:white"],
body.raceface-theme .page-container [style*="background: #F9FAFB"],
body.raceface-theme .page-container [style*="background:#F9FAFB"],
body.raceface-theme .page-container [style*="background: #F3F4F6"],
body.raceface-theme .page-container [style*="background:#F3F4F6"],
body.raceface-theme .page-container [style*="background: #ffffff"],
body.raceface-theme .page-container [style*="background:#ffffff"] {
    background: var(--rf-dark-card) !important;
    border-color: var(--rf-dark-border) !important;
}

/* Generic hardcoded dark text colors. */
body.raceface-theme .page-container [style*="color: #111827"],
body.raceface-theme .page-container [style*="color:#111827"],
body.raceface-theme .page-container [style*="color: #1F2937"],
body.raceface-theme .page-container [style*="color:#1F2937"],
body.raceface-theme .page-container [style*="color: #374151"],
body.raceface-theme .page-container [style*="color:#374151"],
body.raceface-theme .page-container [style*="color: #6B7280"],
body.raceface-theme .page-container [style*="color:#6B7280"] {
    color: var(--rf-text-primary) !important;
}

/* Keep orange accents readable. */
body.raceface-theme .page-container [style*="color: #FF6B35"],
body.raceface-theme .page-container [style*="color:#FF6B35"],
body.raceface-theme .page-container [style*="color: #FC4C02"],
body.raceface-theme .page-container [style*="color:#FC4C02"] {
    color: var(--rf-orange) !important;
}

body.raceface-theme .form-control,
body.raceface-theme .filter-text-input,
body.raceface-theme input,
body.raceface-theme select,
body.raceface-theme textarea {
    background: #0e0e0e !important;
    color: var(--rf-text-primary) !important;
    border-color: var(--rf-dark-border) !important;
}

body.raceface-theme input::placeholder,
body.raceface-theme textarea::placeholder {
    color: #6f6f6f !important;
}

body.raceface-theme .btn,
body.raceface-theme .btn-outline-secondary,
body.raceface-theme .btn-google,
body.raceface-theme .btn-strava {
    color: var(--rf-text-primary) !important;
    border-color: var(--rf-dark-border) !important;
}

body.raceface-theme .btn-outline-secondary {
    background: transparent !important;
}

body.raceface-theme .btn-google {
    background: #121212 !important;
}

body.raceface-theme .btn-strava {
    background: var(--rf-orange) !important;
    border-color: var(--rf-orange) !important;
    color: #fff !important;
}

/* Tables in admin/search pages. */
body.raceface-theme .table {
    color: var(--rf-text-primary) !important;
}

body.raceface-theme .table thead th,
body.raceface-theme .table th,
body.raceface-theme .table td {
    background: #121212 !important;
    color: var(--rf-text-primary) !important;
    border-color: var(--rf-dark-border) !important;
}

body.raceface-theme .table tbody tr:hover td {
    background: #181818 !important;
}

/* Border-only sections and dividers that were light gray. */
body.raceface-theme .social-login,
body.raceface-theme .dropdown-divider,
body.raceface-theme hr,
body.raceface-theme [style*="border-top: 1px solid #E5E7EB"],
body.raceface-theme [style*="border-bottom: 1px solid #E5E7EB"],
body.raceface-theme [style*="border: 2px solid #E5E7EB"],
body.raceface-theme [style*="border: 1px solid #E5E7EB"] {
    border-color: var(--rf-dark-border) !important;
}

/* Page-level icons and headers should use brand palette. */
body.raceface-theme .page-container .fa,
body.raceface-theme .page-container .fas {
    color: inherit;
}

body.raceface-theme .page-container .fa-shield,
body.raceface-theme .page-container .fa-search,
body.raceface-theme .page-container .fa-user,
body.raceface-theme .page-container .fa-user-circle,
body.raceface-theme .page-container .fa-images,
body.raceface-theme .page-container .fa-image,
body.raceface-theme .page-container .fa-upload,
body.raceface-theme .page-container .fa-map-marker,
body.raceface-theme .page-container .fa-flag-checkered {
    color: var(--rf-orange) !important;
}

/* Avoid low-contrast bright pastel notice cards. */
body.raceface-theme .page-container [style*="linear-gradient(135deg, #FEF3C7"],
body.raceface-theme .page-container [style*="linear-gradient(135deg, #DBEAFE"],
body.raceface-theme .page-container [style*="linear-gradient(135deg, #D1FAE5"],
body.raceface-theme .page-container [style*="background: #FEF3C7"] {
    background: #171717 !important;
    border-color: var(--rf-dark-border) !important;
}

/* Ensure admin and race pages keep readable links in action areas. */
body.raceface-theme .page-container a:not(.smr-btn):not(.btn):not(.btn-secondary) {
    color: #d7d7d7;
}

body.raceface-theme .page-container a:not(.smr-btn):not(.btn):not(.btn-secondary):hover {
    color: var(--rf-orange);
}

/* 1) Admin buttons: cleaner and less clunky. */
body.raceface-theme .table .btn.btn-sm {
    border-radius: 2px !important;
    font-family: "Space Mono", monospace;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.42rem 0.7rem;
    border-width: 1px !important;
}

body.raceface-theme .table .btn-outline-secondary {
    border-color: #3a3a3a !important;
    color: #d8d8d8 !important;
    background: transparent !important;
}

body.raceface-theme .table .btn-outline-secondary:hover {
    border-color: var(--rf-orange) !important;
    color: var(--rf-orange) !important;
}

body.raceface-theme .table .btn-primary {
    background: #1a1a1a !important;
    border-color: var(--rf-orange) !important;
    color: var(--rf-orange) !important;
}

body.raceface-theme .table .btn-primary:hover {
    background: var(--rf-orange) !important;
    color: #fff !important;
}

body.raceface-theme .table .btn-danger {
    background: #2a1212 !important;
    border-color: #7b2d2d !important;
    color: #f3b0b0 !important;
}

body.raceface-theme .table .btn-danger:hover {
    background: #b91c1c !important;
    border-color: #b91c1c !important;
    color: #fff !important;
}

/* 2) Races section stats readability. */
body.raceface-theme .race-stats {
    border-top-color: #2b2b2b !important;
}

body.raceface-theme .stat-number {
    color: var(--rf-text-primary) !important;
    font-family: "Barlow Condensed", sans-serif;
    letter-spacing: 0.02em;
}

body.raceface-theme .stat-label {
    color: #a2a2a2 !important;
}

body.raceface-theme .stat-divider {
    background: #333 !important;
}

/* 3) My Photos dropdown readability. */
body.raceface-theme .dropbtn {
    background: #141414 !important;
    border-color: #303030 !important;
    color: var(--rf-text-primary) !important;
    font-family: "Space Mono", monospace;
}

body.raceface-theme .dropbtn:hover {
    background: #191919 !important;
    border-color: var(--rf-orange) !important;
}

body.raceface-theme .dropdown-content {
    background: #121212 !important;
    border-color: #2b2b2b !important;
}

body.raceface-theme .dropdown-content a {
    color: #d6d6d6 !important;
}

body.raceface-theme .dropdown-content a:hover {
    background: #1b1b1b !important;
    color: var(--rf-orange) !important;
}

/* 4) Menu bar (Home/Races/etc) ~20% larger. */
body.raceface-theme .nav-link {
    font-size: 14.5px !important;
}

body.raceface-theme .navbar-brand {
    font-size: 24px !important;
}

/* 5) Race page: soften heavy black blocks and fix private folder link readability. */
body.raceface-theme .race-header-section,
body.raceface-theme .filters-sidebar,
body.raceface-theme .race-content,
body.raceface-theme .active-filters,
body.raceface-theme .filter-tag,
body.raceface-theme .empty-state {
    background: #121212 !important;
    border-color: #2a2a2a !important;
}

body.raceface-theme .gallery {
    background: #101010 !important;
    border-color: #292929 !important;
}

body.raceface-theme .flag-btn {
    background: rgba(18, 18, 18, 0.96) !important;
    color: #b7b7b7 !important;
    border: 1px solid #2f2f2f;
}

body.raceface-theme .flag-btn:hover {
    color: #ff6b6b !important;
    border-color: #5a2a2a;
}

body.raceface-theme .flag-btn.active {
    background: rgba(244, 84, 26, 0.25) !important;
    color: var(--rf-orange) !important;
    border-color: var(--rf-orange) !important;
}

body.raceface-theme .flag-btn.active:hover {
    background: rgba(244, 84, 26, 0.88) !important;
    color: #fff !important;
}

body.raceface-theme .album-link {
    background: #1b1410 !important;
    border-left-color: var(--rf-orange) !important;
    border: 1px solid #3b2a20 !important;
}

body.raceface-theme .album-link a,
body.raceface-theme .album-link a:visited {
    color: #ffb27f !important;
}

body.raceface-theme .album-link a:hover {
    color: #ffd1ad !important;
}

body.raceface-theme .alert.alert-info {
    background: #131313 !important;
    border-color: #2f2f2f !important;
    color: #d8d8d8 !important;
}

body.raceface-theme .alert.alert-info strong {
    color: var(--rf-orange) !important;
}
