/**
 * BXC-MP-Tesoro — Game UI Styles
 *
 * HUD del juego: dinero, minimapa, ranking, notificaciones, controles.
 * Diseño responsive y minimalista para no obstruir el canvas 3D.
 */

/* ─── Contenedor Principal ─────────────────────────────────────────────── */

.bxc-game-container {
    position: relative;
    width: 100%;
    height: 90vh;
    min-height: 500px;
    max-height: 100vh;
    overflow: hidden;
    background: #0a0a1a;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0, 100, 255, 0.15);
}

.bxc-game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    outline: none;
    touch-action: none;
}

/* ─── HUD Superior (Dinero + Estado) ──────────────────────────────────── */

.bxc-hud-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 16px;
    pointer-events: none;
    z-index: 10;
}

.bxc-hud-top > * {
    pointer-events: auto;
}

.bxc-money-panel {
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ffd700;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 18px;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bxc-money-panel.pulse {
    transform: scale(1.08);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

.bxc-money-icon {
    font-size: 24px;
    line-height: 1;
}

.bxc-money-amount {
    font-variant-numeric: tabular-nums;
}

.bxc-status-panel {
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(100, 200, 255, 0.2);
    border-radius: 12px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 13px;
    color: #a0c4e8;
}

.bxc-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4caf50;
    box-shadow: 0 0 6px #4caf50;
    animation: bxc-pulse-dot 2s ease-in-out infinite;
}

.bxc-status-dot.disconnected {
    background: #f44336;
    box-shadow: 0 0 6px #f44336;
    animation: none;
}

@keyframes bxc-pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.bxc-player-count {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ─── Panel Lateral Izquierdo (Minimapa) ────────────────────────────────── */

.bxc-minimap-panel {
    position: absolute;
    bottom: 16px;
    left: 16px;
    z-index: 10;
    pointer-events: auto;
}

.bxc-minimap-container {
    width: 160px;
    height: 160px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(100, 200, 255, 0.3);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.bxc-minimap-canvas {
    width: 100%;
    height: 100%;
}

/* ─── Panel Lateral Derecho (Ranking + Info) ───────────────────────────── */

.bxc-side-panel {
    position: absolute;
    top: 80px;
    right: 16px;
    width: 220px;
    max-height: 300px;
    z-index: 10;
    pointer-events: auto;
}

.bxc-ranking-panel {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(100, 200, 255, 0.2);
    border-radius: 12px;
    padding: 12px;
    font-family: 'Segoe UI', Arial, sans-serif;
    color: #e0e0e0;
    overflow-y: auto;
    max-height: 300px;
}

.bxc-ranking-title {
    font-size: 13px;
    font-weight: 700;
    color: #ffd700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
}

.bxc-ranking-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.bxc-ranking-item:last-child {
    border-bottom: none;
}

.bxc-ranking-rank {
    width: 20px;
    font-weight: 700;
    color: #888;
}

.bxc-ranking-rank.gold { color: #ffd700; }
.bxc-ranking-rank.silver { color: #c0c0c0; }
.bxc-ranking-rank.bronze { color: #cd7f32; }

.bxc-ranking-name {
    flex: 1;
    margin: 0 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bxc-ranking-money {
    font-weight: 600;
    color: #ffd700;
    font-variant-numeric: tabular-nums;
}

/* ─── Panel Inferior (Controles + Robo) ────────────────────────────────── */

.bxc-controls-panel {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    pointer-events: auto;
    display: flex;
    gap: 10px;
    align-items: center;
}

.bxc-btn {
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(100, 200, 255, 0.3);
    border-radius: 10px;
    padding: 10px 20px;
    color: #e0e0e0;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
}

.bxc-btn:hover {
    background: rgba(30, 60, 100, 0.8);
    border-color: rgba(100, 200, 255, 0.6);
    box-shadow: 0 0 15px rgba(0, 100, 255, 0.3);
}

.bxc-btn:active {
    transform: scale(0.95);
}

.bxc-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.bxc-btn:disabled:hover {
    background: rgba(0, 0, 0, 0.75);
    border-color: rgba(100, 200, 255, 0.3);
    box-shadow: none;
}

.bxc-btn-rob {
    border-color: rgba(255, 80, 80, 0.4);
    color: #ff6b6b;
}

.bxc-btn-rob:hover {
    background: rgba(100, 20, 20, 0.8);
    border-color: rgba(255, 80, 80, 0.7);
    box-shadow: 0 0 15px rgba(255, 50, 50, 0.3);
}

.bxc-btn-rob .cooldown-text {
    font-size: 11px;
    opacity: 0.7;
}

.bxc-key-hint {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 11px;
    font-weight: 400;
    margin-left: 6px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ─── Notificaciones (Eventos) ────────────────────────────────────────── */

.bxc-notifications {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    max-width: 400px;
    width: 90%;
}

.bxc-notification {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    padding: 8px 18px;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    animation: bxc-notification-in 0.3s ease-out;
    transition: opacity 0.5s ease, transform 0.5s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bxc-notification.fade-out {
    opacity: 0;
    transform: translateY(-10px);
}

.bxc-notification.success {
    color: #4caf50;
    border: 1px solid rgba(76, 175, 80, 0.3);
    text-shadow: 0 0 8px rgba(76, 175, 80, 0.3);
}

.bxc-notification.warning {
    color: #ff9800;
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.bxc-notification.error {
    color: #f44336;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

.bxc-notification.info {
    color: #64b5f6;
    border: 1px solid rgba(100, 181, 246, 0.3);
}

.bxc-notification.rob {
    color: #ff6b6b;
    border: 1px solid rgba(255, 107, 107, 0.4);
}

@keyframes bxc-notification-in {
    from {
        opacity: 0;
        transform: translateY(-15px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ─── Panel de Controles de Teclado ────────────────────────────────────── */

.bxc-controls-help {
    position: absolute;
    bottom: 60px;
    right: 16px;
    z-index: 10;
    pointer-events: auto;
}

.bxc-help-toggle {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 6px 12px;
    color: #888;
    font-size: 12px;
    cursor: pointer;
    font-family: 'Segoe UI', Arial, sans-serif;
    transition: all 0.2s ease;
}

.bxc-help-toggle:hover {
    color: #ccc;
    border-color: rgba(255, 255, 255, 0.3);
}

.bxc-help-content {
    display: none;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(100, 200, 255, 0.2);
    border-radius: 10px;
    padding: 12px 16px;
    margin-top: 6px;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 12px;
    color: #aaa;
    line-height: 1.8;
}

.bxc-help-content.visible {
    display: block;
}

.bxc-help-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bxc-help-key {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 1px 8px;
    font-size: 11px;
    color: #ccc;
    min-width: 40px;
    text-align: center;
}

/* ─── Loading Screen ───────────────────────────────────────────────────── */

.bxc-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 26, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: opacity 0.5s ease;
}

.bxc-loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.bxc-loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(100, 200, 255, 0.2);
    border-top-color: rgba(100, 200, 255, 0.8);
    border-radius: 50%;
    animation: bxc-spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes bxc-spin {
    to { transform: rotate(360deg); }
}

.bxc-loading-text {
    color: #a0c4e8;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 16px;
    font-weight: 500;
}

/* ─── Pantalla de Conexión ──────────────────────────────────────────────── */

.bxc-connect-screen {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 26, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 90;
}

.bxc-connect-screen.hidden {
    display: none;
}

.bxc-connect-title {
    color: #ffd700;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 28px;
    font-weight: 800;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
    margin-bottom: 8px;
}

.bxc-connect-subtitle {
    color: #a0c4e8;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    margin-bottom: 24px;
}

.bxc-connect-btn {
    background: linear-gradient(135deg, #1a5276, #2980b9);
    border: 1px solid rgba(100, 200, 255, 0.4);
    border-radius: 12px;
    padding: 14px 40px;
    color: #ffffff;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.bxc-connect-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 100, 255, 0.4);
}

.bxc-connect-btn:active {
    transform: translateY(0);
}

/* ─── Indicador de Protección ──────────────────────────────────────────── */

.bxc-protection-indicator {
    position: absolute;
    top: 56px;
    left: 16px;
    background: rgba(0, 100, 255, 0.2);
    border: 1px solid rgba(100, 200, 255, 0.5);
    border-radius: 8px;
    padding: 6px 14px;
    color: #64b5f6;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 12px;
    z-index: 10;
    display: none;
    animation: bxc-pulse-dot 1.5s ease-in-out infinite;
}

.bxc-protection-indicator.visible {
    display: block;
}

/* ─── Stats de Conexión (Debug) ───────────────────────────────────────── */

.bxc-debug-stats {
    position: absolute;
    top: 56px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    pointer-events: none;
    display: none;
}

.bxc-debug-stats.visible {
    display: block;
}

.bxc-debug-stats span {
    color: rgba(100, 200, 255, 0.5);
    font-family: monospace;
    font-size: 10px;
    margin: 0 8px;
}

/* ─── Responsive ───────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .bxc-side-panel {
        display: none;
    }

    .bxc-minimap-container {
        width: 120px;
        height: 120px;
    }

    .bxc-money-panel {
        font-size: 15px;
        padding: 8px 14px;
    }

    .bxc-controls-help {
        display: none;
    }

    .bxc-notifications {
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .bxc-minimap-panel {
        bottom: 80px;
    }

    .bxc-controls-panel {
        bottom: 10px;
    }

    .bxc-btn {
        padding: 8px 14px;
        font-size: 12px;
    }
}
