/* ==============================================
   OPTIMIZACIÓN MOBILE RESPONSIVE MEJORADA
   ============================================== */

/* Configuración base para móviles */
* {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

body {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* ==============================================
   MEJORAS HEADER MÓVIL
   ============================================== */

@media (max-width: 768px) {
  header {
    padding: 12px 0;
    position: fixed;
    width: 100%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  }

  .header-content {
    max-width: 100%;
    padding: 0 12px;
    gap: 12px;
    grid-template-columns: auto 1fr auto;
    align-items: center;
  }

  .hamburger-group {
    flex: 0 0 auto;
    order: 1;
  }

  .logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    order: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .header-right {
    order: 3;
    flex: 0 0 auto;
    gap: 10px;
  }

  .logo-circle {
    width: 42px;
    height: 42px;
    border-width: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
  }
  
  .logo-circle img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .logo-text {
    font-size: 0.85em;
    text-align: center;
    white-space: nowrap;
  }

  .search-container {
    display: none !important;
  }

  .search-btn-mobile {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #333;
    font-size: 1.2em;
    cursor: pointer;
    padding: 8px;
    margin-right: 4px;
    transition: all 0.3s ease;
  }

  .search-btn-mobile:active {
    color: #8B4513;
    transform: scale(0.95);
  }

  .mobile-search-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10004;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .mobile-search-overlay.active {
    display: flex !important;
    align-items: flex-start;
    opacity: 1;
  }

  .mobile-search-container {
    width: 100%;
    padding: 20px;
    padding-top: 80px;
  }

  .mobile-search-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5em;
    cursor: pointer;
    padding: 10px;
    z-index: 10005;
  }

  .mobile-search-input-wrapper {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 25px;
    padding: 12px 20px;
    gap: 12px;
  }

  .mobile-search-input-wrapper i {
    color: #333;
    font-size: 1.2em;
  }

  .mobile-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    background: transparent;
  }

  .mobile-suggestions {
    margin-top: 20px;
    background: white;
    border-radius: 15px;
    max-height: 60vh;
    overflow-y: auto;
  }

  .mobile-suggestions .suggestion-item {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s ease;
  }

  .mobile-suggestions .suggestion-item:last-child {
    border-bottom: none;
  }

  .mobile-suggestions .suggestion-item:hover {
    background: #f5f5f5;
  }

  .mobile-suggestions .suggestion-category {
    font-size: 12px;
    color: #8B4513;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 4px;
  }

  .mobile-suggestions .suggestion-name {
    font-size: 16px;
    color: #333;
  }

  .cart-btn-modern {
    padding: 8px 10px;
    font-size: 1.1em;
  }

  .cart-count-modern {
    min-width: 16px;
    height: 16px;
    font-size: 0.7em;
    padding: 1px 4px;
  }
}

/* ==============================================
   HERO SECTION MOBILE OPTIMIZADA
   ============================================== */

@media (max-width: 768px) {
  .hero-section {
    min-height: auto;
    padding: 40px 15px 30px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
  }

  .hero-content {
    width: 100%;
    max-width: 100%;
    flex: none;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 0 10px;
  }

  .hero-title {
    margin-bottom: 10px;
    gap: 15px;
  }

  .hero-logo-circle {
    width: 150px;
    height: 150px;
    border-width: 3px;
    margin-bottom: 8px;
  }

  .hero-content h1 {
    font-size: 2.2em;
    margin-bottom: 3px;
    line-height: 1.2;
  }

  .hero-subtitle {
    font-size: 1.1em;
    margin-bottom: 3px;
    line-height: 1.3;
  }

  .hero-description {
    font-size: 0.95em;
    margin-bottom: 15px;
    line-height: 1.5;
    max-width: 90%;
  }

  .hero-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 280px;
    margin-bottom: 15px;
  }

  .btn-primary,
  .btn-secondary {
    padding: 12px 24px;
    font-size: 0.95em;
    border-radius: 25px;
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  .hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 350px;
    margin-top: 0;
    padding-bottom: 10px;
  }

  .stat {
    text-align: center;
    padding: 15px 5px;
  }

  .stat i {
    font-size: 1.5em;
    margin-bottom: 8px;
  }

  .stat-number {
    font-size: 1.8em;
    display: block;
    line-height: 1;
    margin-bottom: 3px;
  }

  .stat-label {
    font-size: 0.8em;
    line-height: 1.2;
  }
}

/* ==============================================
   PRODUCTOS SECTION MOBILE
   ============================================== */

