/*
 * ELESERVIC - Sistema de Gestión
 * Stylesheet centralizado con soporte Dark/Light Theme
 */

/* ============================================
   TEMA CLARO (default)
   ============================================ */
:root,
[data-theme="light"] {
    /* Brand */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-darker: #4338ca;
    --primary-light: #e0e7ff;

    --success: #10b981;
    --success-dark: #059669;

    --danger: #ef4444;
    --danger-dark: #dc2626;

    --warning: #f59e0b;
    --warning-dark: #d97706;

    --info: #3b82f6;
    --info-dark: #2563eb;

    --secondary: #64748b;
    --secondary-dark: #475569;

    --accent: #8b5cf6;
    --accent-dark: #7c3aed;

    /* Sidebar */
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-text-hover: #e2e8f0;
    --sidebar-text-active: #ffffff;
    --sidebar-active-bg: rgba(99, 102, 241, 0.15);
    --sidebar-active-border: #6366f1;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.05);
    --sidebar-border: rgba(255, 255, 255, 0.08);
    --sidebar-icon: #818cf8;

    /* Topbar */
    --topbar-bg: #ffffff;
    --topbar-border: #e2e8f0;
    --topbar-text: #1e293b;

    /* Page */
    --page-bg: #f1f5f9;
    --surface: #ffffff;
    --surface-hover: #f8fafc;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-disabled: #cbd5e1;

    /* Inputs */
    --input-bg: #ffffff;
    --input-border: #e2e8f0;
    --input-focus-border: #6366f1;
    --input-focus-ring: rgba(99, 102, 241, 0.25);
    --input-text: #0f172a;
    --input-placeholder: #94a3b8;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.10), 0 8px 16px rgba(0, 0, 0, 0.04);
    --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.06);

    /* Table */
    --table-header-bg: #f8fafc;
    --table-row-hover: #f1f5f9;
    --table-border: #e2e8f0;
}

/* ============================================
   TEMA OSCURO
   ============================================ */
[data-theme="dark"] {
    /* Brand - más vibrante sobre fondo oscuro */
    --primary: #818cf8;
    --primary-dark: #6366f1;
    --primary-darker: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.15);

    --success: #34d399;
    --success-dark: #10b981;

    --danger: #f87171;
    --danger-dark: #ef4444;

    --warning: #fbbf24;
    --warning-dark: #f59e0b;

    --info: #60a5fa;
    --info-dark: #3b82f6;

    --secondary: #94a3b8;
    --secondary-dark: #64748b;

    --accent: #a78bfa;
    --accent-dark: #8b5cf6;

    /* Sidebar */
    --sidebar-bg: #020617;
    --sidebar-text: #64748b;
    --sidebar-text-hover: #cbd5e1;
    --sidebar-text-active: #f1f5f9;
    --sidebar-active-bg: rgba(129, 140, 248, 0.12);
    --sidebar-active-border: #818cf8;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.04);
    --sidebar-border: rgba(255, 255, 255, 0.06);
    --sidebar-icon: #818cf8;

    /* Topbar */
    --topbar-bg: #0f172a;
    --topbar-border: #1e293b;
    --topbar-text: #f1f5f9;

    /* Page */
    --page-bg: #020617;
    --surface: #0f172a;
    --surface-hover: #1e293b;
    --border: #1e293b;
    --border-light: #0f172a;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-disabled: #334155;

    /* Inputs */
    --input-bg: #1e293b;
    --input-border: #334155;
    --input-focus-border: #818cf8;
    --input-focus-ring: rgba(129, 140, 248, 0.20);
    --input-text: #f1f5f9;
    --input-placeholder: #475569;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4), 0 4px 8px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5), 0 8px 16px rgba(0, 0, 0, 0.2);
    --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.2);

    /* Table */
    --table-header-bg: #1e293b;
    --table-row-hover: #1e293b;
    --table-border: #1e293b;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--page-bg);
    color: var(--text);
    transition: background 0.2s ease, color 0.2s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar-gradient {
    background: var(--sidebar-bg) !important;
    border-right: 1px solid var(--sidebar-border);
}

#main-sidebar nav a.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    border-radius: 0.625rem;
    color: var(--sidebar-text);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
    position: relative;
    border: 1px solid transparent;
    margin-bottom: 2px;
}

#main-sidebar nav a.nav-item:hover {
    color: var(--sidebar-text-hover);
    background: var(--sidebar-hover-bg);
}

#main-sidebar nav a.nav-item.active {
    color: var(--sidebar-text-active);
    background: var(--sidebar-active-bg);
    border-color: var(--sidebar-active-border);
}

