/* ================================================================
   MT24 Design System — Base
   MiTienda24 Ecommerce Platform
   ================================================================ */

/* ── CSS Custom Properties (Theme Engine) ─────────────────────── */
:root {
    /* Brand colors — overridden per tenant from admin */
    --mt24-primary: #3B82F6;
    --mt24-primary-hover: #2563EB;
    --mt24-primary-light: #EFF6FF;
    --mt24-primary-rgb: 59, 130, 246;
    --mt24-secondary: #10B981;
    --mt24-secondary-hover: #059669;

    /* Semantic colors */
    --mt24-success: #10B981;
    --mt24-danger: #EF4444;
    --mt24-warning: #F59E0B;
    --mt24-info: #3B82F6;

    /* Text */
    --mt24-text: #1F2937;
    --mt24-text-secondary: #4B5563;
    --mt24-text-muted: #9CA3AF;
    --mt24-text-inverse: #FFFFFF;

    /* Backgrounds */
    --mt24-bg: #FFFFFF;
    --mt24-bg-soft: #F9FAFB;
    --mt24-bg-muted: #F3F4F6;
    --mt24-bg-dark: #111827;
    --mt24-bg-overlay: rgba(0, 0, 0, 0.5);

    /* Borders */
    --mt24-border: #E5E7EB;
    --mt24-border-light: #F3F4F6;
    --mt24-border-dark: #D1D5DB;

    /* Typography — overridden per visual theme */
    --mt24-font-heading: 'Inter', system-ui, -apple-system, sans-serif;
    --mt24-font-body: 'Inter', system-ui, -apple-system, sans-serif;
    --mt24-font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --mt24-font-size-xs: 0.75rem;    /* 12px */
    --mt24-font-size-sm: 0.8125rem;  /* 13px */
    --mt24-font-size-base: 0.9375rem;/* 15px */
    --mt24-font-size-lg: 1.125rem;   /* 18px */
    --mt24-font-size-xl: 1.25rem;    /* 20px */
    --mt24-font-size-2xl: 1.5rem;    /* 24px */
    --mt24-font-size-3xl: 1.875rem;  /* 30px */
    --mt24-font-size-4xl: 2.25rem;   /* 36px */
    --mt24-line-height: 1.6;
    --mt24-letter-spacing: -0.01em;

    /* Spacing scale */
    --mt24-space-xs: 4px;
    --mt24-space-sm: 8px;
    --mt24-space-md: 16px;
    --mt24-space-lg: 24px;
    --mt24-space-xl: 32px;
    --mt24-space-2xl: 48px;
    --mt24-space-3xl: 64px;
    --mt24-space-section: 80px;

    /* Shapes — overridden per visual theme */
    --mt24-radius-sm: 4px;
    --mt24-radius: 8px;
    --mt24-radius-lg: 12px;
    --mt24-radius-xl: 16px;
    --mt24-radius-full: 9999px;

    /* Shadows — overridden per visual theme */
    --mt24-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --mt24-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --mt24-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --mt24-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --mt24-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Transitions */
    --mt24-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --mt24-ease-in: cubic-bezier(0.4, 0, 1, 1);
    --mt24-ease-out: cubic-bezier(0, 0, 0.2, 1);
    --mt24-ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --mt24-duration-fast: 150ms;
    --mt24-duration: 250ms;
    --mt24-duration-slow: 400ms;

    /* Layout */
    --mt24-header-height: 72px;
    --mt24-header-bg: var(--mt24-bg);
    --mt24-footer-bg: var(--mt24-bg-dark);
    --mt24-footer-text: #D1D5DB;
    --mt24-container-max: 1320px;
    --mt24-sidebar-width: 280px;

    /* Z-index scale */
    --mt24-z-dropdown: 100;
    --mt24-z-sticky: 200;
    --mt24-z-fixed: 300;
    --mt24-z-offcanvas: 400;
    --mt24-z-modal: 500;
    --mt24-z-toast: 600;
}

/* ── Alpine.js cloak (hide x-show elements before init) ──────── */
[x-cloak] { display: none !important; }

/* ── Reset enhancements (on top of Bootstrap) ─────────────────── */
*, *::before, *::after {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--mt24-font-body);
    font-size: var(--mt24-font-size-base);
    line-height: var(--mt24-line-height);
    color: var(--mt24-text);
    background-color: var(--mt24-bg);
    letter-spacing: var(--mt24-letter-spacing);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--mt24-font-heading);
    font-weight: 700;
    line-height: 1.3;
    color: var(--mt24-text);
}

a {
    color: var(--mt24-primary);
    text-decoration: none;
    transition: color var(--mt24-duration-fast) var(--mt24-ease);
}
a:hover { color: var(--mt24-primary-hover); }

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

/* Focus visible for accessibility */
:focus-visible {
    outline: 2px solid var(--mt24-primary);
    outline-offset: 2px;
}

/* Selection */
::selection {
    background: var(--mt24-primary);
    color: white;
}

