/**
 * StreamManager Pro - CSS Responsive para sitio público
 * Optimizado para dispositivos móviles
 */

/* ========== VARIABLES Y RESET ========== */
:root {
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
    --header-height: 70px;
}

/* ========== MEJORAS TÁCTILES ========== */
button, a, .clickable {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Tamaño mínimo para elementos táctiles */
.add-to-cart-btn,
.filter-btn,
button[type="submit"] {
    min-height: 44px;
}

/* ========== HEADER RESPONSIVE ========== */
@media (max-width: 768px) {
    header .container {
        padding: 0.5rem 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    header h1 {
        font-size: 1.25rem;
    }

    header .fa-film {
        font-size: 1.5rem;
    }

    /* Botón carrito más grande en móvil */
    header button[onclick="toggleCart()"] {
        padding: 0.5rem;
    }

    header #cartCount {
        width: 1.25rem;
        height: 1.25rem;
        font-size: 0.65rem;
    }

    header .container > .flex.items-center.space-x-4,
    header .container > .flex.items-center.space-x-3 {
        width: 100%;
        justify-content: space-between;
    }
}

/* ========== MENÚ MÓVIL MEJORADO ========== */
@media (max-width: 768px) {
    .mobile-menu {
        background: linear-gradient(135deg, rgba(30, 27, 75, 0.98) 0%, rgba(76, 29, 149, 0.98) 100%);
        -webkit-backdrop-filter: blur(20px);
        backdrop-filter: blur(20px);
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: 12px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
        margin-top: 1rem;
    }

    .mobile-menu.open {
        max-height: 400px;
        padding: 0.5rem;
    }

    .mobile-menu a {
        display: flex;
        align-items: center;
        padding: 0.875rem 1rem;
        font-size: 1rem;
        font-weight: 500;
        color: white;
        border-radius: 8px;
        transition: background-color 0.2s ease;
    }

    .mobile-menu a:hover,
    .mobile-menu a:active {
        background-color: rgba(255, 255, 255, 0.1);
    }

    .mobile-menu a i {
        width: 1.5rem;
        margin-right: 0.75rem;
        text-align: center;
    }
}

/* ========== HERO SECTION RESPONSIVE ========== */
@media (max-width: 768px) {
    #homeSection {
        padding: 3rem 1rem;
    }

    #homeSection h2 {
        font-size: 2rem;
        line-height: 1.2;
    }

    #homeSection p {
        font-size: 1rem;
        padding: 0 0.5rem;
    }

    #homeSection .flex.space-x-4 {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
        padding: 0 1rem;
    }

    #homeSection .flex.space-x-4 a {
        width: 100%;
        text-align: center;
    }
}

/* ========== STORE SECTION RESPONSIVE ========== */
@media (max-width: 768px) {
    #storeSection {
        padding: 2rem 0.75rem;
    }

    #storeSection h2 {
        font-size: 1.75rem;
    }

    #storeSection > div > p {
        font-size: 0.9rem;
    }

    /* Filtros en scroll horizontal */
    .flex.flex-wrap.justify-center.gap-2 {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0.5rem;
        margin: 0 -0.75rem;
        scrollbar-width: none;
        justify-content: flex-start;
    }

    .flex.flex-wrap.justify-center.gap-2::-webkit-scrollbar {
        display: none;
    }

    .filter-btn {
        flex-shrink: 0;
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
        white-space: nowrap;
    }

    /* Grid de servicios */
    #servicesGrid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Cards de servicios */
    .service-card {
        padding: 1.25rem;
    }

    .service-card h3 {
        font-size: 1.125rem;
    }

    .service-card p {
        font-size: 0.875rem;
    }

    .service-card .text-2xl {
        font-size: 1.5rem;
    }

    .service-card .w-16.h-16 {
        width: 3.5rem;
        height: 3.5rem;
    }

    /* Badge de promo */
    .service-card .absolute.-top-2.-right-2 {
        top: -0.5rem;
        right: -0.5rem;
        font-size: 0.65rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Tablets */
@media (min-width: 640px) and (max-width: 1024px) {
    #servicesGrid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========== CONTACT SECTION RESPONSIVE ========== */
@media (max-width: 768px) {
    #contactSection {
        padding: 2rem 0.75rem;
    }

    #contactSection h2 {
        font-size: 1.75rem;
    }

    #contactSection .grid.md\:grid-cols-2 {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    #contactSection .glass-effect {
        padding: 1.25rem;
    }

    #contactSection h3 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }

    #contactSection input,
    #contactSection textarea {
        font-size: 16px; /* Evita zoom en iOS */
        padding: 0.875rem 1rem;
    }

    #contactSection .space-y-4 > div {
        font-size: 0.9rem;
    }

    #contactSection .fa-xl,
    #contactSection .text-xl {
        font-size: 1.25rem;
    }
}

