/* ============================================================
   EllaSuite 360 — Sistema de Diseño Base
   Mobile-First | CSS Custom Properties | Sin frameworks
   ============================================================ */

/* ── Variables ── */
:root {
    --primary: #db50a5;
    --primary-hover: #c4478f;
    --primary-light: rgba(219, 80, 165, 0.1);
    --primary-rgb: 219, 80, 165;
    --secondary: #d88fed;
    --secondary-hover: #c77de0;
    --secondary-light: rgba(216, 143, 237, 0.1);
    --pink-soft: #F8D4E9;
    --lavender-pale: #EADCF5;
    --accent-warm: #E1C79F;
    --dark: #4A2040;
    --gray-dark: #4A4A4A;
    --gray: #6c757d;
    --gray-light: #F5F5F5;
    --gray-border: #e9ecef;
    --white: #ffffff;
    --light: #FFF0F5;
    --success: #22c55e;
    --success-light: rgba(34, 197, 94, 0.1);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.1);
    --info: #3b82f6;
    --info-light: rgba(59, 130, 246, 0.1);

    --gradient-brand: linear-gradient(135deg, #db50a5 0%, #d88fed 60%, #9c27b0 100%);
    --gradient-soft: linear-gradient(135deg, #FFF0F5 0%, #EADCF5 100%);
    --gradient-card: linear-gradient(135deg, rgba(219,80,165,0.05) 0%, rgba(216,143,237,0.05) 100%);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
    --shadow-pink: 0 4px 16px rgba(219, 80, 165, 0.15);
    --shadow-xl: 0 12px 40px rgba(0, 0, 0, 0.12);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-pill: 999px;

    --font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-brand: 'Poppins', sans-serif;

    --fs-xs: 0.75rem;
    --fs-sm: 0.8125rem;
    --fs-base: 0.9375rem;
    --fs-md: 1rem;
    --fs-lg: 1.125rem;
    --fs-xl: 1.25rem;
    --fs-2xl: 1.5rem;
    --fs-3xl: 2rem;
    --fs-4xl: 2.5rem;

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    --transition: 0.2s ease;
    --transition-slow: 0.3s ease;

    --z-dropdown: 100;
    --z-sticky: 200;
    --z-modal-backdrop: 300;
    --z-modal: 400;
    --z-toast: 500;
    --z-tooltip: 600;

    --bottom-nav-height: 64px;
    --sidebar-width: 260px;
    --sidebar-mini: 72px;
    --topbar-height: 60px;

    /* Safe area (iPhone notch / home indicator) — usado en layouts y POS */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
}

/* ── Reset ── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: var(--fs-base);
    color: var(--gray-dark);
    background: var(--white);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--dark);
    line-height: 1.3;
}

h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
h5 { font-size: var(--fs-md); }
h6 { font-size: var(--fs-sm); }

p { margin-bottom: var(--space-4); }

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover { color: var(--primary-hover); }

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

ul, ol { list-style: none; }

/* ── Utilidades ── */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-dark { color: var(--dark); }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.text-lg { font-size: var(--fs-lg); }
.text-xl { font-size: var(--fs-xl); }
.text-2xl { font-size: var(--fs-2xl); }
.text-bold { font-weight: 600; }
.text-light { font-weight: 400; }
.text-truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bg-light { background: var(--light); }
.bg-white { background: var(--white); }
.bg-gray { background: var(--gray-light); }
.bg-gradient { background: var(--gradient-brand); }

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

.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.m-0 { margin: 0; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.p-0 { padding: 0; }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-8 { padding-top: var(--space-8); padding-bottom: var(--space-8); }

.rounded-sm { border-radius: var(--radius-sm); }
.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-pill { border-radius: var(--radius-pill); }
.rounded-full { border-radius: 50%; }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }

.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

.cursor-pointer { cursor: pointer; }
.select-none { user-select: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ── Grid System ── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }
.grid-2-auto {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
}
@media (min-width: 768px) {
    .grid-2-auto { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1024px) {
    .grid-2-auto { grid-template-columns: repeat(4, 1fr); }
}
.grid-3 { display: grid; grid-template-columns: repeat(1, 1fr); gap: var(--space-4); }
.grid-4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }

/* ── Animaciones ── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

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

.animate-fade-in { animation: fadeIn 0.3s ease forwards; }
.animate-slide-up { animation: slideUp 0.4s ease forwards; }
.animate-scale-in { animation: scaleIn 0.2s ease forwards; }

/* ── Responsive ── */
@media (min-width: 640px) {
    .sm\:d-none { display: none; }
    .sm\:d-flex { display: flex; }
    .sm\:d-block { display: block; }
    .sm\:d-grid { display: grid; }
}

@media (min-width: 768px) {
    :root {
        --fs-base: 1rem;
    }

    .md\:d-none { display: none; }
    .md\:d-flex { display: flex; }
    .md\:d-block { display: block; }
    .md\:d-inline { display: inline; }
    .md\:d-inline-flex { display: inline-flex; }
    .md\:d-grid { display: grid; }
    .md\:flex-row { flex-direction: row; }
    .md\:items-center { align-items: center; }
    .md\:justify-between { justify-content: space-between; }

    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }

    h1 { font-size: var(--fs-4xl); }
}

