/* assets/css/carrera.css - De La Platea Manager Retro CSS */
:root {
    --carrera-bg: #070a12;
    --carrera-card-bg: rgba(15, 23, 42, 0.75);
    --carrera-border: rgba(255, 255, 255, 0.1);
    --carrera-gold: #f1c40f;
    --carrera-emerald: #2ecc71;
    --carrera-cyan: #00f2fe;
    --carrera-danger: #e74c3c;
    --carrera-text-retro: #33ff00;
}

.carrera-wrapper {
    min-height: 80vh;
    padding-bottom: 4rem;
    font-family: 'Outfit', sans-serif;
}

.carrera-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.carrera-title {
    font-size: 2.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff 0%, var(--accent) 50%, var(--carrera-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.carrera-subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.7);
}

/* Glass Card */
.carrera-card {
    background: var(--carrera-card-bg);
    border: 1px solid var(--carrera-border);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    margin-bottom: 2rem;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

/* Position Selector Cards */
.pos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.pos-card {
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid var(--carrera-border);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pos-card:hover {
    border-color: var(--accent);
    background: rgba(230, 126, 34, 0.1);
    transform: translateY(-5px);
}

.pos-card.selected {
    border-color: var(--carrera-gold) !important;
    background: rgba(241, 196, 15, 0.15) !important;
    box-shadow: 0 0 20px rgba(241, 196, 15, 0.3);
}

/* Position Buttons in Character Creation */
.pos-btn {
    background: rgba(255, 255, 255, 0.04) !important;
    border: 2px solid var(--carrera-border) !important;
    border-radius: 14px !important;
    padding: 1.2rem 0.5rem !important;
    cursor: pointer;
    transition: all 0.3s ease !important;
}

.pos-btn:hover {
    border-color: var(--accent) !important;
    background: rgba(230, 126, 34, 0.15) !important;
    transform: translateY(-2px);
}

.pos-btn.selected {
    border-color: var(--carrera-gold) !important;
    background: linear-gradient(135deg, rgba(241, 196, 15, 0.25), rgba(230, 126, 34, 0.3)) !important;
    box-shadow: 0 0 25px rgba(241, 196, 15, 0.5) !important;
    transform: scale(1.03);
}

.pos-badge {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--carrera-gold);
    margin-bottom: 0.5rem;
}

.pos-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.pos-desc {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Character Dashboard Layout */
.dash-grid {
    display: grid;
    grid-template-columns: 1.8fr 1fr;
    gap: 1.8rem;
}

@media (max-width: 900px) {
    .dash-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }
}

.avatar-badge-large {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--carrera-gold));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 800;
    color: #fff;
    margin: 0 auto 1rem auto;
    box-shadow: 0 0 25px rgba(230, 126, 34, 0.4);
}

/* Stat Radars / Attribute Bars */
.attr-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.7rem;
    gap: 0.8rem;
    padding: 0.4rem 0.7rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.attr-label {
    font-weight: 700;
    font-size: 0.88rem;
    min-width: 110px;
    max-width: 130px;
    text-transform: capitalize;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #e2e8f0;
}

.attr-bar-wrapper {
    flex: 1;
    height: 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    overflow: hidden;
    margin: 0;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.4);
}

.attr-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    border-radius: 8px;
    transition: width 0.5s ease;
}

.attr-value {
    font-weight: 800;
    min-width: 32px;
    text-align: right;
    font-size: 0.95rem;
    color: var(--carrera-gold);
}

/* Retro Match Engine Terminal */
.retro-terminal {
    background: #04080e;
    border: 2px solid rgba(46, 204, 113, 0.3);
    border-radius: 16px;
    padding: 1.5rem;
    font-family: 'Courier New', Courier, monospace;
    color: var(--carrera-text-retro);
    min-height: 250px;
    max-height: 350px;
    overflow-y: auto;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.9);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.retro-log-line {
    margin-bottom: 0.5rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Trivia & Game Modal Overlay */
.trivia-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    background: rgba(4, 8, 16, 0.92) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    z-index: 9999999 !important;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 1.25rem 0.75rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}