#main-sidebar nav a.nav-item .nav-icon {
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--sidebar-icon);
    flex-shrink: 0;
    transition: color 0.15s;
}

#main-sidebar nav a.nav-item:hover .nav-icon,
#main-sidebar nav a.nav-item.active .nav-icon {
    color: var(--sidebar-text-active);
}

#main-sidebar .logo-text {
    font-size: 1.125rem;
    font-weight: 800;
    letter-spacing: 0.025em;
}

/* ============================================
   TOPBAR
   ============================================ */
.topbar-gradient {
    background: var(--topbar-bg) !important;
    border-bottom: 1px solid var(--topbar-border);
    color: var(--topbar-text);
}

.topbar-gradient h1 { color: var(--topbar-text); }

/* ============================================
   BOTONES 3D CON GRADIENTE
   ============================================ */
.btn-3d {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1.125rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    letter-spacing: 0.01em;
    /* 3D effect */
    box-shadow: 0 4px 0 var(--btn-bottom, #4f46e5), 0 6px 12px rgba(0,0,0,0.15);
    background: linear-gradient(180deg, var(--btn-top, #818cf8) 0%, var(--btn-mid, #6366f1) 100%);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.btn-3d:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 0 var(--btn-bottom, #4f46e5), 0 8px 16px rgba(0,0,0,0.2);
    filter: brightness(1.05);
    color: #fff;
}

.btn-3d:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 var(--btn-bottom, #4f46e5), 0 3px 6px rgba(0,0,0,0.15);
    filter: brightness(0.97);
}

.btn-3d-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 0.4rem;
    box-shadow: 0 3px 0 var(--btn-bottom, #4f46e5), 0 4px 8px rgba(0,0,0,0.15);
}

.btn-3d-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: 0.625rem;
    box-shadow: 0 5px 0 var(--btn-bottom, #4f46e5), 0 8px 16px rgba(0,0,0,0.15);
}

.btn-3d.btn-3d-primary {
    --btn-top: #818cf8; --btn-mid: #6366f1; --btn-bottom: #4338ca;
}
.btn-3d.btn-3d-success {
    --btn-top: #34d399; --btn-mid: #10b981; --btn-bottom: #059669;
}
.btn-3d.btn-3d-danger {
    --btn-top: #f87171; --btn-mid: #ef4444; --btn-bottom: #dc2626;
}
.btn-3d.btn-3d-warning {
    --btn-top: #fbbf24; --btn-mid: #f59e0b; --btn-bottom: #d97706;
    color: #422006;
    text-shadow: none;
}
.btn-3d.btn-3d-secondary {
    --btn-top: #94a3b8; --btn-mid: #64748b; --btn-bottom: #475569;
}
.btn-3d.btn-3d-info {
    --btn-top: #60a5fa; --btn-mid: #3b82f6; --btn-bottom: #2563eb;
}
.btn-3d.btn-3d-accent {
    --btn-top: #a78bfa; --btn-mid: #8b5cf6; --btn-bottom: #7c3aed;
}
.btn-3d.btn-3d-dark {
    --btn-top: #64748b; --btn-mid: #475569; --btn-bottom: #334155;
}

/* Outline variant */
.btn-3d-outline {
    background: transparent;
    box-shadow: none;
    text-shadow: none;
    border: 2px solid var(--btn-mid);
    color: var(--btn-mid);
}
.btn-3d-outline:hover {
    background: var(--btn-mid);
    color: #fff;
    filter: none;
    box-shadow: none;
}
.btn-3d-outline:active {
    filter: brightness(0.9);
    transform: none;
}

/* ============================================
   CARDS 3D
   ============================================ */
.card-3d {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    overflow: hidden;
}

.card-3d:hover {
    box-shadow: var(--shadow);
    border-color: var(--border);
}

.card-3d-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.card-3d-body {
    padding: 1.25rem;
}

.card-3d-footer {
    padding: 0.875rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

/* ============================================
   TABLAS
   ============================================ */
.table-3d {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table-3d thead tr {
    background: var(--table-header-bg);
}

.table-3d thead th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--table-border);
    white-space: nowrap;
}

.table-3d tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background 0.1s;
}

.table-3d tbody tr:last-child { border-bottom: none; }

.table-3d tbody tr:hover {
    background: var(--table-row-hover);
}

.table-3d tbody td {
    padding: 0.875rem 1rem;
    color: var(--text);
    vertical-align: middle;
}

.table-3d .text-end { text-align: right; }
.table-3d .text-center { text-align: center; }

/* ============================================
   FORMULARIOS
   ============================================ */
.form-control-3d {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    border-radius: 0.5rem;
    color: var(--input-text);
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.2s, color 0.2s;
    outline: none;
}

.form-control-3d::placeholder { color: var(--input-placeholder); }

.form-control-3d:focus {
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 3px var(--input-focus-ring);
}

.form-control-3d:focus-visible {
    outline: none;
}

textarea.form-control-3d { resize: vertical; min-height: 80px; }

.form-select-3d {
    display: block;
    width: 100%;
    padding: 0.625rem 2.25rem 0.625rem 0.875rem;
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    border-radius: 0.5rem;
    color: var(--input-text);
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.2s, color 0.2s;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.25rem;
}

.form-select-3d:focus {
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 3px var(--input-focus-ring);
}

.form-label-3d {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
    letter-spacing: 0.01em;
}

.input-group-3d {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.input-prefix {
    display: flex;
    align-items: center;
    padding: 0 0.875rem;
    background: var(--surface-hover);
    border: 1.5px solid var(--input-border);
    border-right: none;
    border-radius: 0.5rem 0 0 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
}

.input-group-3d .form-control-3d {
    border-radius: 0;
    flex: 1;
}

/* ============================================
   BADGES
   ============================================ */
.badge-3d {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.badge-primary-3d  { background: var(--primary-light);   color: var(--primary); }
.badge-success-3d  { background: rgba(16,185,129,0.12);  color: var(--success); }
.badge-danger-3d   { background: rgba(239,68,68,0.12);    color: var(--danger); }
.badge-warning-3d  { background: rgba(245,158,11,0.12);  color: var(--warning); }
.badge-secondary-3d { background: rgba(100,116,139,0.12); color: var(--secondary); }
.badge-info-3d     { background: rgba(59,130,246,0.12);   color: var(--info); }
.badge-accent-3d   { background: rgba(139,92,246,0.12);  color: var(--accent); }

/* ============================================
   ALERTS
   ============================================ */
.alert-3d {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: 0.625rem;
    border: 1px solid;
    font-size: 0.875rem;
    line-height: 1.5;
}

.alert-3d-success {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.25);
    color: var(--success);
}
.alert-3d-danger {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.25);
    color: var(--danger);
}
.alert-3d-warning {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.25);
    color: var(--warning);
}
.alert-3d-info {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.25);
    color: var(--info);
}

