/* assets/css/portal.css - Portal & Auth Styling */

/* Header */
.portal-header {
    width: 100%;
    height: 70px;
    background: rgba(14, 19, 53, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 2px solid rgba(79, 142, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 500;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.brand-logo-text {
    font-size: 1.6rem;
    font-family: var(--font-heading);
    font-weight: 800;
    background: linear-gradient(135deg, #FFD200 0%, #FF8500 50%, #00D2FF 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(255, 210, 0, 0.3);
}

.brand-badge {
    background: linear-gradient(135deg, #00D2FF 0%, #0077FF 100%);
    color: #FFF;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: 700;
    text-transform: uppercase;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.08);
    padding: 5px 12px 5px 6px;
    border-radius: 30px;
    border: 1px solid var(--border-neon);
}

.user-pill-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid var(--neon-yellow);
    background: #1E1B4B;
    object-fit: cover;
}

.user-pill-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-white);
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Hamburger Menu Button */
.hamburger-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1.5px solid var(--border-neon);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.2s;
    touch-action: manipulation;
}

.hamburger-btn span {
    display: block;
    width: 20px;
    height: 2.5px;
    background-color: var(--neon-blue);
    border-radius: 2px;
    transition: all 0.2s;
}

.hamburger-btn:hover {
    background: rgba(0, 210, 255, 0.15);
    border-color: var(--neon-blue);
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.3);
}

/* Hamburger Dropdown */
.hamburger-menu {
    position: absolute;
    top: 72px;
    right: 20px;
    width: 250px;
    background: linear-gradient(165deg, #161C4C 0%, #0F1338 100%);
    border: 1.5px solid var(--border-highlight);
    border-radius: 18px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7);
    padding: 10px;
    display: none;
    flex-direction: column;
    gap: 4px;
    z-index: 600;
    animation: menuFade 0.2s ease forwards;
}

.hamburger-menu.active {
    display: flex;
}

@keyframes menuFade {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: var(--text-white);
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.menu-item:hover {
    background: rgba(79, 142, 255, 0.18);
    color: var(--neon-yellow);
    transform: translateX(4px);
}

.menu-item.logout {
    color: #F87171;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 4px;
    padding-top: 12px;
}

.menu-item.logout:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #FF6B6B;
}

/* Login Card Container */
.auth-wrapper {
    min-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: linear-gradient(165deg, rgba(22, 28, 76, 0.95) 0%, rgba(15, 19, 56, 0.98) 100%);
    border: 2px solid var(--border-highlight);
    border-radius: 28px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 210, 255, 0.2);
    padding: 0 24px 32px 24px;
    text-align: center;
    overflow: hidden;
    position: relative;
}

.auth-hero-banner {
    margin: 0 -24px 20px -24px;
    position: relative;
    border-bottom: 2px solid var(--border-neon);
    background: #0B0E2A;
    overflow: hidden;
}

.auth-hero-banner img {
    width: 100%;
    height: auto;
    display: block;
}

.auth-title {
    font-size: 1.6rem;
    color: var(--neon-yellow);
    margin-bottom: 6px;
}

.auth-subtitle {
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 24px;
}

/* Anti-Bot Math Box */
.captcha-box {
    background: rgba(10, 14, 40, 0.8);
    border: 1.5px dashed var(--neon-blue);
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.captcha-question {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--neon-yellow);
}

.captcha-refresh-btn {
    background: none;
    border: none;
    color: var(--neon-blue);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: transform 0.2s;
}

.captcha-refresh-btn:hover {
    transform: rotate(90deg);
}

.captcha-input {
    width: 90px;
    text-align: center;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 8px;
    border-radius: 10px;
}

/* Avatar Grid Picker */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
    background: rgba(10, 14, 40, 0.5);
    border-radius: 14px;
    border: 1px solid var(--border-neon);
    margin-top: 6px;
}

.avatar-option {
    aspect-ratio: 1;
    border-radius: 14px;
    border: 2px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.15s;
    padding: 4px;
}

.avatar-option:hover {
    transform: scale(1.08);
    border-color: var(--neon-blue);
}

.avatar-option.selected {
    border-color: var(--neon-yellow);
    background: rgba(255, 210, 0, 0.15);
    box-shadow: 0 0 12px rgba(255, 210, 0, 0.4);
}

