/* =============================================================
   THEME PRO — capa final de refinamiento visual
   Se carga después de todos los demás CSS a propósito: unifica
   superficies, tipografía, sombras y micro-interacciones sin
   tocar la estructura ni la lógica de la aplicación.
   ============================================================= */

:root {
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.25rem;
    --border-soft: rgba(255, 255, 255, 0.08);
    --border-soft-strong: rgba(255, 255, 255, 0.14);
    --surface-1: #141a2c;
    --surface-2: #171e33;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px -8px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 24px 48px -16px rgba(0, 0, 0, 0.55);
    --glow-primary: 0 0 0 1px rgba(99, 102, 241, 0.25), 0 12px 28px -8px rgba(99, 102, 241, 0.35);
}

/* -------------------------------------------------
   Base
   ------------------------------------------------- */
html {
    scrollbar-gutter: stable;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    background:
        radial-gradient(900px circle at 8% -8%, rgba(99, 102, 241, 0.10), transparent 42%),
        radial-gradient(900px circle at 96% 0%, rgba(168, 85, 247, 0.08), transparent 45%),
        radial-gradient(1100px circle at 50% 115%, rgba(56, 189, 248, 0.05), transparent 55%),
        var(--bg-dark);
    background-attachment: fixed;
}

* {
    transition-timing-function: var(--ease);
}

::selection {
    background: rgba(99, 102, 241, 0.35);
    color: #fff;
}

/* Subtle global scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.25);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.4);
}

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.25) transparent;
}

h1, h2, h3, h4 {
    letter-spacing: -0.015em;
}

/* -------------------------------------------------
   Login / Apertura — glass card + ambient glow
   ------------------------------------------------- */
.login-page,
#apertura-section {
    background:
        radial-gradient(600px circle at 20% 20%, rgba(99, 102, 241, 0.16), transparent 60%),
        radial-gradient(600px circle at 80% 80%, rgba(168, 85, 247, 0.14), transparent 60%),
        radial-gradient(circle at center, #141a2c 0%, #0b1020 100%);
    position: relative;
}

.login-page::before,
#apertura-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 42px 42px;
    -webkit-mask-image: radial-gradient(circle at center, black, transparent 75%);
    mask-image: radial-gradient(circle at center, black, transparent 75%);
    pointer-events: none;
}

.login-card {
    position: relative;
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.85), rgba(20, 26, 44, 0.85));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-soft-strong);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.login-header i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    font-size: 1.75rem !important;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.18), rgba(139, 92, 246, 0.18));
    border: 1px solid rgba(129, 140, 248, 0.3);
    box-shadow: 0 0 44px rgba(99, 102, 241, 0.25);
    margin-bottom: 1.25rem !important;
    animation: none !important;
}

.login-header h1 {
    letter-spacing: -0.02em;
}

.login-header p {
    letter-spacing: 0.01em;
}

/* -------------------------------------------------
   Surfaces: cards, tables, toasts, modals
   ------------------------------------------------- */
.form-card,
.stat-card,
.table-container,
.toast,
.quick-action-btn,
.client-card,
.product-card,
.cart-panel {
    background: linear-gradient(180deg, var(--surface-2), var(--surface-1));
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-lg);
}

.stat-card,
.quick-action-btn,
.client-card,
.product-card {
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(99, 102, 241, 0.35);
    box-shadow: var(--shadow-md), var(--glow-primary);
}

.quick-action-btn:hover {
    transform: translateY(-2px);
    border-color: rgba(99, 102, 241, 0.35);
    box-shadow: var(--shadow-md);
}

.client-card:hover,
.product-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    border-radius: var(--radius-md);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 8px 16px -6px rgba(0, 0, 0, 0.4);
}

.modal {
    background: rgba(6, 9, 20, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    overflow-y: auto;
    padding: 2.5rem 1rem;
}

.modal .form-card {
    box-shadow: var(--shadow-lg);
    border-color: var(--border-soft-strong);
    max-height: calc(100vh - 5rem);
    overflow-y: auto;
    margin: auto;
}

.toast {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow-md);
    position: relative;
    padding-left: 1.5rem;
}

.toast::before {
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.toast.success::before {
    content: '\f058';
    color: var(--success-color);
}

.toast.error::before {
    content: '\f057';
    color: var(--danger-color);
}

.toast.info::before {
    content: '\f05a';
    color: var(--info-color);
}

.toast.warning::before {
    content: '\f071';
    color: var(--warning-color);
}

/* -------------------------------------------------
   Buttons — sentence case, calmer motion
   ------------------------------------------------- */
.btn {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    box-shadow: 0 10px 20px -8px rgba(99, 102, 241, 0.55);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5457e5, #7c3aed);
    transform: translateY(-1px);
    box-shadow: 0 14px 28px -8px rgba(99, 102, 241, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-soft-strong);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
    box-shadow: 0 10px 20px -8px rgba(239, 68, 68, 0.45);
}

.btn:active {
    transform: translateY(0);
}

.primary-action-btn,
.facturar-btn {
    border-radius: var(--radius-sm);
}

/* -------------------------------------------------
   Forms
   ------------------------------------------------- */
.form-control {
    border-radius: var(--radius-sm);
    background-color: rgba(255, 255, 255, 0.03);
    border-color: var(--border-soft-strong);
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.form-control:focus {
    transform: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.form-group label {
    letter-spacing: 0.01em;
}

/* -------------------------------------------------
   Sidebar — refined active state (left accent bar)
   ------------------------------------------------- */
.sidebar {
    background: linear-gradient(180deg, #0d1220, #0a0e1a);
    border-right: 1px solid var(--border-soft);
}

.sidebar-header {
    border-bottom: 1px solid var(--border-soft);
}

.sidebar-footer {
    border-top: 1px solid var(--border-soft);
    background: transparent !important;
}

.user-profile {
    border: 1px solid var(--border-soft);
}

.sidebar .nav-item,
.nav-item {
    position: relative;
    font-weight: 500;
    transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.sidebar .nav-item.active,
.nav-item.active {
    background: rgba(99, 102, 241, 0.14) !important;
    color: #e0e7ff !important;
    box-shadow: none !important;
}

.sidebar .nav-item.active::before,
.nav-item.active::before {
    content: '';
    position: absolute;
    left: -0.35rem;
    top: 18%;
    bottom: 18%;
    width: 3px;
    border-radius: 999px;
    background: linear-gradient(180deg, #818cf8, #c084fc);
}

.sidebar .nav-item:hover,
.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.04) !important;
    color: #c7d2fe !important;
}

#logout-btn {
    transition: background-color 0.2s var(--ease), transform 0.2s var(--ease);
}

#logout-btn:hover {
    transform: none;
}

/* -------------------------------------------------
   Tables
   ------------------------------------------------- */
thead {
    background: rgba(255, 255, 255, 0.03);
}

th {
    border-bottom: 1px solid var(--border-soft);
}

td {
    border-bottom: 1px solid var(--border-soft);
}

tbody tr:hover {
    background: rgba(99, 102, 241, 0.06);
}

/* -------------------------------------------------
   Misc polish
   ------------------------------------------------- */
.badge,
.role-badge,
.status-badge {
    border-radius: 999px;
    font-weight: 600;
}

.system-footer {
    background: transparent;
    color: var(--text-muted);
}

::-webkit-scrollbar {
    width: 8px;
}

@media (max-width: 768px) {
    .login-card {
        margin: 0 1rem;
    }
}
