/* ==========================================
   WEBTROP INSIDE - ESTILOS UNIFICADOS
   ==========================================
   Archivo CSS consolidado para todos los 
   estilos de la aplicación
   ==========================================
*/

/* ===== BASE IMPORTS ===== */
/* COMENTADO: Se carga directamente en HTML con cache busting */
/* @import url('styles.css'); */

/* ===== OPTIMIZACIONES MÓVILES ===== */

/* Detectar dispositivos de gama baja */
@media (max-resolution: 120dpi) and (max-width: 768px) {
  * {
    animation-duration: 0.2s !important;
    transition-duration: 0.2s !important;
  }
  
  .hero-content, .product-card, .section-title {
    animation: none !important;
  }
}

/* Optimizaciones para móviles */
@media (max-width: 768px) {
  /* Header móvil mejorado */
  .topbar {
    padding: 8px 16px;
    position: sticky;
    top: 0;
    z-index: 1000;
  }

  .topbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .logo {
    font-size: 20px;
    font-weight: bold;
  }

  /* Navegación móvil */
  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    flex-direction: column;
    padding: 16px;
  }

  .nav.open {
    display: flex;
  }

  .nav a {
    padding: 12px 0;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: #333;
  }

  /* Burger menu */
  .burger {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    padding: 8px;
  }

  .burger span {
    width: 20px;
    height: 2px;
    background: #333;
    margin: 2px 0;
    transition: 0.3s;
  }

  /* Hero section móvil */
  .hero {
    padding: 40px 20px;
    text-align: center;
  }

  .hero-content h1 {
    font-size: 2rem;
    margin-bottom: 16px;
  }

  .hero-content .subtitle {
    font-size: 1.1rem;
    margin-bottom: 24px;
  }

  /* Productos grid móvil */
  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    padding: 0 16px;
  }

  .product-card {
    margin-bottom: 16px;
  }

  /* Campos de formulario móvil */
  .form-group {
    margin-bottom: 20px;
  }

  .form-control {
    padding: 14px 16px;
    font-size: 16px; /* Evita zoom en iOS */
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
  }
}

/* ===== MENÚ DE USUARIO ===== */

.user-menu-container {
    position: relative;
    display: inline-block;
    margin-left: 16px;
    z-index: 100001;
}

.login-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.login-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #667eea;
    font-weight: bold;
    font-size: 14px;
}

.user-dropdown {
    position: fixed;
    top: 60px;
    right: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid #e1e5e9;
    min-width: 220px;
    z-index: 100001;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-info {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f2ff 100%);
    border-radius: 12px 12px 0 0;
}

.user-name {
    font-weight: 600;
    color: #333;
    margin: 0 0 4px 0;
    font-size: 15px;
}

.user-email {
    color: #666;
    font-size: 13px;
    margin: 0;
}

.dropdown-menu {
    list-style: none;
    margin: 0;
    padding: 8px 0;
}

.dropdown-item {
    margin: 0;
}

.dropdown-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #555;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
}

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

.dropdown-icon {
    font-size: 16px;
    width: 16px;
    text-align: center;
}

.dropdown-divider {
    height: 1px;
    background: #e9ecef;
    margin: 8px 0;
}

.logout-link {
    color: #dc3545 !important;
}

.logout-link:hover {
    background: #fff5f5 !important;
}

/* ===== RESPONSIVE MÓVIL MENU USUARIO ===== */
@media (max-width: 768px) {
    .user-menu-container {
        margin-left: 8px;
    }
    
    .login-link {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .user-avatar {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .user-dropdown {
        position: fixed !important;
        top: 70px !important;
        right: 10px !important;
        left: 10px !important;
        min-width: auto !important;
        max-width: calc(100vw - 20px) !important;
        margin: 0 auto;
    }
    
    .user-info {
        padding: 12px 16px;
    }
    
    .dropdown-link {
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* ===== MODAL FIXES ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.show .modal-content {
    transform: scale(1);
}

@media (max-width: 768px) {
    .modal-content {
        margin: 20px;
        width: calc(100% - 40px);
    }
}

/* ===== LOGIN/REGISTER FORMS ===== */
.auth-form {
    padding: 32px;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-title {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
}

.auth-subtitle {
    color: #666;
    font-size: 14px;
    margin: 0;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn {
    width: 100%;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ===== MENSAJES Y ALERTAS ===== */
.message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ===== UTILIDADES ===== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.m-0 { margin: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }

.p-0 { padding: 0; }
.p-1 { padding: 8px; }
.p-2 { padding: 16px; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }

.justify-center { justify-content: center; }
.align-center { align-items: center; }

/* ===== ANIMACIONES ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.fade-in { animation: fadeIn 0.6s ease-out; }
.slide-in { animation: slideIn 0.4s ease-out; }
.pulse { animation: pulse 2s infinite; }

/* Desactivar animaciones en dispositivos lentos */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}