/* ====================================================================
   FUTURISTIC RESULTS — Race Data Terminal
   Design: dark glass · neon accents · Orbitron numerics · scan-line
   ==================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500;700;900&family=Space+Grotesk:wght@400;500;700&display=swap');

:root {
    --rf-dark:       #040d0a;
    --rf-dark-2:     #0a1912;
    --rf-green:      #0bbf6a;
    --rf-green-glow: rgba(11, 191, 106, 0.5);
    --rf-gold:       #d6b35a;
    --rf-gold-glow:  rgba(214, 179, 90, 0.5);
    --rf-cyan:       #00d4ff;
    --rf-border:     rgba(255, 255, 255, 0.10);
    --rf-text:       #e8f5ee;
    --rf-muted:      #7ba890;
    --rf-pos1:       #ffd700;
    --rf-pos2:       #c8c8c8;
    --rf-pos3:       #cd7f32;
    --ease-out:      cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Responsive column visibility ── */
@media (max-width: 768px) { .desktop-only { display: none !important; } }
@media (min-width: 769px) { .mobile-only  { display: none !important; } }

/* ══════════════════════════════════════
   KEYFRAMES
   ══════════════════════════════════════ */
@keyframes rowReveal {
    from { opacity: 0; transform: translateX(-16px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes podiumRise {
    from { opacity: 0; transform: translateY(22px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes goldPulse {
    0%, 100% { text-shadow: 0 0 8px rgba(255, 215, 0, 0.45); }
    50%       { text-shadow: 0 0 22px rgba(255, 215, 0, 0.9); }
}

@keyframes borderTrace {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ══════════════════════════════════════
   PODIUM SECTION
   ══════════════════════════════════════ */
.podium-container {
    margin-bottom: 1.75rem;
}

.podium-wrap {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0.75rem;
    padding: 0 0.25rem;
}

.podium-slot {
    flex: 1;
    max-width: 210px;
    position: relative;
    border-radius: 20px;
    padding: 1.4rem 0.85rem 0;
    text-align: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    overflow: hidden;
    opacity: 0;
    animation: podiumRise 0.55s var(--ease-out) forwards;
}

/* Subtle inner-highlight shimmer */
.podium-slot::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(165deg, rgba(255,255,255,0.07) 0%, transparent 55%);
    pointer-events: none;
}

.podium-gold {
    border-color: rgba(255, 215, 0, 0.32);
    background: linear-gradient(160deg, rgba(255,215,0,0.09) 0%, rgba(255,255,255,0.02) 65%);
    box-shadow: 0 0 32px rgba(255,215,0,0.14), 0 20px 52px rgba(0,0,0,0.45);
    padding-top: 2rem;
    animation-delay: 0.08s;
}

.podium-silver {
    border-color: rgba(200,200,200,0.22);
    background: linear-gradient(160deg, rgba(200,200,200,0.07) 0%, rgba(255,255,255,0.02) 65%);
    box-shadow: 0 0 20px rgba(200,200,200,0.09), 0 16px 40px rgba(0,0,0,0.38);
    animation-delay: 0.18s;
}

.podium-bronze {
    border-color: rgba(205,127,50,0.22);
    background: linear-gradient(160deg, rgba(205,127,50,0.07) 0%, rgba(255,255,255,0.02) 65%);
    box-shadow: 0 0 20px rgba(205,127,50,0.09), 0 16px 40px rgba(0,0,0,0.38);
    animation-delay: 0.28s;
}

.podium-rank {
    font-family: 'Orbitron', monospace;
    font-size: 2rem;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 0.2rem;
}

.podium-gold   .podium-rank { color: var(--rf-pos1); animation: goldPulse 2.4s ease-in-out infinite; }
.podium-silver .podium-rank { color: var(--rf-pos2); }
.podium-bronze .podium-rank { color: var(--rf-pos3); }

.podium-medal {
    font-size: 1.65rem;
    line-height: 1;
    margin-bottom: 0.45rem;
}

.podium-name {
    font-family: 'Space Grotesk', 'Poppins', sans-serif;
    font-size: 0.79rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--rf-text);
    margin-bottom: 0.35rem;
    min-height: 2.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.3;
}

.podium-time {
    font-family: 'Orbitron', monospace;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--rf-green);
    margin-bottom: 0.9rem;
    text-shadow: 0 0 10px var(--rf-green-glow);
    letter-spacing: 0.03em;
}

/* Step bar at the base */
.podium-bar {
    height: 6px;
    border-radius: 0 0 20px 20px;
    margin: 0 -0.85rem;
}
.pb-gold   { background: linear-gradient(90deg, transparent, var(--rf-pos1), transparent); }
.pb-silver { background: linear-gradient(90deg, transparent, var(--rf-pos2), transparent); }
.pb-bronze { background: linear-gradient(90deg, transparent, var(--rf-pos3), transparent); }

/* ══════════════════════════════════════
   SEARCH BAR
   ══════════════════════════════════════ */
.results-search-bar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.results-search-bar input.form-control {
    background: rgba(255, 255, 255, 0.055) !important;
    border: 1px solid rgba(11, 191, 106, 0.22) !important;
    border-radius: 12px !important;
    color: var(--rf-text) !important;
    font-family: 'Space Grotesk', 'Poppins', sans-serif;
    font-size: 0.9rem;
    padding: 0.62rem 1rem;
    transition: border-color 0.22s, box-shadow 0.22s, background 0.22s;
}

.results-search-bar input.form-control::placeholder { color: var(--rf-muted); font-style: italic; }

.results-search-bar input.form-control:focus {
    background: rgba(11, 191, 106, 0.07) !important;
    border-color: var(--rf-green) !important;
    box-shadow: 0 0 0 3px rgba(11,191,106,0.18), 0 0 18px rgba(11,191,106,0.10) !important;
    outline: none;
}

#resultsSearchCount {
    font-family: 'Orbitron', monospace;
    font-size: 0.68rem;
    color: var(--rf-muted);
    white-space: nowrap;
    letter-spacing: 0.06em;
}

/* ══════════════════════════════════════
   TABLE SHELL
   ══════════════════════════════════════ */
.scroll-table-wrapper {
    position: relative;
    max-height: 560px;
    overflow-y: auto;
    border-radius: 18px;
    border: 1px solid var(--rf-border);
    background:
        linear-gradient(rgba(11,191,106,0.022) 1px, transparent 1px),
        linear-gradient(90deg, rgba(11,191,106,0.022) 1px, transparent 1px),
        radial-gradient(ellipse at 18% 0%,   rgba(11,191,106,0.13) 0%, transparent 48%),
        radial-gradient(ellipse at 82% 100%, rgba(214,179,90,0.09) 0%, transparent 42%),
        linear-gradient(160deg, rgba(255,255,255,0.065) 0%, rgba(255,255,255,0.018) 100%);
    background-size: 40px 40px, 40px 40px, 100% 100%, 100% 100%, 100% 100%;
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    box-shadow:
        0 0 0 1px rgba(255,255,255,0.055) inset,
        0 32px 90px rgba(0,0,0,0.42),
        0 0 60px rgba(11,191,106,0.05);
}

/* (scan line removed — too distracting) */

/* Scrollbar */
.scroll-table-wrapper::-webkit-scrollbar       { width: 5px; }
.scroll-table-wrapper::-webkit-scrollbar-track { background: rgba(255,255,255,0.03); }
.scroll-table-wrapper::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--rf-green), var(--rf-gold));
    border-radius: 999px;
}

