/* =====================================================
   KUSTODIA - Estilos Responsivos
   ===================================================== */

/* Tablet Landscape (max-width: 1024px) */
@media (max-width: 1024px) {
  :root {
    --container-padding: 2rem;
  }

  h1 { font-size: 2.5rem; }
  h2 { font-size: 2rem; }

  .hero {
    height: auto;
    min-height: auto;
    max-height: none;
    padding: var(--spacing-lg) 0;
  }

  .hero-container {
    display: flex;
    flex-direction: column;
    text-align: center;
  }

  .hero-title {
    font-size: 2.75rem;
  }

  .hero-description {
    margin: 0 auto var(--spacing-lg);
  }

  .hero-buttons {
    justify-content: center;
  }

  .hero-image {
    order: -1;
    margin-bottom: var(--spacing-lg);
  }

  .hero-image img {
    max-width: 400px;
  }

  /* Hero Smartphone Container */
  .hero-smartphone {
    max-width: 95%;
  }

  .floating-notification {
    min-width: 180px;
  }

  .notification-1 {
    top: -3%;
    right: 10%;
  }

  .notification-2 {
    top: 22%;
    left: 0%;
  }

  .notification-3 {
    top: 48%;
    right: -5%;
  }

  .notification-4 {
    bottom: 18%;
    left: 8%;
  }

  .notification-5 {
    bottom: -3%;
    right: 15%;
  }

  /* Lifestyle Security Section */
  .lifestyle-security-section {
    padding: 3rem 2rem;
  }

  .lifestyle-container {
    grid-template-columns: 1fr;
    min-height: auto;
    border-radius: 20px;
  }

  .lifestyle-image {
    order: -1;
    min-height: 350px;
  }

  .lifestyle-content {
    padding: 3rem 2.5rem;
  }

  .lifestyle-title {
    font-size: 2.5rem;
  }

  .lifestyle-text {
    font-size: 1.1rem;
  }

  /* App Control Section */
  .app-control-section {
    padding: 4rem 0;
  }

  .app-control-container {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .app-control-image {
    order: -1;
  }

  .app-control-image img {
    max-width: 280px;
  }

  .app-control-title {
    font-size: 2.25rem;
  }

  .app-control-subtitle {
    font-size: 1.1rem;
  }

  .models-grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 95%;
  }

  .benefits-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .for-whom-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .for-whom-card:last-child {
    grid-column: 1 / -1;
    max-width: 50%;
    justify-self: center;
  }

  .app-floating-panel {
    grid-template-columns: 1fr;
    text-align: center;
    max-width: 600px;
  }

  .app-panel-image {
    order: -1;
    margin-bottom: var(--spacing-sm);
  }

  .app-panel-image img {
    max-width: 180px;
  }

  .app-panel-features {
    justify-content: center;
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-brand {
    grid-column: 1 / -1;
    max-width: none;
    text-align: center;
    margin-bottom: var(--spacing-lg);
  }

  .footer-social {
    justify-content: center;
  }

  /* Cart Page */
  .cart-container {
    grid-template-columns: 1fr;
  }

  .cart-summary {
    position: static;
  }

  /* Product Detail */
  .product-detail {
    grid-template-columns: 1fr;
  }

  .product-gallery {
    position: static;
  }

  /* Checkout */
  .checkout-container {
    grid-template-columns: 1fr;
  }

  /* Contact */
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .contact-info {
    order: 1;
  }

  /* About */
  .about-grid {
    grid-template-columns: 1fr;
  }

  .about-image {
    order: -1;
    margin-bottom: var(--spacing-lg);
  }

  /* Instalacion */
  .instalacion-layout {
    grid-template-columns: 1fr;
  }

  .instalacion-summary {
    position: static;
    order: -1;
  }

  .instalacion-models-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Apple Control Section */
  .apple-control-title {
    font-size: 2rem;
  }

  .apple-control-subtitle {
    font-size: 0.9rem;
  }

  .apple-control-visual {
    min-height: 300px;
  }

  .apple-control-lock {
    width: 175px;
    right: 10%;
    bottom: -25px;
  }

  .apple-control-features {
    gap: var(--spacing-md);
  }

  .apple-control-feature h3 {
    font-size: 0.9rem;
  }
}

/* Tablet Portrait (max-width: 768px) */
@media (max-width: 768px) {
  :root {
    --container-padding: 1.5rem;
    --spacing-xxl: 4rem;
  }

  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.25rem; }

  /* Top Banner */
  .top-banner {
    font-size: 0.75rem;
    height: 40px;
    padding: 0 var(--container-padding);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Header */
  .nav {
    position: fixed;
    top: 80px; /* sticky header height */
    left: auto;
    right: 0;
    width: 35%;
    bottom: 0;
    background-color: var(--color-secondary);
    flex-direction: column;
    justify-content: flex-start;
    padding: var(--spacing-lg);
    transform: translateX(100%);
    transition: transform var(--transition-normal);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
  }

  .nav.active {
    transform: translateX(0);
  }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .nav-link {
    padding: 1.4rem var(--spacing-md);
    font-size: 1.4rem;
    font-weight: 700;
    border-bottom: 3px solid var(--color-border);
  }

  .menu-toggle {
    display: flex;
  }

  /* Hero */
  .hero-title {
    font-size: 2.25rem;
  }

  .hero-description {
    font-size: 1rem;
  }

  .hero-buttons {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }

  .hero-buttons .btn {
    width: auto;
  }

  .hero-image img {
    max-width: 300px;
  }

  /* Orden mobile: texto → video → botones */
  .hero-content {
    order: 1;
    grid-column: unset;
    grid-row: unset;
  }
  .hero-image {
    order: 2;
    grid-column: unset;
    grid-row: unset;
    margin-bottom: 0;
    margin-top: var(--spacing-md);
  }
  .hero-buttons {
    order: 3;
    grid-column: unset;
    grid-row: unset;
    justify-content: center;
    margin-top: var(--spacing-md);
  }

  /* Video más chico en mobile */
  .hero-image video {
    width: 88% !important;
    max-width: 88% !important;
    margin: 0 auto;
    display: block !important;
  }

  /* Hero Smartphone y Notificaciones */
  .hero-smartphone {
    max-width: 95%;
  }

  .floating-notification {
    min-width: 140px;
    padding: 8px 10px;
    gap: 8px;
  }

  .notification-icon {
    width: 32px;
    height: 32px;
  }

  .notification-icon svg {
    width: 16px;
    height: 16px;
  }

  .notification-name {
    font-size: 0.75rem;
  }

  .notification-time {
    font-size: 0.65rem;
  }

  .notification-1 {
    top: 20%;
    right: 2%;
  }

  .notification-2 {
    top: 20%;
    left: -3%;
  }

  .notification-3 {
    top: 62%;
    right: -3%;
  }

  .notification-4 {
    bottom: 18%;
    left: 5%;
  }

  .notification-5 {
    bottom: -8%;
    right: 8%;
  }

  /* Propuesta de valor - carousel horizontal en mobile */
  .propuesta-grid {
    display: flex !important;
    flex-direction: row !important;
    grid-template-columns: unset !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 1rem !important;
    max-width: 100% !important;
    padding-bottom: 0.75rem;
    scrollbar-width: none;
  }
  .propuesta-grid::-webkit-scrollbar {
    display: none;
  }
  .propuesta-grid > div {
    flex: 0 0 75% !important;
    scroll-snap-align: start;
  }

  /* Reducir movimiento de notificaciones en mobile */
  @keyframes floatNotification {
    0%, 100% {
      transform: translateY(0px);
      opacity: 1;
    }
    50% {
      transform: translateY(-8px);
      opacity: 0.95;
    }
  }

  .hero-white .hero-title {
    font-size: 2rem;
  }

  /* Lifestyle Security Section */
  .lifestyle-security-section {
    padding: 2rem 1.5rem;
  }

  .lifestyle-container {
    grid-template-columns: 1fr;
    border-radius: 16px;
  }

  .lifestyle-image {
    min-height: 280px;
  }

  .lifestyle-content {
    padding: 2.5rem 2rem;
  }

  .lifestyle-title {
    font-size: 1.85rem;
  }

  .lifestyle-text {
    font-size: 1rem;
    margin-bottom: 2rem;
  }

  .btn-lifestyle {
    width: 100%;
    text-align: center;
  }

  /* App Control Section */
  .app-control-section {
    padding: 3rem 0;
  }

  .app-control-container {
    gap: 2.5rem;
  }

  .app-control-image img {
    max-width: 240px;
  }

  .app-control-title {
    font-size: 2rem;
  }

  .app-control-subtitle {
    font-size: 1rem;
    margin-bottom: 2rem;
  }

  .app-control-features {
    gap: 1.5rem;
  }

  .app-control-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }

  .app-control-icon svg {
    width: 22px;
    height: 22px;
  }

  .app-control-feature-text h3 {
    font-size: 1rem;
  }

  .app-control-feature-text p {
    font-size: 0.9rem;
  }

  .models-grid {
    grid-template-columns: 1fr;
    max-width: 100%;
  }

  /* Benefits - carousel 2 a la vez */
  .benefits-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
  }

  .benefit-card {
    display: block;
    text-align: center;
  }

  .benefit-card.benefit-hidden {
    display: none !important;
  }

  .benefit-card.benefit-entering {
    animation: benefitFadeIn 0.4s ease forwards;
  }

  @keyframes benefitFadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
  }

  .benefit-icon {
    margin: 0 auto var(--spacing-sm);
    flex-shrink: unset;
  }

  /* For Whom */
  .for-whom-grid {
    grid-template-columns: 1fr;
  }

  .for-whom-card:last-child {
    max-width: none;
  }

  /* Products Grid */
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
  }

  .featured-products-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Section */
  .section-title {
    font-size: 2rem;
  }

  /* Footer */
  .footer-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .footer-column {
    margin-bottom: var(--spacing-lg);
  }

  .footer-links {
    align-items: center;
  }

  .footer-bottom {
    flex-direction: column;
    gap: var(--spacing-sm);
    text-align: center;
  }

  /* Cart */
  .cart-item {
    grid-template-columns: 80px 1fr;
    gap: var(--spacing-sm);
  }

  .cart-item-image {
    width: 80px;
    height: 80px;
  }

  .cart-item-actions {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--color-border);
    margin-top: var(--spacing-sm);
  }

  /* Product Detail */
  .product-info h1 {
    font-size: 2rem;
  }

  .product-info .product-price {
    font-size: 1.5rem;
  }

  .product-add-to-cart {
    flex-direction: column;
  }

  .product-gallery-thumbs {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Checkout */
  .form-row {
    grid-template-columns: 1fr;
  }

  /* Contact */
  .contact-form {
    padding: var(--spacing-lg);
  }

  /* About */
  .about-hero h1 {
    font-size: 2.25rem;
  }

  .about-hero p {
    font-size: 1rem;
  }

  /* App Section */
  .app-panel-features {
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
  }

  .app-floating-panel {
    padding: var(--spacing-lg);
  }

  /* Instalacion */
  .instalacion-city-options {
    grid-template-columns: 1fr;
  }

  .instalacion-time-slots {
    grid-template-columns: 1fr;
  }

  .instalacion-step-actions {
    flex-direction: column;
  }

  .instalacion-step-actions .btn {
    width: 100%;
  }

  .instalacion-step-label {
    display: none;
  }
}