@media (max-width: 768px) {
  .slides-container {
    padding: 0;
  }

  .section-title {
    padding: 40px 15px 25px;
    background: rgba(0, 0, 0, 0.85);
  }

  .section-title h2 {
    font-size: 2em;
    margin-bottom: 10px;
  }

  .section-title p {
    font-size: 1em;
  }

  .slide {
    display: flex;
    flex-direction: column;
    min-height: auto;
    margin-bottom: 0;
  }

  .slide:nth-child(even) {
    flex-direction: column;
    background: rgba(0, 0, 0, 0.8);
  }

  .slide-image {
    width: 100%;
    height: 250px;
    order: 1;
  }

  .slide-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .slide-content {
    order: 2;
    padding: 25px 15px;
    text-align: left;
    max-width: 100%;
  }

  .slide-icon {
    font-size: 2.2em;
    margin-bottom: 15px;
  }

  .slide-content h3 {
    font-size: 1.6em;
    margin-bottom: 12px;
    line-height: 1.2;
  }

  .slide-content p {
    font-size: 0.95em;
    margin-bottom: 15px;
    line-height: 1.5;
  }

  .slide-features {
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
  }

  .slide-features span {
    font-size: 0.85em;
    gap: 6px;
    background: rgba(196, 154, 108, 0.1);
    padding: 4px 8px;
    border-radius: 12px;
    white-space: nowrap;
  }

  .slide-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  .btn-catalog,
  .btn-buy {
    padding: 12px 20px;
    font-size: 0.9em;
    border-radius: 25px;
    text-align: center;
    width: 100%;
    max-width: 250px;
  }
}

/* ==============================================
   FOOTER MOBILE OPTIMIZADO
   ============================================== */

@media (max-width: 768px) {
  footer {
    padding: 30px 15px 15px;
  }

  .footer-content {
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    margin-bottom: 25px;
  }

  .footer-section {
    text-align: left;
  }

  .footer-section h4 {
    font-size: 1em;
    margin-bottom: 12px;
    color: #c49a6c;
  }

  .footer-section ul {
    padding: 0;
    margin: 0;
  }

  .footer-section li {
    margin-bottom: 8px;
  }

  .footer-section a {
    font-size: 0.9em;
    line-height: 1.4;
  }

  .footer-highlights {
    gap: 12px;
    margin: 15px 0;
  }

  .highlight-item {
    gap: 10px;
    align-items: flex-start;
  }

  .highlight-item i {
    font-size: 1.1em;
    width: 20px;
    margin-top: 2px;
  }

  .highlight-item strong {
    font-size: 0.9em;
    line-height: 1.3;
  }

  .highlight-item p {
    font-size: 0.8em;
    line-height: 1.3;
    margin: 0;
  }

  .footer-contact-info p {
    font-size: 0.85em;
    margin: 6px 0;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .footer-contact-info i {
    width: 16px;
    font-size: 0.9em;
  }

  .footer-bottom {
    padding-top: 15px;
    border-top: 1px solid #555;
  }

  .footer-bottom p {
    font-size: 0.8em;
    margin: 0;
    text-align: center;
  }
}

/* ==============================================
   MÓVILES PEQUEÑOS (< 480px)
   ============================================== */

@media (max-width: 480px) {
  .hero-section {
    padding: 55px 12px 30px;
  }

  .hero-content h1 {
    font-size: 1.8em;
  }

  .hero-subtitle {
    font-size: 1em;
  }

  .hero-description {
    font-size: 0.9em;
    max-width: 95%;
  }

  .hero-logo-circle {
    width: 120px;
    height: 120px;
  }

  .hero-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    max-width: 320px;
  }

  .stat {
    padding: 10px 3px;
  }

  .stat-number {
    font-size: 1.4em;
  }

  .stat-label {
    font-size: 0.75em;
  }

  .section-title {
    padding: 25px 12px 20px;
  }

  .section-title h2 {
    font-size: 1.6em;
  }

  .slide-content {
    padding: 20px 12px;
  }

  .slide-content h3 {
    font-size: 1.4em;
  }

  .slide-image {
    height: 200px;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 20px;
    text-align: center;
  }

  .footer-section {
    text-align: center;
  }

  .highlight-item {
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }

  .highlight-item i {
    width: auto;
    margin-top: 0;
  }
}

/* ==============================================
   NAVEGACIÓN MÓVIL MEJORADA
   ============================================== */