.avatar-option img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Portal Main Content */
.portal-main {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 16px 80px 16px;
}

.welcome-hero {
    background: linear-gradient(135deg, rgba(26, 33, 84, 0.9) 0%, rgba(18, 23, 61, 0.95) 100%);
    border: 2px solid var(--border-highlight);
    border-radius: 24px;
    padding: 24px;
    margin-bottom: 28px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: var(--shadow-card);
}

.hero-text h1 {
    font-size: 1.6rem;
    color: var(--neon-yellow);
    margin-bottom: 6px;
}

.hero-text p {
    color: var(--text-dim);
    font-size: 0.95rem;
}

.hero-stats {
    display: flex;
    gap: 16px;
}

.stat-pill {
    background: rgba(10, 14, 40, 0.6);
    border: 1px solid var(--border-neon);
    border-radius: 16px;
    padding: 10px 16px;
    text-align: center;
}

.stat-pill-val {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--neon-yellow);
}

.stat-pill-lbl {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
}

/* Games Grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.game-card {
    background: linear-gradient(165deg, rgba(26, 33, 84, 0.85) 0%, rgba(18, 23, 61, 0.95) 100%);
    border: 2px solid var(--border-neon);
    border-radius: 24px;
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-card);
}

.game-card:hover {
    transform: translateY(-5px);
    border-color: var(--neon-blue);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6), 0 0 25px rgba(0, 210, 255, 0.3);
}

.game-card-banner {
    height: 140px;
    background: linear-gradient(135deg, #1E1B4B 0%, #312E81 50%, #4C1D95 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.game-card-banner::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30px;
    background: linear-gradient(to top, rgba(26, 33, 84, 1), transparent);
}

.game-card-icon {
    font-size: 3.5rem;
    filter: drop-shadow(0 0 15px rgba(255, 210, 0, 0.6));
}

.game-card-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.game-card-title {
    font-size: 1.3rem;
    color: var(--neon-yellow);
    margin-bottom: 8px;
}

.game-card-desc {
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 20px;
    line-height: 1.4;
}

/* Tabs */
.tabs-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border-neon);
    padding-bottom: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-btn {
    padding: 8px 16px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.tab-btn.active {
    background: var(--neon-blue);
    color: #0B0F2A;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Footer Copyright */
.portal-footer {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .portal-header {
        padding: 0 12px;
    }
    .user-pill-name {
        max-width: 80px;
    }
    .welcome-hero {
        flex-direction: column;
        align-items: flex-start;
    }
    .hero-stats {
        width: 100%;
        justify-content: space-between;
    }
    .stat-pill {
        flex: 1;
    }
    .modal-content {
        padding: 16px;
    }
}

/* ==================================================== */
/* GALAXY LEADERBOARD COMPONENT (PORTAL)                */
/* ==================================================== */
.portal-leaderboard-section {
    margin-top: 36px;
    margin-bottom: 40px;
    width: 100%;
}

.portal-leaderboard-header {
    margin-bottom: 16px;
}

.portal-section-title {
    font-size: 1.35rem;
    color: var(--neon-yellow);
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
    margin-bottom: 4px;
}

.portal-section-subtitle {
    font-size: 0.85rem;
    color: var(--text-dim);
}

.leaderboard-card {
    background: linear-gradient(165deg, rgba(22, 28, 76, 0.92) 0%, rgba(13, 17, 48, 0.98) 100%);
    border: 2px solid var(--border-neon);
    border-radius: 24px;
    padding: 20px 18px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(14px);
    width: 100%;
    box-sizing: border-box;
}

/* Controls: Mission & Island */
.lb-controls-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.lb-control-group {
    flex: 1 1 140px;
    min-width: 0;
}

.lb-control-label {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 5px;
    display: block;
    font-weight: 600;
}

.lb-select {
    width: 100%;
    padding: 8px 12px;
    font-size: 0.88rem;
    border-radius: 12px;
    background: rgba(14, 19, 53, 0.85);
    border: 1.5px solid var(--border-neon);
    color: var(--text-white);
    outline: none;
    cursor: pointer;
    box-sizing: border-box;
}

/* Operation Sign Selector (Addition, Subtraction, Multiplication, Division) */
.lb-sign-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.lb-sign-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    min-height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    color: var(--text-white);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.lb-sign-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
}

.lb-sign-btn.active {
    background: linear-gradient(135deg, rgba(0, 210, 255, 0.3) 0%, rgba(0, 119, 255, 0.4) 100%);
    border-color: var(--neon-blue);
    color: #FFF;
    box-shadow: 0 0 16px rgba(0, 210, 255, 0.35);
}

.lb-sign-btn .sign-icon {
    font-size: 1rem;
}

/* Tabs: All-Time vs Weekly */
.lb-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.lb-tab-btn {
    flex: 1;
    min-height: 44px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-neon);
    color: var(--text-dim);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.lb-tab-btn.active {
    background: var(--neon-blue);
    color: #0A0D25;
    border-color: var(--neon-blue);
    box-shadow: 0 0 16px rgba(0, 210, 255, 0.4);
}

/* Week Info Banner */
.lb-week-info {
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-dim);
    margin-bottom: 12px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    border: 1px dashed rgba(255, 255, 255, 0.12);
}

