/* =============================================
   Casa Xu'unan Datos Privados — Sistema de Diseño 2026
   Mobile-first · Toggle dark/light · Profesional
   ============================================= */

/* ===== Variables de tema ===== */
:root {
    /* Brand */
    --brand-primary: #7baf89;
    --brand-primary-hover: #6a9d77;
    --brand-accent: #ea8f71;
    --brand-success: #10b981;
    --brand-warning: #f59e0b;
    --brand-danger: #ef4444;
    --brand-info: #3b82f6;

    /* Tipografía */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', monospace;

    /* Spacing escala */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;
    --space-20: 80px;

    /* Radios */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
    --shadow-xl: 0 20px 60px rgba(0,0,0,0.18);

    /* Transitions */
    --t-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Tema oscuro (default) ===== */
:root,
[data-theme="dark"] {
    --bg-primary: #0a0e13;
    --bg-secondary: #0f1419;
    --bg-tertiary: #161c22;
    --bg-elevated: #1a2129;
    --bg-card: #14191e;
    --bg-input: #1a2129;
    --bg-hover: #1f262e;

    --text-primary: #e6edf3;
    --text-secondary: #9ca3af;
    --text-tertiary: #6b7280;
    --text-inverse: #0a0e13;

    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.18);

    --status-success-bg: rgba(16, 185, 129, 0.12);
    --status-success-text: #34d399;
    --status-warning-bg: rgba(245, 158, 11, 0.12);
    --status-warning-text: #fbbf24;
    --status-danger-bg: rgba(239, 68, 68, 0.12);
    --status-danger-text: #f87171;
    --status-info-bg: rgba(59, 130, 246, 0.12);
    --status-info-text: #60a5fa;

    --chart-grid: rgba(255, 255, 255, 0.06);
    --chart-text: #9ca3af;
}

/* ===== Tema claro ===== */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f7f8fa;
    --bg-tertiary: #eef0f4;
    --bg-elevated: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --bg-hover: #f0f2f5;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --text-inverse: #ffffff;

    --border-subtle: rgba(15, 23, 42, 0.06);
    --border-default: rgba(15, 23, 42, 0.1);
    --border-strong: rgba(15, 23, 42, 0.16);

    --status-success-bg: rgba(16, 185, 129, 0.1);
    --status-success-text: #047857;
    --status-warning-bg: rgba(245, 158, 11, 0.1);
    --status-warning-text: #b45309;
    --status-danger-bg: rgba(239, 68, 68, 0.1);
    --status-danger-text: #b91c1c;
    --status-info-bg: rgba(59, 130, 246, 0.1);
    --status-info-text: #1d4ed8;

    --chart-grid: rgba(15, 23, 42, 0.06);
    --chart-text: #475569;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.08);
    --shadow-xl: 0 20px 60px rgba(15, 23, 42, 0.12);
}

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

html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 16px;
    transition: background var(--t-normal), color var(--t-normal);
    min-height: 100vh;
}

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

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

input, select, textarea {
    font-family: inherit;
    color: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ===== Container ===== */
.container {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

@media (min-width: 768px) {
    .container { padding: 0 var(--space-6); }
}

@media (min-width: 1024px) {
    .container { padding: 0 var(--space-8); }
}

/* ===== Tipografía ===== */
h1, h2, h3, h4 {
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }

@media (min-width: 768px) {
    h1 { font-size: 2.25rem; }
    h2 { font-size: 1.875rem; }
    h3 { font-size: 1.5rem; }
}

@media (min-width: 1024px) {
    h1 { font-size: 2.75rem; }
    h2 { font-size: 2rem; }
}

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }

.text-muted { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

/* ===== Status badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1;
}

.badge-success {
    background: var(--status-success-bg);
    color: var(--status-success-text);
}

.badge-warning {
    background: var(--status-warning-bg);
    color: var(--status-warning-text);
}

.badge-danger {
    background: var(--status-danger-bg);
    color: var(--status-danger-text);
}

.badge-info {
    background: var(--status-info-bg);
    color: var(--status-info-text);
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    transition: border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}

.card:hover {
    border-color: var(--border-default);
    box-shadow: var(--shadow-md);
}

@media (min-width: 768px) {
    .card { padding: var(--space-6); }
}

/* ===== Botones ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    transition: all var(--t-fast);
    border: 1px solid transparent;
    white-space: nowrap;
}

.btn-primary {
    background: var(--brand-primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--brand-primary-hover);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border-default);
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ===== Utilidades flex/grid ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.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); }

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

@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ===== Espaciados ===== */
.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-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); }

/* ===== Animaciones ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

.fade-in {
    animation: fadeIn var(--t-slow) ease;
}

.fade-in-up {
    animation: fadeInUp 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reveal on scroll */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease, transform 600ms ease;
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Respeta motion reduce */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    .reveal {
        opacity: 1;
        transform: none;
    }
}

/* ===== Scrollbar custom ===== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* ===== Print friendly ===== */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    .no-print { display: none !important; }
}
