/**
 * ============================================================================
 * PLANTILLA BASE - ESTILOS COMUNES PARA TODAS LAS PLANTILLAS
 * ============================================================================
 * 
 * @descripcion: Archivo CSS base que contiene estilos comunes compartidos 
 *               por todas las plantillas del menú digital.
 * 
 * @uso: Importar al inicio de cada plantilla específica:
 *       @import url('plantilla-base.css');
 * 
 * @version: 1.0.0
 * @fecha: 2026-03-05
 * @autor: Azkintun Menu System
 * 
 * ============================================================================
 * CONTENIDO:
 * 1. Variables CSS Globales
 * 2. Reset y Normalización
 * 3. Botón Flotante de Favoritos
 * 4. Clases de Utilidad Reutilizables
 * 5. Estados de Visibilidad
 * 6. Animaciones Comunes
 * ============================================================================
 */

/* ============================================================================
   1. VARIABLES CSS GLOBALES
   ============================================================================
   Estas variables se usan como fallback cuando las plantillas no definen
   sus propias variables. Pueden ser sobreescritas por cada plantilla.
   ============================================================================ */

:root {
    /* Colores base - Pueden ser sobrescritos por cada plantilla */
    --color-primary: #007bff;
    --color-secondary: #6c757d;
    --color-success: #28a745;
    --color-danger: #dc3545;
    --color-warning: #ffc107;
    --color-info: #17a2b8;
    
    --color-background: #ffffff;
    --color-text: #212529;
    --color-text-muted: #6c757d;
    --color-border: #dee2e6;
    
    /* Espaciado base */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-xxl: 3rem;
    
    /* Sombras base */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.18);
    
    /* Transiciones base */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Z-index layers */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
}

/* ============================================================================
   2. RESET Y NORMALIZACIÓN BÁSICA
   ============================================================================
   Reset mínimo para asegurar consistencia entre navegadores.
   Las plantillas pueden agregar sus propios resets adicionales.
   ============================================================================ */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* ============================================================================
   3. BOTÓN FLOTANTE DE FAVORITOS
   ============================================================================
   Botón fijo en la esquina inferior derecha que muestra el contador de
   favoritos. Visible en todas las plantillas por defecto.
   
   PERSONALIZACIÓN POR PLANTILLA:
   - Cambiar colores: Sobrescribir --color-primary
   - Ocultar: .plantilla-X .floating-fav-btn { display: none !important; }
   - Cambiar posición: Sobrescribir bottom/right
   ============================================================================ */

.floating-fav-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    background: var(--color-primary, #007bff);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: var(--z-fixed, 1030);
    transition: transform var(--transition-base, 0.3s ease);
}

.floating-fav-btn:hover {
    transform: scale(1.1);
}

.floating-fav-btn:active {
    transform: scale(0.95);
}

.floating-fav-btn i {
    color: white;
    font-size: 1.5rem;
    transition: transform var(--transition-fast, 0.15s ease);
}

.floating-fav-btn:hover i {
    animation: heartBeat 0.5s ease;
}

#fav-count {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 24px;
    height: 24px;
    background: var(--color-danger, #dc3545);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 2px solid white;
}

/* Animación del corazón */
@keyframes heartBeat {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.3);
    }
    50% {
        transform: scale(1.1);
    }
    75% {
        transform: scale(1.25);
    }
}

/* ============================================================================
   4. CLASES DE UTILIDAD REUTILIZABLES
   ============================================================================
   Clases helper que pueden usarse desde JavaScript para manipular la UI
   sin necesidad de estilos inline.
   
   USO EN JAVASCRIPT:
   element.classList.add('d-none');        // Ocultar
   element.classList.remove('d-none');     // Mostrar
   element.classList.add('fade-in');       // Animar entrada
   ============================================================================ */

/* DISPLAY */
.d-none {
    display: none !important;
}

.d-block {
    display: block !important;
}

.d-inline {
    display: inline !important;
}

.d-inline-block {
    display: inline-block !important;
}

.d-flex {
    display: flex !important;
}

.d-grid {
    display: grid !important;
}

/* VISIBILITY */
.visible {
    visibility: visible !important;
    opacity: 1 !important;
}

.invisible {
    visibility: hidden !important;
    opacity: 0 !important;
}

/* OPACITY */
.opacity-0 {
    opacity: 0 !important;
}

.opacity-25 {
    opacity: 0.25 !important;
}

.opacity-50 {
    opacity: 0.5 !important;
}

.opacity-75 {
    opacity: 0.75 !important;
}

.opacity-100 {
    opacity: 1 !important;
}

/* TRANSFORM */
.scale-0 {
    transform: scale(0) !important;
}

.scale-50 {
    transform: scale(0.5) !important;
}

.scale-100 {
    transform: scale(1) !important;
}

.scale-110 {
    transform: scale(1.1) !important;
}

.scale-125 {
    transform: scale(1.25) !important;
}

.rotate-0 {
    transform: rotate(0deg) !important;
}

.rotate-45 {
    transform: rotate(45deg) !important;
}

.rotate-90 {
    transform: rotate(90deg) !important;
}

