/* WP Servicios Pro — PWA Styles */

/* Standalone mode adjustments (cuando se abre como app) */
@media (display-mode: standalone) {
    /* Ocultar menú de navegación de WP y headers innecesarios */
    #wpadminbar,
    .site-header .site-branding,
    .entry-header,
    .site-footer {
        display: none !important;
    }

    /* Maximizar área de contenido */
    .site-content,
    .entry-content,
    .page .entry-content {
        padding-top: env(safe-area-inset-top, 0) !important;
        padding-bottom: calc(70px + env(safe-area-inset-bottom, 0)) !important;
        max-width: 100% !important;
        margin: 0 !important;
    }

    body {
        padding-top: 0 !important;
        margin-top: 0 !important;
    }

    /* Safe areas para notch/status bar */
    html {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ===== Bottom Navigation Bar (app-like) ===== */
#wpsv-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0));
    z-index: 99998;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

@media (display-mode: standalone) {
    #wpsv-bottom-nav {
        display: flex !important;
    }
}

/* También mostrar en móvil cuando se navega desde el browser */
@media (max-width: 768px) {
    #wpsv-bottom-nav {
        display: flex !important;
    }
}

#wpsv-bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 4px;
    text-decoration: none;
    color: #666;
    font-size: 10px;
    font-family: -apple-system, sans-serif;
    transition: color 0.2s;
}

#wpsv-bottom-nav a .nav-icon {
    font-size: 22px;
    line-height: 1;
}

#wpsv-bottom-nav a.active {
    color: #1565c0;
    font-weight: 600;
}

#wpsv-bottom-nav a:active {
    transform: scale(0.92);
}

/* ===== Pull-to-refresh indicator ===== */
#wpsv-pull-indicator {
    display: none;
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    background: #1565c0;
    color: #fff;
    padding: 8px 16px;
    border-radius: 0 0 12px 12px;
    font-size: 13px;
    font-family: -apple-system, sans-serif;
    z-index: 99999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* ===== Install banner animation ===== */
@keyframes wpsv-slide-up {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ===== Loading spinner for PWA ===== */
.wpsv-pwa-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #666;
    font-family: -apple-system, sans-serif;
}

.wpsv-pwa-loading::before {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid #e0e0e0;
    border-top-color: #1565c0;
    border-radius: 50%;
    animation: wpsv-spin 0.8s linear infinite;
    margin-bottom: 12px;
}

@keyframes wpsv-spin {
    to { transform: rotate(360deg); }
}

/* ===== Toast notifications ===== */
.wpsv-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-family: -apple-system, sans-serif;
    z-index: 99999;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    animation: wpsv-toast-in 0.3s ease, wpsv-toast-out 0.3s ease 2.7s;
    animation-fill-mode: forwards;
}

@keyframes wpsv-toast-in {
    from { transform: translateX(-50%) translateY(20px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

@keyframes wpsv-toast-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ===== Responsive adjustments para look de app ===== */
@media (max-width: 768px) {
    /* Dar más espacio al contenido principal */
    body {
        padding-bottom: 70px !important;
    }

    /* Headers del plugin más compactos */
    #wpsv-live > div:first-child,
    #wpsv-tech > div:first-child,
    #wpsv-my-services > div:first-child {
        border-radius: 0 !important;
        margin: -15px -15px 15px !important;
        padding: 15px !important;
    }

    /* Tabs con estilo más nativo */
    #wpsv-tech > div:nth-child(3),
    #wpsv-my-services > div:nth-child(2) {
        position: sticky;
        top: 0;
        z-index: 100;
        background: #fff;
        margin: 0 -15px;
        padding: 0 15px;
    }
}

/* ===== Status bar color en modo app ===== */
@media (display-mode: standalone) {
    body::before {
        content: '';
        display: block;
        height: env(safe-area-inset-top, 0);
        background: #1565c0;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 999999;
    }
}

/* ===== Haptic-style button feedback ===== */
@media (max-width: 768px) {
    button, [type="submit"], .button {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    button:active, [type="submit"]:active {
        transform: scale(0.97);
        transition: transform 0.1s;
    }
}