/* ============================================
   PAGE HEADER & BREADCRUMB
   ============================================ */
.page-header-3d {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.page-header-3d .title {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    font-size: 1.375rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.01em;
}

.page-header-3d .title .icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.375rem;
    flex-shrink: 0;
}

.breadcrumb-3d {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.breadcrumb-3d a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s;
}

.breadcrumb-3d a:hover { color: var(--primary); }

.breadcrumb-3d .separator {
    color: var(--text-disabled);
    font-size: 0.75rem;
}

.breadcrumb-3d .current {
    color: var(--text);
    font-weight: 500;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state-3d {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
    gap: 0.5rem;
}

.empty-state-3d .icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-hover);
    font-size: 1.5rem;
    color: var(--text-disabled);
    margin-bottom: 0.5rem;
}

.empty-state-3d p { font-size: 0.9375rem; margin: 0; }

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container-3d {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast-3d {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.125rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.625rem;
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    pointer-events: all;
    animation: toastIn 0.3s ease forwards;
    max-width: 360px;
    backdrop-filter: blur(12px);
}

.toast-3d.success { border-left: 4px solid var(--success); }
.toast-3d.error   { border-left: 4px solid var(--danger); }
.toast-3d.warning { border-left: 4px solid var(--warning); }
.toast-3d.info    { border-left: 4px solid var(--info); }

.toast-3d.fade-out {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100%); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(100%); }
}

/* ============================================
   THEME TOGGLE BUTTON
   ============================================ */
.theme-toggle {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.theme-toggle:hover {
    background: var(--surface-hover);
    color: var(--text);
}

/* ============================================
   STAT CARDS (Dashboard)
   ============================================ */
.stat-card-3d {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: box-shadow 0.2s, transform 0.2s;
}

.stat-card-3d:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.stat-card-3d .stat-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.375rem;
    flex-shrink: 0;
}

.stat-card-3d .stat-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.stat-card-3d .stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}

/* ============================================
   MODAL OVERRIDES
   ============================================ */
.modal-content {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: 0.875rem !important;
    box-shadow: var(--shadow-lg) !important;
    color: var(--text) !important;
}

.modal-header {
    background: var(--surface) !important;
    border-bottom: 1px solid var(--border) !important;
    color: var(--text) !important;
}

.modal-footer {
    background: var(--surface) !important;
    border-top: 1px solid var(--border) !important;
}

.modal-title { color: var(--text) !important; }

.btn-close {
    filter: var(--btn-close-filter, none);
}

