/* ============================================================
   globals.css — Design tokens y variables CSS de NutriOS
   Estilo: Flat Design + Vibrant, mobile-first
   Fuentes: Outfit (headings) + Rubik (body)
   ============================================================ */

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

:root {
    /* ── Colores principales ── */
    --color-primary:        #10B981;   /* Verde esmeralda — botones, links activos */
    --color-primary-dark:   #059669;   /* Hover del primary */
    --color-primary-light:  #D1FAE5;   /* Fondos de badges de éxito */
    --color-secondary:      #8B5CF6;   /* Violeta — badges, acentos secundarios */
    --color-secondary-light:#EDE9FE;
    --color-cta:            #F97316;   /* Naranja — acciones críticas */
    --color-cta-dark:       #EA6C0A;

    /* ── Gradiente signature ── */
    --gradient-primary: linear-gradient(135deg, #10B981 0%, #8B5CF6 100%);
    --gradient-hero:    linear-gradient(135deg, #059669 0%, #7C3AED 100%);

    /* ── Fondos y superficies ── */
    --color-bg:          #F8FAF9;   /* Fondo general de la app */
    --color-surface:     #FFFFFF;   /* Cards, panels, modales */
    --color-surface-alt: #F0FDF4;   /* Filas alternas, fondos de sección */

    /* ── Texto ── */
    --color-text:        #0F172A;   /* Texto principal */
    --color-muted:       #64748B;   /* Texto secundario, placeholders */
    --color-disabled:    #94A3B8;

    /* ── Bordes ── */
    --color-border:      #E2E8F0;
    --color-border-focus:#10B981;

    /* ── Estados ── */
    --color-destructive:  #EF4444;
    --color-destructive-light: #FEE2E2;
    --color-warning:      #F59E0B;
    --color-warning-light:#FEF3C7;
    --color-success:      #10B981;   /* Mismo que primary */

    /* ── Tipografía ── */
    --font-heading: 'Outfit', sans-serif;
    --font-body:    'Rubik', sans-serif;

    /* ── Border radius ── */
    --radius-xs:   4px;
    --radius-sm:   8px;    /* inputs, botones */
    --radius-md:   12px;   /* cards */
    --radius-lg:   16px;   /* modales, paneles grandes */
    --radius-full: 9999px; /* badges, pills, avatares */

    /* ── Sombras ── */
    --shadow-card:  0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
    --shadow-modal: 0 20px 60px rgba(0,0,0,0.15);
    --shadow-btn:   0 2px 8px rgba(16,185,129,0.25);
    --shadow-btn-cta: 0 2px 8px rgba(249,115,22,0.30);
    --shadow-sm:    0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);

    /* ── Transiciones ── */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    /* ── Layout ── */
    --sidebar-width:   240px;
    --topbar-height:   64px;
    --content-max:     1280px;
    --content-padding: 24px;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
}

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

h1 { font-size: 2rem;   font-weight: 800; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 600; }
h4 { font-size: 1rem;   font-weight: 600; }

p { margin-bottom: 0; }

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

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

button {
    cursor: pointer;
    font-family: var(--font-body);
    border: none;
    background: none;
}

input, textarea, select {
    font-family: var(--font-body);
    font-size: 1rem;
}

/* ── Toast ── */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--color-text);
    color: #fff;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    white-space: nowrap;
    max-width: calc(100vw - 48px);
}

.toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast--success { background: var(--color-primary); }
.toast--error   { background: var(--color-destructive); }
.toast--warning { background: var(--color-warning); color: var(--color-text); }

/* ── Loading overlay ── */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(4px);
    z-index: 9998;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.loading-text {
    font-family: var(--font-body);
    color: var(--color-muted);
    font-size: 14px;
}

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

/* ── Utilidades comunes ── */
.text-muted    { color: var(--color-muted); }
.text-primary  { color: var(--color-primary); }
.text-danger   { color: var(--color-destructive); }
.text-sm       { font-size: 14px; }
.text-xs       { font-size: 12px; }
.font-bold     { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium   { font-weight: 500; }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
}
