/* ===========================
   VARIABLES Y UTILIDADES GLOBALES
   =========================== */
:root {
    /* Colores Primarios */
    --color-primary: #2366a2;
    --color-primary-dark: #0d3880;
    --color-primary-light: #1a5a9e;
    
    /* Colores Secundarios */
    --color-secondary: #3b82f6;
    --color-secondary-dark: #1e293b;
    --color-secondary-light: #f1f5f9;
    
    /* Colores de Estado */
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #3b82f6;
    
    /* Colores de Fondo */
    --bg-primary: #ffffff;
    --bg-secondary: #f3f6fa;
    --bg-tertiary: #f5f5f5;
    --bg-dark: #1e293b;
    
    /* Colores de Texto */
    --text-primary: #333333;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --text-white: #ffffff;
    
    /* Bordes */
    --border-color: #dddddd;
    --border-light: #e2e8f0;
    --border-dark: #cbd5e1;
    
    /* Espaciado */
    --spacing-xs: 4px;
    --spacing-sm: 6px;
    --spacing-md: 10px;
    --spacing-lg: 14px;
    --spacing-xl: 20px;
    --spacing-2xl: 32px;
    
    /* Bordes redondeados */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 14px;
    
    /* Sombras */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 8px 24px rgba(0, 0, 0, 0.2);
    
    /* Transiciones */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;
    
    /* Tamaños de Fuente */
    --font-xs: 0.75rem;
    --font-sm: 0.875rem;
    --font-base: 1rem;
    --font-lg: 1.125rem;
    --font-xl: 1.25rem;
    --font-2xl: 1.5rem;
    --font-3xl: 2rem;
    
    /* Pesos de Fuente */
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    
    /* Anchos Máximos */
    --max-width-sm: 640px;
    --max-width-md: 768px;
    --max-width-lg: 1024px;
    --max-width-xl: 1200px;
    --max-width-content: 1056px;
    
    /* Z-Index */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
}
:root {
    --gradient-primary: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
    --gradient-secondary: linear-gradient(90deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

/* ===========================
   COMPONENTES: SKELETONS Y LOADERS
   =========================== */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-secondary) 25%,
        var(--border-light) 50%,
        var(--bg-secondary) 75%
    );
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeletonLoading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Skeleton para Card de Producto */
.skeleton-product-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
}

.skeleton-image {
    width: 100%;
    height: 200px;
    margin-bottom: var(--spacing-md);
}

.skeleton-title {
    height: 24px;
    width: 80%;
    margin-bottom: var(--spacing-sm);
}

.skeleton-text {
    height: 16px;
    width: 100%;
    margin-bottom: var(--spacing-xs);
}

.skeleton-text-short {
    height: 16px;
    width: 60%;
    margin-bottom: var(--spacing-sm);
}

.skeleton-price {
    height: 32px;
    width: 120px;
    margin-bottom: var(--spacing-md);
}

.skeleton-button {
    height: 40px;
    width: 100%;
}

/* Skeleton para Lista */
.skeleton-list-item {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-light);
}

.skeleton-avatar {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.skeleton-list-content {
    flex: 1;
}

/* Skeleton para Header */
.skeleton-header {
    height: 60px;
    width: 100%;
    margin-bottom: var(--spacing-md);
}

/* Grid de Skeleton Cards */
.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-lg);
    padding: var(--spacing-lg) 0;
}

/* Skeleton para Tabla */
.skeleton-table {
    width: 100%;
}

.skeleton-table-row {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--border-light);
}

.skeleton-table-cell {
    height: 20px;
    flex: 1;
}

/* Shimmer effect alternativo */
.skeleton-shimmer {
    position: relative;
    overflow: hidden;
}

.skeleton-shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.3) 20%,
        rgba(255, 255, 255, 0.5) 60%,
        rgba(255, 255, 255, 0)
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

/* ===========================
   COMPONENTES: HEADER Y NAVEGACIÓN
   =========================== */

/* Sticky Header */
.header-sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-sticky);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.header-sticky.active {
    transform: translateY(0);
}

.header-sticky .nav-bar {
    padding: var(--spacing-sm) 0;
}

.header-sticky .nav-links a {
    padding: var(--spacing-sm) var(--spacing-md);
}

/* ===========================
   COMPONENTES: CARRITO Y CHECKOUT
   =========================== */

