/*
 * ══════════════════════════════════════════════════════════════════════
 * ERP-UTILS.CSS  —  COOPAC Quinuapata
 * Helpers, grids, animaciones, utilidades
 * ══════════════════════════════════════════════════════════════════════
 */

/* ── CONTENEDOR ──────────────────────────────────────────────────────── */
.container { max-width: 1600px; margin: 0 auto; }

/* ── GRIDS ───────────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.grid-kpi  { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }

/* ── FLEXBOX HELPERS ─────────────────────────────────────────────────── */
.flex         { display: flex; }
.flex-col     { display: flex; flex-direction: column; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-end     { display: flex; align-items: center; justify-content: flex-end; }
.flex-wrap    { flex-wrap: wrap; }
.gap-xs  { gap: 0.375rem; }
.gap-sm  { gap: 0.625rem; }
.gap-md  { gap: 1rem; }
.gap-lg  { gap: 1.5rem; }
.flex-1  { flex: 1; }

/* ── ESPACIADO ───────────────────────────────────────────────────────── */
.mb-0  { margin-bottom: 0; }
.mb-sm { margin-bottom: 0.625rem; }
.mb-md { margin-bottom: 1rem; }
.mb-lg { margin-bottom: 1.5rem; }
.mb-xl { margin-bottom: 2rem; }
.mt-sm { margin-top: 0.625rem; }
.mt-md { margin-top: 1rem; }
.mt-lg { margin-top: 1.5rem; }
.mt-auto { margin-top: auto; }

/* ── TEXTO ───────────────────────────────────────────────────────────── */
.text-xs    { font-size: 0.75rem; }
.text-sm    { font-size: 0.8125rem; }
.text-base  { font-size: 0.875rem; }
.text-md    { font-size: 0.9375rem; }
.text-lg    { font-size: 1rem; }
.text-xl    { font-size: 1.125rem; }
.text-2xl   { font-size: 1.375rem; }
.fw-400  { font-weight: 400; }
.fw-500  { font-weight: 500; }
.fw-600  { font-weight: 600; }
.fw-700  { font-weight: 700; }
.text-muted   { color: var(--text-muted); }
.text-soft    { color: var(--text-soft); }
.text-primary { color: var(--primary); }
.text-accent  { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }
.text-info    { color: var(--info); }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-mono   { font-family: var(--font-mono); }
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uppercase   { text-transform: uppercase; letter-spacing: 0.05em; }

/* ── MONTOS / NÚMEROS ────────────────────────────────────────────────── */
.amount {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}
.amount-lg { font-size: 1.375rem; font-weight: 700; }
.amount-muted { color: var(--text-muted); font-weight: 400; }

/* ── DIVISOR ─────────────────────────────────────────────────────────── */
.divider {
    height: 1px;
    background: var(--border);
    margin: 1rem 0;
}
.divider-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 1rem 0;
}
.divider-label::before,
.divider-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── LOADING ─────────────────────────────────────────────────────────── */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary-mid);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}
.spinner-sm { width: 14px; height: 14px; }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    border-radius: inherit;
}

/* ── PROGRESS ────────────────────────────────────────────────────────── */
.progress {
    height: 6px;
    background: var(--surface3);
    border-radius: var(--r-full);
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: var(--r-full);
    background: var(--primary-mid);
    transition: width 0.6s ease;
}
.progress-fill.fill-accent   { background: var(--accent); }
.progress-fill.fill-success  { background: var(--success); }
.progress-fill.fill-warning  { background: var(--warning); }
.progress-fill.fill-danger   { background: var(--danger); }
.progress-fill.fill-purple   { background: var(--purple); }

/* ── ANIMACIONES ─────────────────────────────────────────────────────── */
@keyframes fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fade-in 0.2s ease forwards; }

@keyframes slide-in-right {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}
.slide-in-right { animation: slide-in-right 0.3s ease forwards; }

/* ── MISC ────────────────────────────────────────────────────────────── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}
.no-select { user-select: none; }
.cursor-pointer { cursor: pointer; }
.rounded { border-radius: var(--r-md); }
.rounded-lg { border-radius: var(--r-lg); }
.rounded-full { border-radius: var(--r-full); }
.overflow-hidden { overflow: hidden; }
.relative { position: relative; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.visible { display: block !important; }

/* ── PRINT ───────────────────────────────────────────────────────────── */
@media print {
    .erp-sidebar,
    .erp-topbar,
    .no-print { display: none !important; }
    .erp-content { padding: 0; }
    body { background: white; color: black; }
    .card { border: 1px solid #ddd; box-shadow: none; }
}