/* ========== USER PANEL RESPONSIVE ========== */
@media (max-width: 768px) {
    #userPanelSection {
        padding: 2rem 0.75rem;
    }

    #userPanelSection h2 {
        font-size: 1.75rem;
    }

    #userPanelSection .glass-effect {
        padding: 1.25rem;
    }

    #userPanelSection input[type="email"] {
        font-size: 16px;
    }

    #userResults .grid {
        grid-template-columns: 1fr;
    }
}

/* ========== MODAL CARRITO RESPONSIVE ========== */
@media (max-width: 768px) {
    #cartModal {
        padding: 0;
        align-items: flex-end;
    }

    #cartModal > div {
        max-width: 100%;
        width: 100%;
        max-height: 85vh;
        border-radius: 1.5rem 1.5rem 0 0;
        margin: 0;
    }

    #cartModal h3 {
        font-size: 1.125rem;
    }

    #cartItems {
        max-height: 50vh;
        padding: 1rem;
    }

    #cartItems > div {
        padding: 0.875rem;
        margin-bottom: 0.75rem;
    }

    #cartItems .w-10.h-10 {
        width: 2.5rem;
        height: 2.5rem;
    }

    #cartItems .font-semibold {
        font-size: 0.9rem;
    }

    #cartItems .text-sm {
        font-size: 0.75rem;
    }

    #cartFooter {
        padding: 1rem;
        padding-bottom: calc(1rem + var(--safe-area-inset-bottom));
    }

    #cartFooter .flex.gap-3 {
        flex-direction: column;
        gap: 0.5rem;
    }

    #cartFooter button {
        width: 100%;
    }

    #cartTotal {
        font-size: 1.5rem;
    }
}

/* ========== ADMIN LOGIN RESPONSIVE ========== */
@media (max-width: 768px) {
    #adminLogin {
        padding: 2rem 0.75rem;
    }

    #adminLogin .glass-effect {
        padding: 1.5rem;
        max-width: 100%;
    }

    #adminLogin h2 {
        font-size: 1.5rem;
    }

    #adminLogin input {
        font-size: 16px;
        padding: 0.875rem 1rem;
    }
}

/* ========== NOTIFICACIONES RESPONSIVE ========== */
@media (max-width: 768px) {
    .notification {
        left: 0.75rem;
        right: 0.75rem;
        bottom: calc(1rem + var(--safe-area-inset-bottom));
        max-width: calc(100% - 1.5rem);
        font-size: 0.875rem;
        padding: 0.875rem 1rem;
    }
}

/* ========== SCROLL SUAVE Y COMPORTAMIENTO ========== */
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Prevenir scroll horizontal */
body {
    overflow-x: hidden;
}

/* ========== MEJORAS PARA LANDSCAPE EN MÓVILES ========== */
@media (max-width: 768px) and (orientation: landscape) {
    #homeSection {
        padding: 2rem 1rem;
        min-height: auto;
    }

    #homeSection h2 {
        font-size: 1.5rem;
    }

    #cartModal > div {
        max-height: 90vh;
    }

    #cartItems {
        max-height: 35vh;
    }
}

/* ========== FOCUS STATES PARA ACCESIBILIDAD ========== */
@media (max-width: 768px) {
    button:focus,
    a:focus,
    input:focus,
    textarea:focus,
    select:focus {
        outline: 2px solid rgba(168, 85, 247, 0.5);
        outline-offset: 2px;
    }
}

/* ========== ANIMACIONES OPTIMIZADAS PARA MÓVIL ========== */
@media (max-width: 768px) {
    .service-card {
        transition: transform 0.2s ease;
    }

    .service-card:active {
        transform: scale(0.98);
    }

    /* Reducir animaciones para mejorar rendimiento */
    @media (prefers-reduced-motion: reduce) {
        * {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
    }
}

/* ========== MEJORAS PARA PANTALLAS PEQUEÑAS (< 375px) ========== */
@media (max-width: 375px) {
    header h1 {
        font-size: 1rem;
    }

    #homeSection h2 {
        font-size: 1.5rem;
    }

    .service-card {
        padding: 1rem;
    }

    .filter-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    #cartItems > div {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    #cartItems > div > div:last-child {
        width: 100%;
        justify-content: space-between;
    }
}

/* ========== MEJORAS PARA iOS ========== */
@supports (-webkit-touch-callout: none) {
    /* Safe area para notch */
    header {
        padding-top: env(safe-area-inset-top, 0);
    }

    /* Inputs con tamaño adecuado para evitar zoom */
    input, select, textarea {
        font-size: 16px;
    }
}