.trivia-box {
    background: #0e1626;
    border: 2px solid var(--carrera-gold);
    border-radius: 20px;
    width: 100%;
    max-width: 600px;
    margin: auto 0;
    padding: 1.75rem 1.5rem;
    text-align: center;
    box-shadow: 0 0 40px rgba(241, 196, 15, 0.3);
    animation: zoomIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-sizing: border-box;
    flex-shrink: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--carrera-gold) rgba(0, 0, 0, 0.3);
}

.trivia-box::-webkit-scrollbar {
    width: 6px;
}

.trivia-box::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.trivia-box::-webkit-scrollbar-thumb {
    background: var(--carrera-gold);
    border-radius: 4px;
}

/* Post-Match Modal Responsive Helpers */
.pm-banner {
    position: relative;
    width: 100%;
    height: 150px;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 1.2rem;
    border: 1px solid var(--carrera-border);
    background: #000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.pm-scoreboard {
    background: rgba(0,0,0,0.5);
    padding: 1.2rem;
    border-radius: 18px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--carrera-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
}

.pm-rating-badge {
    display: inline-block;
    background: rgba(241, 196, 15, 0.15);
    border: 1px solid var(--carrera-gold);
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    margin-bottom: 1.5rem;
}

.pm-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

.pm-stat-box {
    background: rgba(255,255,255,0.04);
    padding: 0.8rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
}

.pm-btn-continue {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 800;
    border-radius: 14px;
    margin-top: 0.5rem;
}

@media (max-width: 600px) {
    .trivia-modal-overlay {
        padding: 0.75rem 0.5rem;
    }
    .trivia-box {
        width: 100%;
        padding: 1.2rem 0.85rem;
        border-radius: 16px;
        max-height: 90vh;
        max-height: 90dvh;
        overflow-y: auto;
        overscroll-behavior: contain;
    }
    .pos-grid {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
        gap: 0.8rem;
    }
    .pm-banner {
        height: 105px !important;
        margin-bottom: 0.85rem !important;
    }
    .pm-scoreboard {
        padding: 0.75rem 0.5rem !important;
        margin-bottom: 0.85rem !important;
        border-radius: 14px !important;
    }
    .pm-scoreboard img {
        width: 40px !important;
        height: 40px !important;
    }
    .pm-scoreboard #pm-marcador {
        font-size: 1.5rem !important;
        padding: 0.3rem 0.8rem !important;
        border-radius: 10px !important;
    }
    .pm-rating-badge {
        padding: 0.4rem 0.9rem !important;
        margin-bottom: 0.85rem !important;
        font-size: 0.9rem !important;
    }
    .pm-stats-grid {
        gap: 0.5rem !important;
        margin-bottom: 0.85rem !important;
    }
    .pm-stat-box {
        padding: 0.55rem 0.7rem !important;
        border-radius: 10px !important;
    }
    .pm-stat-box div:first-child {
        font-size: 0.68rem !important;
    }
    .pm-stat-box div:last-child {
        font-size: 1.1rem !important;
    }
    .pm-btn-continue {
        padding: 0.8rem !important;
        font-size: 0.98rem !important;
        border-radius: 12px !important;
    }
}

@media (max-width: 400px) {
    .trivia-modal-overlay {
        padding: 0.5rem 0.35rem;
    }
    .trivia-box {
        padding: 1rem 0.75rem;
    }
    .pm-banner {
        height: 85px !important;
    }
    .pm-scoreboard #pm-marcador {
        font-size: 1.3rem !important;
        padding: 0.2rem 0.6rem !important;
    }
    .pm-stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.4rem !important;
    }
}

@media (max-height: 700px) {
    .trivia-box {
        padding: 1.2rem 0.85rem;
    }
    .retro-terminal {
        min-height: 160px;
        max-height: 220px;
        padding: 0.85rem;
        margin-bottom: 0.85rem;
    }
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.trivia-timer-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.trivia-timer-inner {
    height: 100%;
    background: var(--carrera-emerald);
    transition: width 0.1s linear;
}

.trivia-btn {
    width: 100%;
    text-align: left;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--carrera-border);
    color: white;
    padding: 1rem 1.2rem;
    margin-bottom: 0.8rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.trivia-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--carrera-gold);
    transform: translateX(5px);
}