/* ══════════════════════════════════════
   TABLE
   ══════════════════════════════════════ */
.custom-table-style {
    margin-bottom: 0;
    border-collapse: collapse;
    width: 100%;
    color: var(--rf-text);
}

/* All borders off everywhere — use row bg instead */
.custom-table-style,
.custom-table-style thead,
.custom-table-style tbody,
.custom-table-style tr,
.custom-table-style th,
.custom-table-style td {
    border: none !important;
}

/* Kill Bootstrap's forced bg on cells */
.custom-table-style > :not(caption) > * > * {
    background-color: transparent !important;
    box-shadow: none !important;
}

/* ── Header ── */
.custom-table-style thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 0.85rem 0.85rem;
    background: linear-gradient(135deg, rgba(4,13,10,0.98) 0%, rgba(10,25,18,0.96) 100%) !important;
    color: var(--rf-muted);
    font-family: 'Space Grotesk', 'Poppins', sans-serif;
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    border-bottom: 1px solid rgba(11,191,106,0.18) !important;
    box-shadow: 0 4px 24px rgba(0,0,0,0.45);
}

/* ── Body rows ── */
.custom-table-style tbody tr {
    background: transparent;
    border-bottom: 1px solid rgba(255,255,255,0.045) !important;
    transition: background 0.18s ease, box-shadow 0.18s ease;
}