/* Scrollbar (subtle) */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--mt24-border-dark); border-radius: var(--mt24-radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--mt24-text-muted); }

/* ── Typography utilities ─────────────────────────────────────── */
.mt24-heading-xl { font-size: var(--mt24-font-size-4xl); letter-spacing: -0.02em; }
.mt24-heading-lg { font-size: var(--mt24-font-size-3xl); letter-spacing: -0.02em; }
.mt24-heading-md { font-size: var(--mt24-font-size-2xl); }
.mt24-heading-sm { font-size: var(--mt24-font-size-xl); }
.mt24-text-lg { font-size: var(--mt24-font-size-lg); }
.mt24-text-sm { font-size: var(--mt24-font-size-sm); }
.mt24-text-xs { font-size: var(--mt24-font-size-xs); }
.mt24-text-muted { color: var(--mt24-text-muted) !important; }
.mt24-text-secondary { color: var(--mt24-text-secondary) !important; }
.mt24-text-primary { color: var(--mt24-primary) !important; }
.mt24-text-success { color: var(--mt24-success) !important; }
.mt24-text-danger { color: var(--mt24-danger) !important; }
.mt24-text-clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.mt24-text-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mt24-text-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ── Color utilities ──────────────────────────────────────────── */
.mt24-bg-primary { background-color: var(--mt24-primary) !important; }
.mt24-bg-primary-light { background-color: var(--mt24-primary-light) !important; }
.mt24-bg-soft { background-color: var(--mt24-bg-soft) !important; }
.mt24-bg-muted { background-color: var(--mt24-bg-muted) !important; }
.mt24-bg-dark { background-color: var(--mt24-bg-dark) !important; }

/* ── Spacing section utility ──────────────────────────────────── */
.mt24-section { padding: var(--mt24-space-section) 0; }
.mt24-section-sm { padding: var(--mt24-space-2xl) 0; }

/* ── Shape utilities ──────────────────────────────────────────── */
.mt24-rounded { border-radius: var(--mt24-radius) !important; }
.mt24-rounded-lg { border-radius: var(--mt24-radius-lg) !important; }
.mt24-rounded-xl { border-radius: var(--mt24-radius-xl) !important; }
.mt24-shadow { box-shadow: var(--mt24-shadow) !important; }
.mt24-shadow-md { box-shadow: var(--mt24-shadow-md) !important; }
.mt24-shadow-lg { box-shadow: var(--mt24-shadow-lg) !important; }

/* ── Button base (extends Bootstrap) ──────────────────────────── */
.mt24-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    font-size: var(--mt24-font-size-sm);
    padding: 10px 20px;
    border-radius: var(--mt24-radius);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--mt24-duration) var(--mt24-ease);
    text-decoration: none;
    line-height: 1.4;
}
.mt24-btn:active { transform: scale(0.97); }

.mt24-btn--primary {
    background: var(--mt24-primary);
    color: white;
    border-color: var(--mt24-primary);
}
.mt24-btn--primary:hover {
    background: var(--mt24-primary-hover);
    border-color: var(--mt24-primary-hover);
    color: white;
    box-shadow: 0 4px 12px rgba(var(--mt24-primary-rgb), 0.3);
}

.mt24-btn--outline {
    background: transparent;
    color: var(--mt24-primary);
    border-color: var(--mt24-primary);
}
.mt24-btn--outline:hover {
    background: var(--mt24-primary);
    color: white;
}

.mt24-btn--ghost {
    background: transparent;
    color: var(--mt24-text);
    border-color: transparent;
}
.mt24-btn--ghost:hover {
    background: var(--mt24-bg-muted);
}

.mt24-btn--secondary {
    background: var(--mt24-secondary);
    color: white;
    border-color: var(--mt24-secondary);
}
.mt24-btn--secondary:hover {
    background: var(--mt24-secondary-hover);
    border-color: var(--mt24-secondary-hover);
    color: white;
}

.mt24-btn--light {
    background: rgba(255,255,255,0.9);
    color: var(--mt24-text);
    border-color: rgba(255,255,255,0.9);
}
.mt24-btn--light:hover {
    background: #ffffff;
    border-color: #ffffff;
    color: var(--mt24-text);
}

.mt24-btn--dark {
    background: var(--mt24-bg-dark);
    color: white;
    border-color: var(--mt24-bg-dark);
}
.mt24-btn--dark:hover {
    background: #000;
    border-color: #000;
    color: white;
}