/* Mobile (max-width: 480px) */
@media (max-width: 480px) {
  :root {
    --container-padding: 1rem;
    --spacing-xxl: 3rem;
  }

  html {
    font-size: 14px;
  }

  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }

  /* Top Banner */
  .top-banner {
    font-size: 0.7rem;
    height: 36px;
    padding: 0 var(--container-padding);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .header-container {
    height: 70px;
  }

  .logo-text {
    font-size: 1.25rem;
  }

  .nav {
    top: 70px; /* sticky header height */
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .hero-image img {
    max-width: 250px;
  }

  /* Buttons */
  .btn {
    padding: 0.875rem 1.5rem;
    font-size: 0.875rem;
  }

  .btn-lg {
    padding: 1rem 2rem;
  }

  /* Products */
  .products-grid {
    grid-template-columns: 1fr;
  }

  .featured-products-grid {
    grid-template-columns: 1fr;
  }

  .product-card-content {
    padding: var(--spacing-sm);
  }

  /* Section */
  .section-title {
    font-size: 1.5rem;
  }

  .section-subtitle {
    font-size: 1rem;
  }

  /* CTA */
  .cta-title {
    font-size: 1.75rem;
  }

  /* Cart */
  .cart-page {
    padding-top: 130px;
  }

  .cart-items,
  .cart-summary {
    padding: var(--spacing-md);
  }

  .quantity-btn {
    width: 32px;
    height: 32px;
  }

  .quantity-input {
    width: 40px;
    height: 32px;
  }

  /* Product Detail */
  .product-page {
    padding-top: 130px;
  }

  .product-gallery-thumbs {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Checkout */
  .checkout-page {
    padding-top: 130px;
  }

  .checkout-form {
    padding: var(--spacing-md);
  }

  /* Contact */
  .contact-page {
    padding-top: 130px;
  }

  /* Models Page */
  .models-page {
    padding-top: 106px;
  }

  /* App Section */
  .app-section {
    padding: var(--spacing-xl) 0;
  }

  .app-floating-panel {
    padding: var(--spacing-md);
    gap: var(--spacing-md);
    border-radius: var(--border-radius);
  }

  .app-panel-image img {
    max-width: 150px;
  }

  .app-panel-content h2 {
    font-size: 1.35rem;
  }

  /* Apple Control Section */
  .apple-control-section {
    padding: var(--spacing-lg) 0;
  }

  .apple-control-header {
    margin-bottom: var(--spacing-lg);
  }

  .apple-control-title {
    font-size: 1.75rem;
    padding: 0 var(--spacing-sm);
  }

  .apple-control-subtitle {
    font-size: 0.9rem;
    padding: 0 var(--spacing-sm);
  }

  .apple-control-visual {
    min-height: 300px;
    margin-bottom: var(--spacing-lg);
  }

  .apple-control-house {
    max-width: 100%;
  }

  .apple-control-lock {
    width: 155px;
    right: 10%;
    bottom: -20px;
  }

  .apple-control-features {
    flex-direction: column;
    gap: var(--spacing-md);
    align-items: center;
  }

  .apple-control-feature {
    max-width: 100%;
  }

  .apple-control-feature h3 {
    font-size: 1rem;
  }

  /* Instalacion */
  .instalacion-page {
    padding-top: 110px;
  }

  .instalacion-models-grid {
    grid-template-columns: 1fr;
  }

  .instalacion-summary {
    position: sticky;
    bottom: 0;
    top: auto;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    z-index: 10;
  }

  /* Toast */
  .toast-container {
    left: var(--spacing-sm);
    right: var(--spacing-sm);
    top: 120px;
  }

  .toast {
    min-width: auto;
    width: 100%;
  }

  /* =====================================================
     MOBILE FIXES - iPhone
     ===================================================== */

  /* Evitar scroll horizontal en toda la página */
  html, body {
    overflow-x: hidden;
    max-width: 100%;
  }

  /* 1. Video hero - forzar visibilidad en iOS */
  .hero-image {
    min-height: 250px;
  }
  .hero-image video {
    display: block !important;
    width: 88% !important;
    max-width: 88% !important;
    height: auto !important;
    min-height: 120px;
    border-radius: 12px;
    filter: none !important;
    margin: 0 auto !important;
  }

  /* Unlock methods - 3 columnas en mobile para que quepan todos */
  .unlock-methods {
    grid-template-columns: repeat(3, 1fr);
    max-width: 100%;
    padding: 0 1rem;
    gap: 1.25rem;
  }

  /* 2. Productos destacados - slider horizontal */
  .featured-products-grid {
    display: flex !important;
    grid-template-columns: unset !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 1rem;
    max-width: 100%;
    padding: 0 1rem 1rem;
    scrollbar-width: none;
  }
  .featured-products-grid::-webkit-scrollbar {
    display: none;
  }
  .featured-products-grid .product-card {
    flex: 0 0 78%;
    scroll-snap-align: start;
    max-width: 78%;
  }

  /* Contenedor del smartphone - no desborda */
  .hero-smartphone-container {
    overflow: hidden;
  }

  /* 3. Notificaciones flotantes - reposicionar y reducir */
  .floating-notification {
    min-width: 0;
    max-width: 135px;
    padding: 6px 8px;
    gap: 5px;
  }
  .notification-icon {
    width: 26px;
    height: 26px;
    min-width: 26px;
    flex-shrink: 0;
  }
  .notification-icon svg {
    width: 13px;
    height: 13px;
  }
  .notification-name {
    font-size: 0.62rem;
    white-space: nowrap;
  }
  .notification-time {
    font-size: 0.55rem;
  }
  /* Reposicionar dentro del área visible de la imagen */
  .notification-1 {
    top: 18%;
    right: 3%;
    left: auto;
    bottom: auto;
  }
  .notification-2 {
    top: 28%;
    left: 2%;
    right: auto;
    bottom: auto;
  }
  .notification-3 {
    top: 64%;
    right: 2%;
    left: auto;
    bottom: auto;
  }
  .notification-4 {
    bottom: 22%;
    left: 2%;
    top: auto;
    right: auto;
  }
  .notification-5 {
    bottom: 4%;
    right: 3%;
    left: auto;
    top: auto;
  }

  /* 4. Botones "Ver modelos" y "Contacto" - centrar en hero-white */
  .hero-white .hero-content {
    margin-left: 0;
    text-align: center;
    padding-top: 6rem;
  }
  .hero-white .hero-image {
    margin-top: 0.4rem;
  }
  .hero-white .hero-buttons {
    justify-content: center;
  }
  .hero-white .hero-buttons .btn,
  .hero:not(.hero-white) .hero-buttons .btn {
    padding: 1rem 2.2rem;
    font-size: 1rem;
  }
  .hero-white .hero-title {
    margin-left: auto;
    margin-right: auto;
  }

  /* 5. Sección "No es una promesa. Es acero y aluminio" - fotos en la misma fila */
  .mortaja-products {
    flex-direction: row !important;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
  }
  .mortaja-product-card {
    flex: 1;
    max-width: 48%;
  }
  .mortaja-product-card > img {
    max-height: 160px !important;
    width: auto;
    max-width: 100%;
  }
  .mortaja-product-label {
    font-size: 0.7rem;
    margin-top: 0.4rem;
  }

  /* 6. Proceso - pasos 1, 2, 3 alineados horizontalmente */
  .process-timeline {
    flex-direction: row !important;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.25rem;
    padding-top: 20px;
  }
  .process-line-bg,
  .process-line-fill {
    display: block !important;
    top: 34px;
    left: 40px;
    right: 40px;
    width: calc(100% - 80px);
  }
  .process-point {
    flex-direction: column !important;
    align-items: center;
    text-align: center;
    gap: 0.4rem;
    flex: 1;
  }
  .process-icon {
    width: 40px;
    height: 40px;
  }
  .process-icon svg {
    width: 18px;
    height: 18px;
  }
  .process-label {
    text-align: center !important;
    margin-top: 0.5rem;
  }
  .process-label p {
    font-size: 0.72rem;
    max-width: 90px;
  }
  .process-label .process-number {
    width: 22px;
    height: 22px;
    font-size: 0.65rem;
    line-height: 22px;
    margin-bottom: 0.25rem;
  }

  /* 7. "Cerraduras diseñadas para cada necesidad" - slider horizontal */
  .for-whom-grid {
    display: flex !important;
    grid-template-columns: unset !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 1rem;
    padding: 0 1rem 1rem;
    scrollbar-width: none;
  }
  .for-whom-grid::-webkit-scrollbar {
    display: none;
  }
  .for-whom-card {
    flex: 0 0 80%;
    scroll-snap-align: start;
    max-width: 80%;
  }
  .for-whom-card:last-child {
    grid-column: unset;
    max-width: 80%;
    justify-self: unset;
  }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    min-height: 100vh;
    padding: var(--spacing-lg) 0;
  }

  .hero-container {
    grid-template-columns: 1fr 1fr;
  }

  .hero-image {
    order: 0;
  }

  .hero-image img {
    max-width: 200px;
  }
}

/* High resolution displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Ensure images are crisp on retina displays */
  .product-card-image img,
  .product-gallery-main img,
  .product-gallery-thumb img {
    image-rendering: -webkit-optimize-contrast;
  }
}

/* Print styles */
@media print {
  .top-banner,
  .header,
  .footer,
  .cart-button,
  .btn,
  .menu-toggle {
    display: none !important;
  }

  body {
    font-size: 12pt;
    line-height: 1.4;
    color: #000;
    background: #fff;
  }

  .container {
    max-width: none;
    padding: 0;
  }

  .product-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }

  a {
    text-decoration: underline;
    color: #000;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .hero-image img {
    animation: none;
  }
}

/* Dark mode (optional - can be enabled later) */
@media (prefers-color-scheme: dark) {
  /* Uncomment to enable automatic dark mode
  :root {
    --color-primary: #ffffff;
    --color-secondary: #1a1a1a;
    --color-text: #e0e0e0;
    --color-text-light: #999999;
    --color-background: #2a2a2a;
    --color-border: #404040;
  }
  */
}