.custom-table-style tbody tr:nth-child(4n+1) {
    background: rgba(255,255,255,0.022);
}

.custom-table-style tbody tr:not(.details-row):hover {
    background: rgba(11,191,106,0.085) !important;
    box-shadow: inset 3px 0 0 var(--rf-green);
}

/* ── Body cells ── */
.custom-table-style tbody td {
    padding: 0.88rem 0.85rem;
    background: transparent !important;
    color: var(--rf-text);
    font-size: 0.92rem;
    vertical-align: middle;
    font-family: 'Space Grotesk', 'Poppins', sans-serif;
}

/* Position cell */
.custom-table-style tbody td:first-child {
    text-align: center;
    vertical-align: middle;
}

.pos-medal-wrap {
    font-size: 1.5rem;
    line-height: 1;
    display: inline-block;
}

.pos-num {
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--rf-muted);
    letter-spacing: 0.04em;
}

/* Name */
.custom-table-style tbody td:nth-child(2) {
    font-weight: 600;
    letter-spacing: 0.015em;
}

/* Time — Orbitron + glow */
.result-athlete-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid rgba(252, 169, 32, 0.55);
}

.result-athlete-link:hover {
    color: #fca920;
}
.custom-table-style tbody td:nth-child(3) {
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 0.84rem;
    color: var(--rf-green);
    text-shadow: 0 0 12px rgba(11,191,106,0.5);
    letter-spacing: 0.04em;
}

/* Top-3 position highlighting */
.custom-table-style tbody tr[data-position="1"] td:first-child {
    color: var(--rf-pos1) !important;
    animation: goldPulse 2.4s ease-in-out infinite;
}
.custom-table-style tbody tr[data-position="2"] td:first-child {
    color: var(--rf-pos2) !important;
    text-shadow: 0 0 10px rgba(200,200,200,0.45);
}
.custom-table-style tbody tr[data-position="3"] td:first-child {
    color: var(--rf-pos3) !important;
    text-shadow: 0 0 10px rgba(205,127,50,0.45);
}

/* Row entrance animation */
.row-reveal {
    opacity: 0;
    animation: rowReveal 0.38s var(--ease-out) forwards;
    animation-delay: var(--row-delay, 0ms);
}

/* ══════════════════════════════════════
   TOGGLE ICON (mobile expand)
   ══════════════════════════════════════ */
.toggle-icon {
    background: linear-gradient(135deg, rgba(11,191,106,0.9), rgba(214,179,90,0.85));
    color: #050e09;
    border: none;
    border-radius: 50%;
    width: 32px; height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(11,191,106,0.28);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.toggle-icon:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 10px 24px rgba(214,179,90,0.38);
}

/* ══════════════════════════════════════
   MOBILE DRAWER
   ══════════════════════════════════════ */
/* Both <tr> and <td> ignore overflow:hidden in table layout.
   Animate the inner <div> (.details-wrapper) instead — divs work correctly. */
.details-row { }

.details-cell {
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
}