@media (max-width: 768px) {
  .nav-menu {
    position: fixed;
    top: 0;
    left: -100%;
    width: 85%;
    max-width: 320px;
    height: 100vh;
    background: white;
    flex-direction: column;
    gap: 0;
    align-items: stretch;
    padding: 70px 0 20px 0;
    box-shadow: 2px 0 15px rgba(0,0,0,0.1);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    overflow-y: auto;
  }

  .nav-menu.active {
    left: 0;
  }

  .nav-link {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    font-size: 1em;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background-color 0.2s ease;
  }

  .nav-link:hover {
    background-color: rgba(196, 154, 108, 0.05);
  }

  .nav-link i {
    width: 20px;
    text-align: center;
    color: #c49a6c;
  }

  .hamburger {
    display: flex;
    width: 24px;
    height: 20px;
  }

  .hamburger span {
    height: 2px;
    background: #333;
    border-radius: 1px;
  }

  .hamburger-text {
    display: block;
    font-size: 0.8em;
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
}

/* ==============================================
   CARRITO MÓVIL OPTIMIZADO
   ============================================== */

@media (max-width: 768px) {
  .cart-content {
    width: 95%;
    height: 85vh;
    max-height: 85vh;
    border-radius: 12px;
  }

  .cart-header {
    padding: 15px;
    border-radius: 12px 12px 0 0;
  }

  .cart-header h3 {
    font-size: 1.1em;
  }

  .cart-items {
    padding: 15px;
    max-height: calc(85vh - 180px);
  }

  .cart-item {
    padding: 12px 0;
    gap: 12px;
  }

  .item-icon {
    font-size: 1.3em;
    width: 35px;
  }

  .item-details h4 {
    font-size: 0.95em;
  }

  .item-details p {
    font-size: 0.85em;
  }

  .cart-footer {
    padding: 15px;
  }

  .cart-actions {
    flex-direction: column;
    gap: 8px;
  }

  .cart-actions button {
    width: 100%;
    padding: 10px 15px;
    font-size: 0.9em;
  }
}

/* ==============================================
   OPTIMIZACIONES ADICIONALES
   ============================================== */

/* Prevenir zoom horizontal en inputs */
@media (max-width: 768px) {
  input, select, textarea {
    font-size: 16px; /* Evita zoom en iOS */
  }
}

/* Smooth scroll mejorado para móviles */
@media (max-width: 768px) {
  html {
    scroll-behavior: smooth;
  }
  
  body {
    -webkit-overflow-scrolling: touch;
  }
}

/* WhatsApp button móvil */
@media (max-width: 768px) {
  .whatsapp-float {
    width: 55px;
    height: 55px;
    bottom: 20px;
    right: 20px;
    font-size: 1.6em;
  }

  .whatsapp-tooltip {
    display: none; /* Ocultar tooltip en móvil */
  }
}

/* ==============================================
   LANDSCAPE MÓVIL
   ============================================== */

@media (max-width: 768px) and (orientation: landscape) {
  .hero-section {
    min-height: 100vh;
    padding: 50px 15px 30px;
  }

  .hero-content {
    justify-content: space-between;
  }

  .hero-logo-circle {
    width: 100px;
    height: 100px;
  }

  .hero-content h1 {
    font-size: 1.8em;
  }

  .hero-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 20px;
  }

  .stat {
    padding: 8px 5px;
  }

  .stat-number {
    font-size: 1.4em;
  }

  .stat-label {
    font-size: 0.7em;
  }
}

/* ==============================================
   FIXES ESPECÍFICOS PARA PROBLEMAS COMUNES
   ============================================== */

/* Fix para elementos que se salen del viewport */
@media (max-width: 768px) {
  * {
    max-width: 100% !important;
  }

  body, html {
    overflow-x: hidden;
  }

  .slide, .hero-section, .contact-section, footer {
    width: 100%;
    box-sizing: border-box;
  }
}

/* Fix para imágenes responsive */
@media (max-width: 768px) {
  img {
    max-width: 100%;
    height: auto;
  }
}

/* Fix para texto que no se ajusta */
@media (max-width: 768px) {
  h1, h2, h3, h4, h5, h6, p, span, div {
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
}

/* ==============================================
   AJUSTE DE MARCAS DE AGUA PARA MÓVILES
   ============================================== */

/* Marca de agua más pequeña en productos para móviles */
@media (max-width: 768px) {
  .product-image::after {
    width: 25px !important;
    height: 25px !important;
    bottom: 6px !important;
    right: 6px !important;
  }

  .slide-image::after {
    width: 35px !important;
    height: 35px !important;
    bottom: 10px !important;
    right: 10px !important;
  }
}

/* Marca de agua aún más pequeña en pantallas muy pequeñas */
@media (max-width: 480px) {
  .product-image::after {
    width: 20px !important;
    height: 20px !important;
    bottom: 5px !important;
    right: 5px !important;
  }

  .slide-image::after {
    width: 28px !important;
    height: 28px !important;
    bottom: 8px !important;
    right: 8px !important;
  }
}