/* Carrito Flotante */
.floating-cart {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: var(--z-fixed);
    background: var(--gradient-primary);
    color: var(--text-white);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-xl);
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: var(--font-2xl);
}

.floating-cart:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 24px rgba(13, 56, 128, 0.4);
}

.floating-cart .badge-count {
    top: -5px;
    right: -5px;
}

/* Mini Carrito Expandido */
.floating-cart-dropdown {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    max-height: 500px;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: var(--z-fixed);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideInUp 0.3s ease;
}

.floating-cart-dropdown.active {
    display: flex;
}

.floating-cart-header {
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.floating-cart-title {
    font-weight: var(--font-bold);
    font-size: var(--font-lg);
    color: var(--text-primary);
}

.floating-cart-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
}

.floating-cart-item {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-light);
}

.floating-cart-item-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.floating-cart-item-info {
    flex: 1;
}

.floating-cart-item-name {
    font-size: var(--font-sm);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.floating-cart-item-price {
    font-size: var(--font-base);
    color: var(--color-primary);
    font-weight: var(--font-bold);
}

.floating-cart-item-qty {
    font-size: var(--font-sm);
    color: var(--text-secondary);
}

.floating-cart-footer {
    padding: var(--spacing-lg);
    border-top: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

.floating-cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    font-size: var(--font-lg);
    font-weight: var(--font-bold);
}

.floating-cart-total-amount {
    color: var(--color-primary);
    font-size: var(--font-2xl);
}

.floating-cart-actions {
    display: flex;
    gap: var(--spacing-sm);
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: var(--z-fixed);
    background: var(--color-primary);
    color: var(--text-white);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-base);
    font-size: var(--font-xl);
}

.back-to-top.visible {
    display: flex;
}

.back-to-top:hover {
    background: var(--color-primary-dark);
    transform: translateY(-4px);
}

/* Animaciones */
@keyframes slideInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .floating-cart {
        bottom: 80px;
    }
    
    .floating-cart-dropdown {
        bottom: 150px;
        right: 10px;
        left: 10px;
        width: auto;
    }
    
    .back-to-top {
        bottom: 80px;
    }
}

/* ===========================
   COMPONENTES: TOAST Y NOTIFICACIONES
   =========================== */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: var(--z-tooltip);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    max-width: 400px;
}

.toast {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    min-width: 300px;
    animation: slideInRight 0.3s ease;
    position: relative;
    border-left: 4px solid var(--color-primary);
}

.toast.success {
    border-left-color: var(--color-success);
}

.toast.error {
    border-left-color: var(--color-danger);
}

.toast.warning {
    border-left-color: var(--color-warning);
}

.toast.info {
    border-left-color: var(--color-info);
}

.toast-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    font-size: var(--font-xl);
}

.toast.success .toast-icon { color: var(--color-success); }
.toast.error .toast-icon { color: var(--color-danger); }
.toast.warning .toast-icon { color: var(--color-warning); }
.toast.info .toast-icon { color: var(--color-info); }

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: var(--font-semibold);
    font-size: var(--font-base);
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.toast-message {
    font-size: var(--font-sm);
    color: var(--text-secondary);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: var(--font-xl);
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast);
}

.toast-close:hover {
    color: var(--text-primary);
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    animation: progressBar 3s linear;
}

.toast.success .toast-progress { background: var(--color-success); }
.toast.error .toast-progress { background: var(--color-danger); }
.toast.warning .toast-progress { background: var(--color-warning); }
.toast.info .toast-progress { background: var(--color-info); }

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

@keyframes progressBar {
    from { width: 100%; }
    to { width: 0%; }
}

.toast.removing {
    animation: slideOutRight 0.3s ease forwards;
}

@media (max-width: 480px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .toast {
        min-width: 0;
        width: 100%;
    }
}

/* ===========================
   PÁGINA: WISHLIST
   =========================== */

/* Botón Wishlist en Producto */
.wishlist-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.wishlist-btn:hover {
    background: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.wishlist-icon {
    font-size: 1.4em;
    color: #d1d5db;
    transition: all 0.3s ease;
}

.wishlist-btn.active .wishlist-icon {
    color: #ef4444;
    animation: heartbeat 0.6s ease;
}

.wishlist-btn:hover .wishlist-icon {
    transform: scale(1.15);
}

@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.3);
    }
    50% {
        transform: scale(0.9);
    }
    75% {
        transform: scale(1.2);
    }
}

