/* =========================================
   1. ESTRUCTURA GLOBAL (RESET & BODY)
   ========================================= */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #121212;
    color: white;
    display: flex;
    flex-direction: column; /* Organiza barra arriba y contenido abajo */
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    padding-top: 60px; /* Espacio para que la barra fija no tape el contenido */
    box-sizing: border-box;
    overflow-x: hidden;
}

/* =========================================
   2. BARRA DE BIENVENIDA (TOP BAR)
   ========================================= */
#top-welcome-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #1a1a1a;
    color: #ffffff;
    padding: 12px 0;
    font-size: 14px;
    border-bottom: 2px solid #333;
    z-index: 9999;
    text-align: center;
}

#top-welcome-bar b {
    color: #00ceff; /* Azul neón para resaltar el nombre de tu app */
    text-shadow: 0 0 5px rgba(0, 206, 255, 0.3);
}

/* Asegúrate de que el body tenga este padding para no tapar el tester */
body {
    padding-top: 60px;
}

#location-text b {
    color: #00e676;
    text-transform: capitalize;
    text-shadow: 0 0 8px rgba(0, 230, 118, 0.4);
}

.flag-icon {
    border-radius: 3px;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
    vertical-align: middle;
}

/* =========================================
   3. CONTENEDOR PRINCIPAL DEL TESTER
   ========================================= */
.container {
    background: #1e1e1e;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.7);
    text-align: center;
    min-width: 450px;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    margin-bottom: 20px;
}

#status {
    font-weight: bold;
    margin-bottom: 25px;
    padding: 12px;
    border-radius: 8px;
}

.connected { background-color: #2e7d32; }
.disconnected { background-color: #c62828; }

/* Visualización del Mando */
.image-container {
    height: 245px;
    display: flex;
    align-items: center;
    justify-content: center;
}

img {
    max-width: 100%;
    max-height: 100%;
    display: none;
    transition: filter 0.1s ease;
}

/* =========================================
   4. ANALÓGICOS (STICKS)
   ========================================= */
.sticks-container {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
    background: #222;
    padding: 15px;
    border-radius: 10px;
}

.stick-viewer {
    width: 75px;
    height: 75px;
    border: 2px solid #444;
    border-radius: 50%;
    position: relative;
    background: #111;
}

.stick-dot {
    width: 15px;
    height: 15px;
    background: #00ceff;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px #00ceff;
    will-change: transform; /* Optimización para suavidad */
}

/* =========================================
   5. BOTONES Y GRILLA
   ========================================= */
.buttons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 8px;
    margin-top: 20px;
    width: 100%;
}

.btn-indicator {
    background: #222;
    border: 1px solid #444;
    padding: 10px 5px; /* Un poco menos de padding a los lados */
    border-radius: 5px;
    font-size: 11px; /* Bajamos un punto el tamaño para que quepan nombres largos */
    color: #666;
    text-align: center;
    white-space: nowrap; /* Evita que el texto se parta en dos líneas */
    overflow: hidden;
}

.btn-indicator.active {
    background: #00ceff;
    color: black;
    border-color: white;
    font-weight: bold;
    box-shadow: 0 0 10px #00ceff;
}

/* =========================================
   6. BRILLOS POR MARCA (FILTERS)
   ========================================= */
img.ps-style.pressed {
    filter: drop-shadow(0 0 20px #0043ff) drop-shadow(0 0 40px #0043ff) !important;
}

img.xbox-style.pressed {
    filter: drop-shadow(0 0 20px #107c10) drop-shadow(0 0 40px #107c10) !important;
}

img.generic-style.pressed {
    filter: drop-shadow(0 0 20px #ffffff) drop-shadow(0 0 40px #ffffff) !important;
}

/* =========================================
   7. ELEMENTOS FLOTANTES (CONTADOR / FIRMA)
   ========================================= */

/* Contador de Visitas */
#visitor-counter {
    position: fixed;
    top: 65px; /* Debajo de la welcome bar */
    right: 20px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #00CEFF;
    box-shadow: 0 0 10px rgba(0, 206, 255, 0.3);
    font-size: 13px;
}

/* Firma y Versión */
.author {
    position: fixed;
    bottom: 35px;
    right: 20px;
    font-size: 14px;
    opacity: 0.5;
}

.version {
    position: fixed;
    bottom: 15px;
    right: 20px;
    font-size: 14px;
    color: #00ceff;
    font-weight: bold;
}

/* =========================================
   8. RESPONSIVE (MÓVILES)
   ========================================= */
@media (max-width: 600px) {
    .container {
        min-width: 90%;
        padding: 15px;
    }

    #visitor-counter {
        top: auto;
        bottom: 70px; /* Lo mueve abajo en móviles para no tapar */
        right: 10px;
        transform: scale(0.9);
    }

    .author, .version {
        position: relative;
        bottom: 0;
        right: 0;
        margin-top: 10px;
        text-align: center;
        display: block;
    }
}