.trivia-btn.correct {
    background: rgba(46, 204, 113, 0.3) !important;
    border-color: var(--carrera-emerald) !important;
    color: var(--carrera-emerald) !important;
}

.trivia-btn.incorrect {
    background: rgba(231, 76, 60, 0.3) !important;
    border-color: var(--carrera-danger) !important;
    color: var(--carrera-danger) !important;
}

/* Nav Tabs & Mobile Scroll Indicator */
.carrera-tabs-container {
    position: relative;
    margin-bottom: 1.8rem;
}

.carrera-tabs-wrapper {
    position: relative;
}

.carrera-tabs-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 35px;
    background: linear-gradient(to right, rgba(7, 10, 18, 0), rgba(7, 10, 18, 0.95));
    pointer-events: none;
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
}

.carrera-tabs {
    display: flex;
    gap: 0.6rem;
    border-bottom: 1px solid var(--carrera-border);
    padding-bottom: 0.6rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
}

.carrera-tabs::-webkit-scrollbar {
    height: 4px;
    display: block;
}

.carrera-tabs::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
}

.carrera-tabs::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 4px;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--carrera-border);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    font-weight: 700;
    padding: 0.65rem 1.25rem;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.3s;
    white-space: nowrap;
    flex-shrink: 0;
}

.tab-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.08);
}

.tab-btn.active {
    color: var(--carrera-gold);
    background: rgba(241, 196, 15, 0.12);
    border-color: var(--carrera-gold);
}

@media (max-width: 768px) {
    .tab-btn {
        font-size: 0.82rem;
        padding: 0.5rem 0.85rem;
        border-radius: 10px;
    }
}

/* Leaderboards Table */
.social-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.social-table th, .social-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.social-table th {
    color: var(--carrera-gold);
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.social-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.energy-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(46, 204, 113, 0.15);
    border: 1px solid var(--carrera-emerald);
    color: var(--carrera-emerald);
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
}

/* Mobile Hamburger Navigation Menu */
.carrera-mobile-nav-container {
    display: none;
    margin-bottom: 1.2rem;
    position: relative;
    z-index: 100;
}

.carrera-mobile-menu-trigger {
    width: 100%;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.95));
    border: 2px solid var(--carrera-gold);
    border-radius: 14px;
    padding: 0.95rem 1.2rem;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(241, 196, 15, 0.25);
    transition: all 0.2s ease;
    animation: pulseMenuGold 2.5s infinite ease-in-out;
}

@keyframes pulseMenuGold {
    0%, 100% { box-shadow: 0 4px 15px rgba(241, 196, 15, 0.25); }
    50% { box-shadow: 0 4px 22px rgba(241, 196, 15, 0.55); border-color: #f39c12; }
}

.carrera-mobile-menu-drawer {
    margin-top: 0.6rem;
    background: #0f172a;
    border: 1px solid var(--carrera-border);
    border-radius: 14px;
    padding: 0.8rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
    animation: fadeInDown 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.carrera-mobile-menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
}

.mobile-nav-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 0.75rem 0.8rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-nav-item.active, .mobile-nav-item:hover {
    background: rgba(241, 196, 15, 0.12);
    border-color: var(--carrera-gold);
}

@media (max-width: 768px) {
    .carrera-mobile-nav-container {
        display: block;
    }
    .carrera-tabs-container {
        display: none !important;
    }
}

/* General Subtab Styling (Campeonato, Tienda, Duelos, Social) */
.camp-subtab,
.tienda-subtab,
.duelo-subtab,
.social-subtab {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: rgba(255, 255, 255, 0.85) !important;
    padding: 0.65rem 1.3rem !important;
    border-radius: 12px !important;
    font-weight: 700 !important;
    font-size: 0.9rem !important;
    font-family: inherit !important;
    cursor: pointer !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.55rem !important;
    outline: none !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2) !important;
    text-decoration: none !important;
}