.mt24-btn--link {
    background: transparent;
    color: var(--mt24-primary);
    border-color: transparent;
    padding-left: 0;
    padding-right: 0;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.mt24-btn--link:hover {
    color: var(--mt24-primary-hover);
    background: transparent;
    text-decoration: underline;
}

.mt24-btn--sm { padding: 6px 14px; font-size: var(--mt24-font-size-xs); }
.mt24-btn--lg { padding: 14px 28px; font-size: var(--mt24-font-size-base); }
.mt24-btn--icon {
    width: 40px; height: 40px; padding: 0;
    border-radius: var(--mt24-radius-full);
}
.mt24-btn--icon.mt24-btn--sm { width: 32px; height: 32px; }

/* ── Badge ────────────────────────────────────────────────────── */
.mt24-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: var(--mt24-font-size-xs);
    font-weight: 600;
    border-radius: var(--mt24-radius-full);
    line-height: 1.5;
}
.mt24-badge--primary { background: var(--mt24-primary); color: white; }
.mt24-badge--success { background: var(--mt24-success); color: white; }
.mt24-badge--danger { background: var(--mt24-danger); color: white; }
.mt24-badge--warning { background: var(--mt24-warning); color: #1F2937; }
.mt24-badge--muted { background: var(--mt24-bg-muted); color: var(--mt24-text-secondary); }

/* ── Form enhancements ────────────────────────────────────────── */
.mt24-input {
    border: 1px solid var(--mt24-border);
    border-radius: var(--mt24-radius);
    padding: 10px 14px;
    font-size: var(--mt24-font-size-base);
    color: var(--mt24-text);
    background: var(--mt24-bg);
    transition: border-color var(--mt24-duration-fast) var(--mt24-ease), box-shadow var(--mt24-duration-fast) var(--mt24-ease);
    width: 100%;
}
.mt24-input:focus {
    border-color: var(--mt24-primary);
    box-shadow: 0 0 0 3px rgba(var(--mt24-primary-rgb), 0.15);
    outline: none;
}
.mt24-input::placeholder { color: var(--mt24-text-muted); }

/* ── Image utilities ──────────────────────────────────────────── */
.mt24-img-cover { width: 100%; height: 100%; object-fit: cover; }
.mt24-img-contain { width: 100%; height: 100%; object-fit: contain; }
.mt24-aspect-square { aspect-ratio: 1; }
.mt24-aspect-4-3 { aspect-ratio: 4/3; }
.mt24-aspect-16-9 { aspect-ratio: 16/9; }
.mt24-aspect-3-4 { aspect-ratio: 3/4; }

/* ── Price display ────────────────────────────────────────────── */
.mt24-price {
    font-weight: 700;
    color: var(--mt24-text);
    font-size: var(--mt24-font-size-lg);
}
.mt24-price--current { color: var(--mt24-primary); }
.mt24-price--old {
    text-decoration: line-through;
    color: var(--mt24-text-muted);
    font-weight: 400;
    font-size: var(--mt24-font-size-sm);
}
.mt24-price--discount {
    background: var(--mt24-danger);
    color: white;
    font-size: var(--mt24-font-size-xs);
    padding: 2px 6px;
    border-radius: var(--mt24-radius-sm);
    font-weight: 600;
}

/* ── Transition helpers ───────────────────────────────────────── */
.mt24-transition { transition: all var(--mt24-duration) var(--mt24-ease); }
.mt24-hover-up:hover { transform: translateY(-4px); }
.mt24-hover-scale:hover { transform: scale(1.03); }
.mt24-hover-shadow:hover { box-shadow: var(--mt24-shadow-lg); }

/* ── Divider ──────────────────────────────────────────────────── */
.mt24-divider {
    height: 1px;
    background: var(--mt24-border);
    border: none;
    margin: var(--mt24-space-lg) 0;
}

/* ── Swiper pre-init fix — hide slides until initialized ──── */
.swiper:not(.swiper-initialized) .swiper-wrapper {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
}
.swiper.swiper-initialized .swiper-wrapper {
    max-height: none;
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* ── Section header ───────────────────────────────────────────── */
.mt24-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--mt24-space-lg);
    gap: var(--mt24-space-md);
}
.mt24-section-header__title {
    font-size: var(--mt24-font-size-2xl);
    font-weight: 700;
    margin: 0;
}
.mt24-section-header__link {
    font-size: var(--mt24-font-size-sm);
    font-weight: 600;
    color: var(--mt24-primary);
    white-space: nowrap;
}

/* ── Skeleton loading ─────────────────────────────────────────── */
.mt24-skeleton {
    background: linear-gradient(90deg, var(--mt24-bg-muted) 25%, var(--mt24-bg-soft) 50%, var(--mt24-bg-muted) 75%);
    background-size: 200% 100%;
    animation: mt24-shimmer 1.5s infinite;
    border-radius: var(--mt24-radius);
}
@keyframes mt24-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Overlay ──────────────────────────────────────────────────── */
.mt24-overlay {
    position: fixed;
    inset: 0;
    background: var(--mt24-bg-overlay);
    z-index: var(--mt24-z-offcanvas);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--mt24-duration) var(--mt24-ease), visibility var(--mt24-duration) var(--mt24-ease);
}
.mt24-overlay.active { opacity: 1; visibility: visible; }

/* ── Container utility ──────────────────────────────────────── */
.mt24-container {
    max-width: var(--mt24-container-max);
    margin: 0 auto;
    padding: 0 var(--mt24-space-md);
}

/* ── Google Fonts import (Inter) ──────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
