* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background-color: #f8f9fa;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    gap: 0.75rem;
    padding: 0.4rem 1rem;
}

.logo {
    flex-shrink: 0;
    line-height: 0;
}

.logo img {
    width: 35px;
    height: auto;
    display: block;
}

.index-hero {
    width: 45%;
    height: auto; 
    display: block; 
    margin: 0 auto;
}

/* --- NUEVO: Indicador de batería --- */
.battery-status {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    /* background-color: #2c3e4e; */
    padding: 2px 8px 2px 6px;
    border-radius: 20px;
    color: white;
    font-weight: 500;
    font-size: 0.75rem;
    line-height: 1;
    cursor: default;
    transition: background-color 0.2s;
}
.battery-icon {
    position: relative;
    width: 22px;
    height: 12px;
    background-color: rgba(255,255,255,0.2);
    border: 1px solid black;
    border-radius: 2px;
    overflow: hidden;
}
.battery-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0%;
    background-color: #4caf50;
    transition: width 0.2s ease, background-color 0.2s;
}
.battery-fill.low { background-color: #f44336; }
.battery-fill.medium { background-color: #ff9800; }
.battery-fill.high { background-color: #ffeb3b; }
.battery-fill.full { background-color: #2e7d32; }
.battery-fill.normal { background-color: #4caf50; }
.battery-icon .lightning {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="yellow"><path d="M13 3L6 14h5v7l7-11h-5z"/></svg>') no-repeat center/contain;
    pointer-events: none;
    filter: drop-shadow(0 0 1px black);
}
.battery-percent {
    font-size: 0.75rem;
    font-weight: 600;
    color: black;
    text-align: right;
}
/* Versión táctil */
@media (pointer: coarse) {
    .battery-status {
        padding: 8px 12px;
        gap: 10px;
        border-radius: 30px;
    }
    .battery-icon {
        width: 36px;
        height: 20px;
    }
    .battery-icon .lightning {
        width: 16px;
        height: 16px;
    }
    .battery-percent {
        font-size: 1.2rem;
    }
}

.placeholder {
    flex-grow: 1;
    text-align: center;
    font-weight: 600;
    color: #1e2a3e;
    font-size: 1.1rem;
    white-space: nowrap;
    overflow-x: auto;
}

.menu {
    flex-shrink: 0;
    position: relative;
}

.menu-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
}

/* Estilos generales del menú - versión compacta para PC */
.menu a,
.menu span {
    display: inline-block;
    padding: 2px 2px;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 12px;
    text-decoration: none;
    transition: background 0.2s;
    cursor: pointer;
    white-space: nowrap;
}

.menu a {
    background-color: #007bff;
    color: white;
    text-align: center;
    height: 23px;
}

.menu a:hover {
    background-color: #0056b3;
}

.menu span {
    color: white;
}

/* Botón GPS - base (compacto para PC) */
.gps-status {
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    background-color: #b02a37;
    padding: 4px 6px !important;
    border-radius: 12px !important;
    text-decoration: none;
    transition: background-color 0.2s ease;
    cursor: pointer;
    line-height: 1;
    margin-right: 20px;
}

/* Icono satélite y menú hamburguesa: tamaño controlado por CSS */
.gps-status svg {
    fill: white;
    width: 1rem;
    height: 1rem;
    stroke: white;
    stroke-width: 1.5;
    display: block;
}

/* Icono de movimiento (play, ffw, cuadrado) */
.motion-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}
.motion-icon svg {
    width: 1rem;
    height: 1rem;
    fill: white;
    stroke: none;
    display: block;
}

.menuBotton {
    width: 22px;
    height: auto;
    display: block;
}

/* Colores de estado GPS */
.gps-status.gps-ok { background-color: #146c43; }
.gps-status.gps-warning { background-color: #b8b205; }
.gps-status.gps-alert { background-color: #b45309; }
.gps-status.gps-offline { background-color: #b02a37; }

/* Barras de señal - finas para escritorio */
.signal-bars {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    line-height: 0;
}

.signal-bar {
    width: 2px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 1px;
    transition: background-color 0.1s ease;
}

.bar-1 { height: 5px; }
.bar-2 { height: 8px; }
.bar-3 { height: 11px; }
.bar-4 { height: 14px; }

.signal-bar.active {
    background-color: white;
}

/* Menú desplegable */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.3rem;
    min-width: 150px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

.dropdown-menu.show {
    display: block;
}

/* Sub Menú desplegable */
.sub-dropdown-menu {
    display: none;
    position: absolute;
    right: 100%;
    margin-top: -25px;
    min-width: 150px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 0.4rem 0.8rem;
    text-align: left;
    background: none;
    border: none;
    font-size: 0.85rem;
    font-weight: 500;
    color: #1e2a3e;
    cursor: pointer;
    font-family: inherit;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
}

.dropdown-item.logout-btn {
    color: #dc3545;
}

.dropdown-item.logout-btn:hover {
    background-color: #fff5f5;
}

.notification-banner {
    position: fixed;
    left: 50%;
    bottom: 16px;
    transform: translate(-50%, 18px);
    width: min(720px, calc(100vw - 24px));
    background: rgba(18, 32, 51, 0.96);
    color: #fff;
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(18, 32, 51, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 14px 16px;
    display: none;
    gap: 12px;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(10px);
}

.notification-banner.show {
    display: flex;
    animation: notificationBannerIn 0.24s ease-out forwards;
}

.notification-banner-content {
    flex: 1;
    min-width: 0;
}

.notification-banner-title {
    font-size: 0.98rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.notification-banner-text {
    font-size: 0.88rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.82);
}

.notification-banner-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.notification-banner .banner-btn {
    appearance: none;
    border: 0;
    border-radius: 999px;
    padding: 0.7rem 0.95rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.notification-banner .banner-btn-primary {
    background: #fff;
    color: #122033;
}

.notification-banner .banner-btn-secondary {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.menu-trigger {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.notification-badge {
    position: absolute;
    background-color: #dc3545;
    color: white;
    border-radius: 20px;
    font-size: 1.2rem;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    line-height: 1;
    box-shadow: 0 0 2px rgba(0,0,0,0.2);
    pointer-events: none;
    margin-left: -15px;
}

.notification-button {
    font-size: 1.3rem !important;
}


/* Botón de instalación */
.install-btn {
    display: none;
    /* align-items: center; */
    /* gap: 8px; */
    bottom: 20px;
    right: 20px;
    padding: 16px 32px;
    background-color: #000000;
    color: white !important;
    border: none;
    border-radius: 45px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: slideUp 0.5s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    position: fixed;
    z-index: 1000;
}

@media (min-width: 769px) {
    .install-btn {
        padding: 12px 24px;
        font-size: 2rem;
        min-width: 140px;
        justify-content: center;
    }
}

/* En móvil, más compacto */
@media (max-width: 768px) {
    .install-btn {
        padding: 6px 12px;
        font-size: 1.2rem;
        min-width: auto;
    }
    .install-btn span {
        font-size: 11px;
    }
}

/* Efecto hover para desktop */
.install-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
}

.install-btn:active {
    transform: translateY(0) scale(0.98);
}

/* Animación de pulso para llamar la atención */
.install-btn.pulse {
    animation: pulse 1.5s ease-in-out 3;
}

.install-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); box-shadow: 0 0 30px rgba(102, 126, 234, 0.8); }
    100% { transform: scale(1); }
}

/* Para dispositivos táctiles */
@media (pointer: coarse) {
    .install-btn {
        padding: 10px 16px;
        width: 300px;
        height: 75px;
        font-size: 2rem;
    }
}

/* Badge para indicar "Nuevo" o "Recomendado" */
.install-btn .badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff4757;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 12px;
    font-weight: bold;
    animation: bounce-badge 2s infinite;
}

@keyframes bounce-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Botón flotante para móviles (opcional) */
.install-fab {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.5);
    animation: slideUp 0.5s ease;
}

.install-fab:hover {
    transform: translateX(-50%) scale(1.05);
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}


@keyframes notificationBannerIn {
    from {
        transform: translate(-50%, 24px);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* ========== DETECCIÓN DE DISPOSITIVOS TÁCTILES (MÓVILES Y TABLETS) ========== */
@media (pointer: coarse) {

    .index-hero {
        width: auto;
        height: 45%; 
        display: block; 
        margin: 0 auto;
    }

    .navbar {
        padding: 0.6rem 0.8rem;
        gap: 0.8rem;
    }

    .gps-status {
        padding: 15px 15px !important;
        gap: 8px;
        border-radius: 28px !important;
    }

    .gps-btn .gps-status {
        background-color: #007bff;
        color: white;
        text-align: center;
        height: 23px !important;
    }
    
    .gps-btn .gps-status :hover {
        background-color: #0056b3;
    }

    .gps-status svg {
        width: 2rem;
        height: 2rem;
    }
    .motion-icon svg {
        width: 2rem;
        height: 2rem;
    }

    .signal-bars {
        gap: 3px;
    }
    .signal-bar {
        width: 3px;
    }
    .bar-1 { height: 7px; }
    .bar-2 { height: 11px; }
    .bar-3 { height: 15px; }
    .bar-4 { height: 19px; }

    .menuBotton {
        width: 65px;
    }

    .menu a {        
        height: 45px;
        font-size: 30px;
    }

    .placeholder {
        font-size: 2rem;
        font-weight: 600;
        white-space: nowrap;
        overflow-x: auto;
        padding: 0 4px;
    }

    .logo img {
        width: 55px;
    }

    .dropdown-menu {
        min-width: 350px;
        margin-top: 0.5rem;
        border-radius: 16px;
    }
    .dropdown-item {
        padding: 0.8rem 1rem;
        font-size: 2rem;
        min-height: 48px;
    }

    .dropdown-item:active {
        background-color: #e9ecef;
    }
    .dropdown-item.logout-btn:active {
        background-color: #ffe5e5;
    }
    .notification-badge {
        min-width: 32px;
        height: 32px;
        font-size: 1.5rem !important;
        border-radius: 30px;
        padding: 0 8px;
        margin-left: -40px;
    }
    .notification-button {
        font-size: 2rem !important;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 0.4rem 0.6rem;
        gap: 0.5rem;
    }
    .logo img {
        width: 55px;
    }
    .placeholder {
        font-size: 0.85rem;
    }
    .gps-status {
        padding: 0.35rem 0.7rem !important;
    }
    .gps-status svg {
        width: 1.2rem;
        height: 1.2rem;
    }
    .motion-icon svg {
        width: 1.2rem;
        height: 1.2rem;
    }
    .menuBotton {
        width: 26px;
    }
    .signal-bars {
        gap: 2px;
    }
    .signal-bar {
        width: 2px;
    }
    .bar-1 { height: 5px; }
    .bar-2 { height: 8px; }
    .bar-3 { height: 11px; }
    .bar-4 { height: 14px; }
    /* batería responsive extra */
    .battery-status {
        padding: 2px 6px;
    }
    .battery-percent {
        font-size: 0.7rem;
    }
    .notification-badge {
        min-width: 18px;
        height: 18px;
        font-size: 0.7rem;
    }
}

/* ============================================
   POPUP DE ACTUALIZACIÓN
   ============================================ */

   .update-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.update-popup-overlay.show {
    opacity: 1;
}

.update-popup {
    background: #1a1a2e;
    border-radius: 16px;
    padding: 32px 40px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    color: white;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.update-popup-overlay.show .update-popup {
    transform: scale(1) translateY(0);
}

.update-popup-icon {
    font-size: 48px;
    margin-bottom: 12px;
    animation: updateSpin 2s linear infinite;
}

@keyframes updateSpin {
    0% { transform: rotate(360deg); }
    100% { transform: rotate(0deg); }
}

.update-popup-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #4fc3f7;
}

.update-popup-text {
    font-size: 15px;
    opacity: 0.85;
    line-height: 1.5;
    margin: 0 0 24px 0;
}

.update-popup-text strong {
    color: #4fc3f7;
}

.update-popup-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.update-popup-btn {
    padding: 10px 28px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    min-width: 120px;
}

.update-popup-btn-primary {
    background: linear-gradient(135deg, #4fc3f7, #0288d1);
    color: white;
}

.update-popup-btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(79, 195, 247, 0.4);
}

.update-popup-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
}

.update-popup-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Modo claro */
@media (prefers-color-scheme: light) {
    .update-popup {
        background: #ffffff;
        color: #1a1a2e;
        border-color: rgba(0, 0, 0, 0.1);
    }
    
    .update-popup-title {
        color: #0277bd;
    }
    
    .update-popup-text strong {
        color: #0277bd;
    }
    
    .update-popup-btn-primary {
        background: linear-gradient(135deg, #0277bd, #01579b);
    }
    
    .update-popup-btn-secondary {
        background: rgba(0, 0, 0, 0.05);
        color: rgba(0, 0, 0, 0.6);
    }
    
    .update-popup-btn-secondary:hover {
        background: rgba(0, 0, 0, 0.1);
    }
}

/* Móvil */
@media (max-width: 500px) {
    .update-popup {
        padding: 24px 20px;
    }
    
    .update-popup-buttons {
        flex-direction: column;
    }
    
    .update-popup-btn {
        width: 100%;
        padding: 12px;
    }
}