/* Rankings List */
.lb-list-container {
    max-height: 520px;
    overflow-y: auto;
    padding-right: 4px;
    -webkit-overflow-scrolling: touch;
}

.lb-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 14px;
    margin-bottom: 8px;
    background: rgba(10, 14, 40, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: transform 0.15s ease, border-color 0.15s ease;
    gap: 10px;
}

.lb-row:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 210, 255, 0.35);
}

/* Top 3 Highlighting */
.lb-row.top-1 {
    background: linear-gradient(90deg, rgba(255, 210, 0, 0.18) 0%, rgba(10, 14, 40, 0.8) 100%);
    border: 1.5px solid rgba(255, 210, 0, 0.5);
    box-shadow: 0 0 18px rgba(255, 210, 0, 0.12);
}

.lb-row.top-2 {
    background: linear-gradient(90deg, rgba(226, 232, 240, 0.15) 0%, rgba(10, 14, 40, 0.8) 100%);
    border: 1.5px solid rgba(226, 232, 240, 0.45);
}

.lb-row.top-3 {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.15) 0%, rgba(10, 14, 40, 0.8) 100%);
    border: 1.5px solid rgba(245, 158, 11, 0.45);
}

.lb-rank {
    width: 34px;
    flex-shrink: 0;
    text-align: center;
    font-family: var(--font-heading);
    font-weight: 800;
}

.lb-medal {
    font-size: 1.35rem;
}

.lb-rank-num {
    font-size: 1rem;
    color: var(--neon-yellow);
}

.lb-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.lb-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--neon-yellow);
    background: #1E1B4B;
    object-fit: cover;
    flex-shrink: 0;
}

.lb-user-meta {
    min-width: 0;
    flex: 1;
}

.lb-name {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-sub {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.lb-time {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.92rem;
    color: #00F59B;
    background: rgba(0, 245, 155, 0.12);
    padding: 5px 10px;
    border-radius: 9px;
    border: 1px solid rgba(0, 245, 155, 0.3);
    white-space: nowrap;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Empty & Loading States */
.lb-empty-state {
    text-align: center;
    padding: 36px 16px;
    color: var(--text-dim);
}

.lb-empty-icon {
    font-size: 2.8rem;
    margin-bottom: 8px;
    animation: lbFloat 3s ease-in-out infinite;
}

@keyframes lbFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.lb-empty-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 6px;
}

.lb-empty-desc {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-dim);
}

.lb-loading, .lb-error {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-dim);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.lb-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--neon-blue);
    border-radius: 50%;
    animation: lbSpin 0.8s linear infinite;
}

@keyframes lbSpin {
    to { transform: rotate(360deg); }
}

/* Mobile Portrait Tweaks */
@media (max-width: 480px) {
    .leaderboard-card {
        padding: 16px 12px;
        border-radius: 20px;
    }
    .lb-sign-selector {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    .lb-sign-btn {
        padding: 8px 6px;
        font-size: 0.82rem;
    }
    .lb-tab-btn {
        font-size: 0.82rem;
        padding: 8px 4px;
    }
    .lb-row {
        padding: 8px 10px;
        gap: 8px;
    }
    .lb-avatar {
        width: 32px;
        height: 32px;
    }
    .lb-name {
        font-size: 0.88rem;
    }
    .lb-time {
        font-size: 0.85rem;
        padding: 4px 8px;
    }
}