/* Contador Wishlist en Header */
.wishlist-count-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75em;
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

/* Página de Wishlist */
.wishlist-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 20px;
}

.wishlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.wishlist-header h1 {
    color: var(--color-primary, #2366a2);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.wishlist-count {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: bold;
}

.wishlist-actions {
    display: flex;
    gap: 12px;
}

.btn-share-wishlist {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s;
}

.btn-share-wishlist:hover {
    transform: translateY(-2px);
}

.btn-clear-wishlist {
    background: white;
    color: #ef4444;
    border: 2px solid #ef4444;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-clear-wishlist:hover {
    background: #ef4444;
    color: white;
}

/* Grid de Productos */
.wishlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.wishlist-product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
}

.wishlist-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.wishlist-product-image {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
    background: #f9fafb;
}

.wishlist-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.wishlist-product-card:hover .wishlist-product-image img {
    transform: scale(1.1);
}

.wishlist-product-badges {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wishlist-remove-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    transition: all 0.3s ease;
    opacity: 0;
}

.wishlist-product-card:hover .wishlist-remove-btn {
    opacity: 1;
}

.wishlist-remove-btn:hover {
    background: #dc2626;
    transform: scale(1.15);
}

.wishlist-product-info {
    padding: 20px;
}

.wishlist-product-name {
    font-weight: bold;
    color: #111827;
    margin-bottom: 10px;
    font-size: 1.05em;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.wishlist-product-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.wishlist-product-price {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.wishlist-price-current {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--color-primary, #2366a2);
}

.wishlist-price-old {
    font-size: 1em;
    color: #9ca3af;
    text-decoration: line-through;
}

.wishlist-product-stock {
    font-size: 0.85em;
    margin-bottom: 15px;
}

.stock-available {
    color: #10b981;
    font-weight: 600;
}

.stock-low {
    color: #f59e0b;
    font-weight: 600;
}

.stock-unavailable {
    color: #ef4444;
    font-weight: 600;
}

.wishlist-product-actions {
    display: flex;
    gap: 10px;
}

.btn-add-to-cart-wishlist {
    flex: 1;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-add-to-cart-wishlist:hover {
    transform: translateY(-2px);
}

.btn-add-to-cart-wishlist:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.btn-view-product-wishlist {
    background: white;
    color: var(--color-primary, #2366a2);
    border: 2px solid var(--color-primary, #2366a2);
    padding: 12px;
    border-radius: 8px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-view-product-wishlist:hover {
    background: var(--color-primary, #2366a2);
    color: white;
}

/* Estado Vacío */
.wishlist-empty {
    text-align: center;
    padding: 80px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.wishlist-empty-icon {
    font-size: 5em;
    color: #d1d5db;
    margin-bottom: 20px;
}

.wishlist-empty h2 {
    color: #6b7280;
    margin-bottom: 15px;
}

.wishlist-empty p {
    color: #9ca3af;
    margin-bottom: 30px;
}

.btn-browse-products {
    background: linear-gradient(135deg, var(--color-primary, #2366a2) 0%, #0d3880 100%);
    color: white;
    border: none;
    padding: 14px 30px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-browse-products:hover {
    transform: translateY(-2px);
}

.btn-browse-products:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* Notificación Flotante */
.wishlist-notification {
    position: fixed;
    bottom: 100px;
    right: 20px;
    background: white;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1060;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.wishlist-notification.show {
    transform: translateX(0);
}

.wishlist-notification-icon {
    font-size: 2em;
}

.wishlist-notification-text h4 {
    margin: 0 0 4px 0;
    color: #111827;
    font-size: 0.95em;
}

.wishlist-notification-text p {
    margin: 0;
    color: #6b7280;
    font-size: 0.85em;
}

@media (max-width: 768px) {
    .wishlist-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 16px;
    }

    .wishlist-header {
        flex-direction: column;
        gap: 15px;
    }

    .wishlist-actions {
        width: 100%;
        justify-content: space-between;
    }

    .wishlist-product-image {
        height: 200px;
    }
}

@media (max-width: 640px) {
    .wishlist-grid {
        grid-template-columns: 1fr;
    }

    .wishlist-container {
        padding: 10px;
    }

    .wishlist-notification {
        right: 10px;
        left: 10px;
        bottom: 80px;
    }
}