@media (min-width: 1024px) {
    .lg\:d-none { display: none; }
    .lg\:d-flex { display: flex; }
    .lg\:d-block { display: block; }
    .lg\:d-grid { display: grid; }

    .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1280px) {
    .xl\:d-none { display: none; }
    .xl\:d-flex { display: flex; }
    .xl\:d-block { display: block; }
}

/* ── Brand ── */
.brand-text {
    font-weight: 700;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-name {
    font-family: var(--font-brand);
    font-weight: 700;
    font-size: 1.4rem;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Isotipo + wordmark (assets en public/img/brand/) */
.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: inherit;
}
.brand-link:hover {
    text-decoration: none;
}
.brand-link .brand-mark {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 10px;
}
.brand-link--compact {
    gap: 0.4rem;
}
.brand-link--compact .brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 8px;
}
.brand-link--compact .brand-name {
    font-size: 1.25rem;
}
.brand-link--lg {
    gap: 0.65rem;
}
.brand-link--lg .brand-mark {
    width: 40px;
    height: 40px;
}
.brand-link--lg .brand-name {
    font-size: 2rem;
}
.brand-link--static {
    pointer-events: none;
    cursor: default;
}

/* Wordmark SVG (landing: cabecera / pie) */
.brand-link--wordmark {
    gap: 0;
    line-height: 0;
}
.brand-link--wordmark .brand-wordmark {
    width: auto;
    height: clamp(34px, 5vw, 42px);
    max-width: min(220px, 52vw);
    object-fit: contain;
    object-position: left center;
    display: block;
}
.brand-link--wordmark.brand-link--static .brand-wordmark {
    height: clamp(40px, 5.5vw, 52px);
    max-width: min(260px, 85vw);
}

/* App shell / auth: mismo wordmark, más compacto o más grande */
.brand-link--wordmark.brand-link--compact .brand-wordmark {
    height: clamp(26px, 4vw, 32px);
    max-width: min(168px, 48vw);
}
.brand-link--wordmark.brand-link--lg .brand-wordmark {
    height: clamp(42px, 7vw, 56px);
    max-width: min(300px, 88vw);
}

/* Dashboard — accesos rápidos */
.dashboard-quick-link {
    border: 1px solid var(--gray-border);
    background: var(--white);
    color: inherit;
    transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.dashboard-quick-link:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(219, 80, 165, 0.35);
    transform: translateY(-1px);
}
.dashboard-quick-link:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.dashboard-quick-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

/* Dashboard — variación vs ayer (tarjeta Ventas hoy) */
.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.35rem;
    font-size: var(--fs-xs);
    font-weight: 600;
}
.stat-change.up {
    color: var(--success);
}
.stat-change.down {
    color: var(--danger);
}

@media (max-width: 480px) {
    div.card-stat .stat-value {
        font-size: 1.25rem !important;
    }
}
