/* ============================================================
   HOGAR FINANZAS — Base Styles (Variables, Reset, Typography)
   ============================================================ */

/* ============================================================
   1. VARIABLES CSS — Design Tokens
   ============================================================ */
:root,
[data-theme="light"] {
    /* Surface — Apple palette */
    --app-bg:              #f5f5f7;
    --app-surface:         #ffffff;
    --app-surface-hover:   #fafafc;
    --app-border:          #e0e0e0;
    --app-border-light:    #f0f0f0;

    /* Text — Apple ink */
    --text-primary:        #1d1d1f;
    --text-secondary:      #333333;
    --text-tertiary:       #7a7a7a;
    --text-inverse:        #ffffff;

    /* Sidebar — estático oscuro premium */
    --sidebar-bg:          #1d1d1f;
    --sidebar-border:      #3a3a3c;
    --sidebar-text:        #98989d;
    --sidebar-text-active: #ffffff;
    --sidebar-bg-active:   rgba(255, 255, 255, 0.1);
    --sidebar-hover:       rgba(255, 255, 255, 0.06);
    --sidebar-width:       260px;
    --sidebar-collapsed:   72px;

    /* Topbar — Frosted parchment */
    --topbar-bg:           rgba(245, 245, 247, 0.8);
    --topbar-border:       #e0e0e0;
    --topbar-height:       52px;

    /* Brand — Action Blue (SINGLE ACCENT) */
    --app-primary:         #0066cc;
    --app-primary-hover:   #0071e3;
    --app-primary-subtle:  rgba(0, 102, 204, 0.08);
    --app-primary-light:   rgba(0, 102, 204, 0.12);
    --app-primary-ring:    rgba(0, 102, 204, 0.25);
    --app-primary-on-dark: #2997ff;

    /* Estados */
    --app-success:         #34c759;
    --app-success-subtle:  rgba(52, 199, 89, 0.1);
    --app-warning:         #ff9500;
    --app-warning-subtle:  rgba(255, 149, 0, 0.1);
    --app-danger:          #ff3b30;
    --app-danger-subtle:   rgba(255, 59, 48, 0.1);

    /* Sombras */
    --shadow-product:      0 3px 30px rgba(0, 0, 0, 0.22);
    --shadow-sm:           0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-card-hover:   0 6px 20px rgba(0, 102, 204, 0.08);

    /* Radios — Apple scale */
    --radius-none:         0px;
    --radius-xs:           5px;
    --radius-sm:           8px;
    --radius-md:           11px;
    --radius-lg:           18px;
    --radius-pill:         9999px;

    /* Transiciones */
    --transition-fast:     150ms ease;
    --transition-base:     200ms ease;
    --transition-slow:     350ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Layout */
    --bottom-nav-height:   64px;

    /* Z-Index Hierarchy */
    --z-bottom-nav:        90;
    --z-topbar:            110;
    --z-overlay:           200;
    --z-sidebar:           205;
    --z-modal:             210;
    --z-fab:               300;
    --z-toast:             9999;
}

[data-theme="dark"] {
    --app-bg:              #000000;
    --app-surface:         #1c1c1e;
    --app-surface-hover:   #2c2c2e;
    --app-border:          #38383a;
    --app-border-light:    #2c2c2e;

    --text-primary:        #ffffff;
    --text-secondary:      #ebebf5;
    --text-tertiary:       #ebebf599;
    --text-inverse:        #ffffff;

    /* Sidebar inherits static dark variables */

    --topbar-bg:           rgba(0, 0, 0, 0.8);
    --topbar-border:       #38383a;

    --app-primary:         #2997ff;
    --app-primary-hover:   #40a9ff;
    --app-primary-subtle:  rgba(41, 151, 255, 0.1);
    --app-primary-light:   rgba(41, 151, 255, 0.15);
    --app-primary-ring:    rgba(41, 151, 255, 0.3);
    --app-primary-on-dark: #2997ff;

    --app-success:         #30d158;
    --app-success-subtle:  rgba(48, 209, 88, 0.1);
    --app-warning:         #ff9f0a;
    --app-warning-subtle:  rgba(255, 159, 10, 0.1);
    --app-danger:          #ff453a;
    --app-danger-subtle:   rgba(255, 69, 58, 0.1);

    --shadow-product:      0 3px 30px rgba(0, 0, 0, 0.5);
    --shadow-sm:           0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-card-hover:   0 6px 20px rgba(0, 102, 204, 0.15);
}

/* ============================================================
   2. RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
    background: var(--app-bg);
    color: var(--text-primary);
    font-size: 17px;
    font-weight: 400;
    line-height: 1.47;
    letter-spacing: -0.374px;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--app-primary); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--app-primary-hover); }
img, svg { max-width: 100%; display: block; }

h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
    font-weight: 600; letter-spacing: -0.28px; color: var(--text-primary);
}

/* ============================================================
   3. TEMA TRANSITION
   ============================================================ */
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
    transition: background-color 350ms ease, color 350ms ease, border-color 350ms ease, box-shadow 350ms ease !important;
}

/* ============================================================
   4. ANIMACIONES GLOBALES
   ============================================================ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.content-body {
    animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes shimmer {
   0% { background-position: 200% 0; }
   100% { background-position: -200% 0; }
}

/* ============================================================
   5. UTILITY CLASSES
   ============================================================ */
.d-none { display: none !important; }
.d-flex { display: flex !important; }
.d-inline { display: inline !important; }
.d-md-none { display: none !important; }
.d-md-flex { display: none !important; }
.d-md-inline { display: none !important; }
.d-md-table-cell { display: none !important; }
.d-md-block { display: none !important; }

.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; } .flex-1 { flex: 1; }
.m-0 { margin: 0 !important; } .p-0 { padding: 0 !important; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; } .me-2 { margin-right: 8px; }
.text-center { text-align: center; }
.text-danger { color: var(--app-danger); }
.text-success { color: var(--app-success); }
.text-primary { color: var(--app-primary); }
.text-secondary { color: var(--text-secondary); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border-width: 0; }

.gradient-text {
  background: linear-gradient(135deg, var(--app-primary), #818cf8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ============================================================
   6. RESPONSIVE UTILITIES
   ============================================================ */
@media (min-width: 834px) {
    .d-md-none { display: none !important; }
    .d-md-flex { display: flex !important; }
    .d-md-inline { display: inline !important; }
    .d-md-table-cell { display: table-cell !important; }
    .d-md-block { display: block !important; }
}

@media (max-width: 640px) {
    .d-md-none { display: block !important; }
    .d-md-flex { display: none !important; }
    .d-md-inline { display: none !important; }
    .d-md-table-cell { display: none !important; }
    .d-md-block { display: none !important; }
}