.camp-subtab:hover,
.tienda-subtab:hover,
.duelo-subtab:hover,
.social-subtab:hover {
    background: rgba(230, 126, 34, 0.18) !important;
    border-color: var(--accent) !important;
    color: #ffffff !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 18px rgba(230, 126, 34, 0.25) !important;
}

.camp-subtab.active,
.tienda-subtab.active,
.duelo-subtab.active,
.social-subtab.active {
    background: linear-gradient(135deg, rgba(230, 126, 34, 0.45), rgba(241, 196, 15, 0.45)) !important;
    border-color: var(--carrera-gold) !important;
    color: #ffffff !important;
    font-weight: 800 !important;
    box-shadow: 0 0 22px rgba(241, 196, 15, 0.5) !important;
}

/* Badges e Indicadores de Subtabs */
.badge-en-curso {
    background: linear-gradient(135deg, #e67e22, #f1c40f);
    color: #000000;
    font-size: 0.68rem;
    font-weight: 900;
    padding: 2px 7px;
    border-radius: 6px;
    letter-spacing: 0.5px;
    box-shadow: 0 0 10px rgba(241, 196, 15, 0.5);
    margin-left: 4px;
}

/* Energy Popover Tooltip */
.energy-badge {
    position: relative;
    cursor: pointer;
}

.energy-popover-card {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 275px;
    background: rgba(10, 15, 30, 0.95);
    border: 1px solid var(--carrera-gold);
    backdrop-filter: blur(20px);
    border-radius: 14px;
    padding: 1rem;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.8), 0 0 25px rgba(241, 196, 15, 0.25);
    z-index: 99999;
    text-align: left;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
    pointer-events: none;
}

.energy-badge:hover .energy-popover-card,
.energy-badge:focus .energy-popover-card,
.energy-popover-card.show-mobile {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.energy-popover-card::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 18px;
    width: 10px;
    height: 10px;
    background: rgba(10, 15, 30, 0.95);
    border-top: 1px solid var(--carrera-gold);
    border-left: 1px solid var(--carrera-gold);
    transform: rotate(45deg);
}

/* Racha Diaria de Asistencia (Daily Streak 30 Días) */
.streak-card-widget {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(10, 15, 30, 0.95));
    border: 1px solid var(--carrera-gold);
    border-radius: 16px;
    padding: 1.2rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5), 0 0 20px rgba(241, 196, 15, 0.15);
    margin-bottom: 1.8rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.streak-card-widget:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 25px rgba(241, 196, 15, 0.3);
}

.streak-calendar-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.6rem;
    margin: 1.2rem 0;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 4px;
}

.streak-day-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0.7rem 0.4rem;
    text-align: center;
    position: relative;
    transition: all 0.2s ease;
}

.streak-day-box.claimed {
    background: rgba(46, 204, 113, 0.12);
    border-color: #2ecc71;
    color: #2ecc71;
}

.streak-day-box.today {
    background: rgba(241, 196, 15, 0.15);
    border: 2px solid var(--carrera-gold);
    box-shadow: 0 0 15px rgba(241, 196, 15, 0.5);
    animation: pulse 2s infinite;
}

.streak-day-box.destacado {
    border-color: var(--carrera-gold);
    background: linear-gradient(135deg, rgba(241, 196, 15, 0.15), rgba(230, 126, 34, 0.15));
}

.streak-day-box .day-num {
    font-size: 0.72rem;
    font-weight: 800;
    opacity: 0.7;
    text-transform: uppercase;
}

.streak-day-box .day-icon {
    font-size: 1.4rem;
    margin: 0.3rem 0;
}

.streak-day-box .day-reward {
    font-size: 0.68rem;
    font-weight: 800;
    color: var(--carrera-gold);
}

@media (max-width: 768px) {
    .streak-calendar-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.4rem;
    }
    .streak-day-box {
        padding: 0.5rem 0.2rem;
    }
    .streak-day-box .day-icon {
        font-size: 1.1rem;
    }
}