.rotate-180 {
    transform: rotate(180deg) !important;
}

/* POINTER EVENTS */
.pointer-events-none {
    pointer-events: none !important;
}

.pointer-events-auto {
    pointer-events: auto !important;
}

/* CURSOR */
.cursor-pointer {
    cursor: pointer !important;
}

.cursor-not-allowed {
    cursor: not-allowed !important;
}

.cursor-wait {
    cursor: wait !important;
}

/* OVERFLOW */
.overflow-hidden {
    overflow: hidden !important;
}

.overflow-auto {
    overflow: auto !important;
}

.overflow-scroll {
    overflow: scroll !important;
}

/* POSITION */
.position-relative {
    position: relative !important;
}

.position-absolute {
    position: absolute !important;
}

.position-fixed {
    position: fixed !important;
}

.position-sticky {
    position: sticky !important;
}

/* TEXT ALIGNMENT */
.text-left {
    text-align: left !important;
}

.text-center {
    text-align: center !important;
}

.text-right {
    text-align: right !important;
}

/* ============================================================================
   5. ESTADOS DE VISIBILIDAD Y CARGA
   ============================================================================
   Estados comunes para elementos que se muestran/ocultan dinámicamente
   desde JavaScript.
   ============================================================================ */

/* Estado de carga */
.loading {
    pointer-events: none;
    opacity: 0.6;
    cursor: wait;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--color-primary, #007bff);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Estado deshabilitado */
.disabled,
[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Estado activo */
.active {
    /* Las plantillas deben definir sus propios estilos activos */
}

/* ============================================================================
   6. ANIMACIONES COMUNES
   ============================================================================
   Animaciones reutilizables que pueden aplicarse a cualquier elemento.
   
   USO:
   <div class="fade-in">Contenido</div>
   <div class="slide-in-left">Contenido</div>
   ============================================================================ */

/* Fade In */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Fade Out */
.fade-out {
    animation: fadeOut 0.5s ease-out;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Slide In Left */
.slide-in-left {
    animation: slideInLeft 0.5s ease-out;
}

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

/* Slide In Right */
.slide-in-right {
    animation: slideInRight 0.5s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Slide In Up */
.slide-in-up {
    animation: slideInUp 0.5s ease-out;
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Slide In Down */
.slide-in-down {
    animation: slideInDown 0.5s ease-out;
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Zoom In */
.zoom-in {
    animation: zoomIn 0.5s ease-out;
}

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

/* Zoom Out */
.zoom-out {
    animation: zoomOut 0.5s ease-out;
}

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

/* Pulse */
.pulse {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Shake */
.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-10px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(10px);
    }
}

/* Bounce */
.bounce {
    animation: bounce 1s ease-in-out;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* ============================================================================
   7. RESPONSIVE UTILITIES
   ============================================================================
   Clases helper para mostrar/ocultar elementos según el tamaño de pantalla
   ============================================================================ */

/* Ocultar en móvil (< 768px) */
@media (max-width: 767px) {
    .d-sm-none {
        display: none !important;
    }
}

/* Ocultar en tablet (< 1024px) */
@media (max-width: 1023px) {
    .d-md-none {
        display: none !important;
    }
}

/* Ocultar en desktop (< 1280px) */
@media (max-width: 1279px) {
    .d-lg-none {
        display: none !important;
    }
}

/* Mostrar solo en móvil */
@media (min-width: 768px) {
    .d-sm-only {
        display: none !important;
    }
}

/* Mostrar solo en tablet */
@media (max-width: 767px),
(min-width: 1024px) {
    .d-md-only {
        display: none !important;
    }
}

/* Mostrar solo en desktop */
@media (max-width: 1023px) {
    .d-lg-only {
        display: none !important;
    }
}

/* ============================================================================
   FIN DEL ARCHIVO BASE
   ============================================================================
   
   NOTAS IMPORTANTES:
   
   1. Este archivo debe importarse al inicio de cada plantilla específica
   2. Todas las variables pueden ser sobrescritas por la plantilla
   3. Las clases de utilidad están diseñadas para uso con JavaScript
   4. Las animaciones son opt-in (agregar clase manualmente)
   5. El botón flotante de favoritos se puede ocultar por plantilla
   
   EJEMPLO DE USO EN PLANTILLA:
   
   @import url('plantilla-base.css');
   
   .plantilla-1 {
       --color-primary: #d4af37;  // Sobrescribe el azul por defecto
   }
   
   .plantilla-1 .floating-fav-btn {
       background: var(--color-primary);  // Usa el color de la plantilla
   }
   
   ============================================================================ */

/* ============================================================================
   PRODUCTOS CON VARIANTES: "Desde $X" + botón "Elegir" (2026-11-25)
   ============================================================================
   renderProductoCard() los agrega a la tarjeta de los productos con
   combinaciones. Ocultos por defecto para que ninguna plantilla cambie;
   la plantilla Azkintun (azkintun.css, .plantilla-16) los muestra y oculta
   los radio buttons de la tarjeta.
   ============================================================================ */
.producto-precio-desde,
.btn-elegir-opciones {
    display: none !important;
}