[data-theme="dark"] .btn-close {
    --btn-close-filter: invert(1) grayscale(100%) brightness(200%);
}

/* ============================================
   UTILITY
   ============================================ */
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-primary { color: var(--primary) !important; }
.text-info    { color: var(--info) !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }

.bg-success { background-color: rgba(16,185,129,0.1) !important; }
.bg-danger  { background-color: rgba(239,68,68,0.1) !important; }
.bg-warning { background-color: rgba(245,158,11,0.1) !important; }
.bg-primary { background-color: var(--primary-light) !important; }
.bg-info    { background-color: rgba(59,130,246,0.1) !important; }

.font-bold   { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.text-sm   { font-size: 0.875rem; }
.text-xs   { font-size: 0.75rem; }
.text-lg   { font-size: 1.125rem; }
.text-xl   { font-size: 1.25rem; }
.text-2xl  { font-size: 1.5rem; }
.text-center { text-align: center; }
.text-end   { text-align: right; }
.text-uppercase { text-transform: uppercase; letter-spacing: 0.05em; }

.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; }
.justify-end     { justify-content: flex-end; }
.flex-1  { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.gap-1  { gap: 0.25rem; }
.gap-2  { gap: 0.5rem; }
.gap-3  { gap: 0.75rem; }
.gap-4  { gap: 1rem; }
.gap-5  { gap: 1.25rem; }
.gap-6  { gap: 1.5rem; }

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

.mb-0  { margin-bottom: 0; }
.mb-1  { margin-bottom: 0.25rem; }
.mb-2  { margin-bottom: 0.5rem; }
.mb-3  { margin-bottom: 0.75rem; }
.mb-4  { margin-bottom: 1rem; }
.mb-5  { margin-bottom: 1.25rem; }
.mb-6  { margin-bottom: 1.5rem; }
.mt-2  { margin-top: 0.5rem; }
.mt-3  { margin-top: 0.75rem; }
.mt-4  { margin-top: 1rem; }
.me-2  { margin-right: 0.5rem; }
.ms-3  { margin-left: 0.75rem; }
.py-3  { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.px-4  { padding-left: 1rem; padding-right: 1rem; }
.py-2  { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.ps-3  { padding-left: 0.75rem; }
.pt-0  { padding-top: 0; }
.pb-0  { padding-bottom: 0; }
.border-0 { border: none; }
.border { border: 1px solid var(--border); }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-full { border-radius: 999px; }
.overflow-hidden { overflow: hidden; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-4 > * + * { margin-top: 1rem; }

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

.relative { position: relative; }
.absolute { position: absolute; }
.inset-y-0 { top: 0; bottom: 0; }
.left-3 { left: 0.75rem; }
.top-1\/2 { top: 50%; }
.-translate-y-1\/2 { transform: translateY(-50%); }

.inline-flex { display: inline-flex; }
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

/* ============================================
   RESPONSIVE HELPERS
   ============================================ */
/* ── Tabs ─────────────────────────────────────────────── */
.tabs-container {
    display: flex;
    gap: 0.25rem;
    border-bottom: 2px solid var(--border);
}

.tab-btn {
    padding: 0.625rem 1.25rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.tab-btn i { font-size: 1rem; }

.tab-btn:hover {
    color: var(--accent);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

/* ── Row highlight ───────────────────────────────────── */
.row-success td {
    background: rgba(16, 185, 129, 0.06) !important;
}

/* ── Flex utilities ──────────────────────────────────── */
.flex { display: flex; }
.items-end { align-items: flex-end; }
.w-full { width: 100%; }
.gap-4 { gap: 1rem; }

/* ── Empty state icon size ───────────────────────────── */
.empty-state-3d .icon {
    font-size: 3rem !important;
}

/* ── Font utilities ───────────────────────────────────── */
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.fs-4 { font-size: 1.5rem; }

/* ── Margin/padding utilities ─────────────────────────── */
.mb-6 { margin-bottom: 1.5rem; }
.me-2 { margin-right: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.p-0 { padding: 0 !important; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }

/* ── Text utilities ─────────────────────────────────── */
.text-center { text-align: center; }
.text-uppercase { text-transform: uppercase; }

/* ── Alert info variant ──────────────────────────────── */
.alert-3d-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

/* ── Icon invert for close button in dark mode ───────── */
:root, [data-theme="light"], [data-theme="dark"] {
    --icon-invert: none;
}
[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}
[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

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

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

    .btn-3d { padding: 0.5rem 0.875rem; font-size: 0.8125rem; }

    .tabs-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }
}

/* Spinner para estado de carga */
@keyframes spin {
    to { transform: rotate(360deg); }
}
.spin {
    animation: spin 0.8s linear infinite;
}