.details-wrapper {
    overflow: hidden;
    height: 0;
    transition: height 0.4s var(--ease-out);
}
.details-content {
    padding: 0.9rem;
    margin: 0.35rem;
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
    border: 1px solid rgba(11,191,106,0.14);
    box-shadow: 0 10px 28px rgba(0,0,0,0.24), inset 0 1px 0 rgba(255,255,255,0.08);
    color: var(--rf-text);
    text-align: left;
}
.details-content p      { margin: 0.3rem 0; color: var(--rf-muted); font-size: 0.88rem; }
.details-content strong { color: #fff; font-weight: 700; }

/* ══════════════════════════════════════
   CARD SHELL
   ══════════════════════════════════════ */
.card {
    border-radius: 22px !important;
    background: transparent !important;
    border: none !important;
}
.card-body {
    background: linear-gradient(145deg, rgba(4,13,10,0.96), rgba(10,25,18,0.90)) !important;
    border-radius: 22px;
    padding: 0.5rem !important;
    box-shadow:
        0 0 0 1px rgba(255,255,255,0.06) inset,
        0 40px 100px rgba(0,0,0,0.38);
}

/* ══════════════════════════════════════
   BACK NAVIGATION
   ══════════════════════════════════════ */
.dl-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0.45rem 1rem 0.45rem 0.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: var(--rf-muted);
    font-family: 'Space Grotesk', 'Poppins', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none !important;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dl-back-btn i {
    font-size: 0.7rem;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.dl-back-btn:hover {
    background: rgba(11, 191, 106, 0.10);
    border-color: rgba(11, 191, 106, 0.28);
    color: var(--rf-green);
}

.dl-back-btn:hover i {
    transform: translateX(-3px);
}

/* ══════════════════════════════════════
   MOBILE
   ══════════════════════════════════════ */
@media (max-width: 768px) {
    .scroll-table-wrapper   { max-height: 60vh; border-radius: 14px; }
    .custom-table-style thead th { font-size: 0.6rem; padding: 0.72rem 0.5rem; }
    .custom-table-style tbody td { padding: 0.78rem 0.5rem; font-size: 0.87rem; }
    .custom-table-style tbody td:first-child  { font-size: 0.74rem; }
    .custom-table-style tbody td:nth-child(2) { text-align: left; }
    .custom-table-style tbody td:nth-child(3) { font-size: 0.74rem; }

    .podium-wrap { gap: 0.4rem; }
    .podium-slot { padding: 0.9rem 0.5rem 0; border-radius: 14px; }
    .podium-gold { padding-top: 1.4rem; }
    .podium-rank  { font-size: 1.55rem; }
    .podium-medal { font-size: 1.3rem; }
    .podium-name  { font-size: 0.68rem; }
    .podium-time  { font-size: 0.7rem; margin-bottom: 0.7rem; }
    .podium-bar   { height: 5px; }
}

/* ══════════════════════════════════════
   RESULT ACTIONS CELL
   ══════════════════════════════════════ */
.result-actions-cell {
    text-align: right;
    white-space: nowrap;
    vertical-align: middle;
}

.result-profile-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.28rem 0.72rem;
    border-radius: 999px;
    background: rgba(11, 191, 106, 0.10);
    border: 1px solid rgba(11, 191, 106, 0.32);
    color: var(--rf-green);
    font-family: 'Space Grotesk', 'Poppins', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.04em;
    margin-right: 6px;
    transition: background 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.result-profile-btn:hover {
    background: rgba(11, 191, 106, 0.22);
    border-color: var(--rf-green);
    color: var(--rf-green);
    box-shadow: 0 0 14px rgba(11, 191, 106, 0.22);
    text-decoration: none;
}

/* Hide expand button on desktop when the row has no coach data */
@media (min-width: 769px) {
    .result-actions-cell[data-has-expand="false"] .toggle-icon { display: none !important; }
}

/* ══════════════════════════════════════
   AFFILIATION CARDS (detail panel)
   ══════════════════════════════════════ */
.result-affil-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.55rem;
}

.result-affil-card {
    display: inline-flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 10px;
    padding: 0.4rem 0.75rem;
    min-width: 90px;
}

.affil-label {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--rf-muted);
    margin-bottom: 2px;
}

.affil-name {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--rf-text);
    text-decoration: none;
}
a.affil-name:hover {
    color: var(--rf-green);
    text-decoration: none;
}

.affil-unregistered {
    display: block;
    font-size: 0.6rem;
    color: var(--rf-muted);
    margin-top: 2px;
    opacity: 0.75;
}
