/* ==============================================
   VIP WOWSTORE - DISEÑO MINIMALISTA
   ============================================== */

:root {
    /* Colores planos */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-dark: #3730a3;
    --primary-bg: #eef2ff;
    --secondary: #6b7280;
    --secondary-hover: #4b5563;
    
    /* Estado */
    --success: #10b981;
    --success-bg: #d1fae5;
    --success-dark: #059669;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --warning-dark: #d97706;
    --error: #ef4444;
    --error-bg: #fecaca;
    --error-dark: #dc2626;
    --info: #3b82f6;
    --info-bg: #dbeafe;
    --info-dark: #2563eb;
    
    /* Grises mejorados */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* Texto */
    --text: #111827;
    --text-muted: #6b7280;
    --text-light: #9ca3af;
    
    /* Espaciado compacto para laptops */
    --space-1: 0.25rem;   /* 4px */
    --space-2: 0.375rem;  /* 6px - reducido */
    --space-3: 0.5rem;    /* 8px - reducido */
    --space-4: 0.75rem;   /* 12px - reducido */
    --space-5: 1rem;      /* 16px - reducido */
    --space-6: 1.25rem;   /* 20px - reducido */
    --space-8: 1.5rem;    /* 24px - reducido */
    
    /* Bordes */
    --border: 1px solid var(--gray-300);
    --border-light: 1px solid var(--gray-200);
    --radius: 0.5rem;
    --radius-sm: 0.375rem;
    --radius-lg: 0.75rem;
    --radius-full: 9999px;
    
    /* Sombras */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Layout */
    --content-max: 1280px;
    --content-wide: 1440px;
    --page-gutter: clamp(1.25rem, 2vw, 2.75rem);
    --header-height: 4.5rem;
}

/* Reset básico */
* {
    box-sizing: border-box;
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: radial-gradient(circle at top, rgba(79, 70, 229, 0.08), transparent 55%), var(--gray-50);
    line-height: 1.65;
    font-size: clamp(14px, 0.95vw, 15.5px);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

main {
    width: min(var(--content-wide), 100%);
    margin: 0 auto;
    padding-left: var(--page-gutter);
    padding-right: var(--page-gutter);
    padding-top: clamp(1.5rem, 2vw, 2.5rem);
    padding-bottom: clamp(1.5rem, 3vw, 3rem);
    flex: 1 1 auto;
}

/* ==============================================
   CARDS
   ============================================== */

.card {
    background: white;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: var(--radius-lg);
    padding: clamp(1.25rem, 1.6vw, 1.75rem);
    margin-bottom: 1rem;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.07);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.12);
}

.card-header {
    font-size: clamp(1.05rem, 1.2vw, 1.2rem);
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 2px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body {
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.7;
    font-feature-settings: "liga" on, "calt" on;
}

/* ==============================================
   BOTONES
   ============================================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border: var(--border);
    border-radius: var(--radius);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1.3;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-secondary {
    background: white;
    color: var(--gray-700);
    border-color: var(--gray-300);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-50);
}

.btn-success {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.btn-success:hover:not(:disabled) {
    background: #059669;
}

.btn-danger {
    background: var(--error);
    color: white;
    border-color: var(--error);
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-sm {
    padding: var(--space-1) var(--space-2);
    font-size: 0.75rem;
}

.btn-lg {
    padding: var(--space-3) var(--space-5);
    font-size: 0.9375rem;
}

/* ==============================================
   ALERTAS
   ============================================== */

.alert {
    padding: 1rem;
    border-radius: var(--radius);
    border: var(--border);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.875rem;
}

.alert-success {
    background: var(--success-bg);
    border-color: var(--success);
    color: #065f46;
}

.alert-warning {
    background: var(--warning-bg);
    border-color: var(--warning);
    color: #92400e;
}

.alert-error {
    background: var(--error-bg);
    border-color: var(--error);
    color: #991b1b;
}

.alert-info {
    background: var(--info-bg);
    border-color: var(--info);
    color: #1e40af;
}

/* ==============================================
   BADGES
   ============================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.badge-success {
    background: var(--success-bg);
    color: #065f46;
    border-color: var(--success-dark);
}

.badge-warning {
    background: var(--warning-bg);
    color: #78350f;
    border-color: var(--warning-dark);
}

.badge-error {
    background: var(--error-bg);
    color: #7f1d1d;
    border-color: var(--error-dark);
}

.badge-info {
    background: var(--info-bg);
    color: #1e3a8a;
    border-color: var(--info-dark);
}

.badge-secondary {
    background: var(--gray-200);
    color: var(--gray-800);
    border-color: var(--gray-400);
}

/* ==============================================
   TABLAS
   ============================================== */

.table {
    width: 100%;
    border-collapse: collapse;
    border: var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 0.8125rem;
}

.table thead {
    background: var(--gray-100);
}

.table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--gray-300);
}

.table td {
    padding: 0.75rem 1rem;
    border-bottom: var(--border-light);
    font-size: 0.875rem;
    color: var(--text);
}

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

.table tbody tr:hover {
    background: var(--gray-50);
}

/* ==============================================
   FORMULARIOS
   ============================================== */

.input-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: var(--space-2);
}

.input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--text);
    background: white;
    transition: all 0.2s ease;
}

.input:focus,
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.input::placeholder,
input::placeholder,
textarea::placeholder {
    color: var(--text-light);
}

.input-group {
    margin-bottom: 1rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* ==============================================
   LAYOUTS
   ============================================== */

.container {
    width: min(var(--content-max), 100%);
    margin: 0 auto;
    padding-left: var(--page-gutter);
    padding-right: var(--page-gutter);
    padding-top: clamp(1rem, 1.5vw, 1.75rem);
    padding-bottom: clamp(1rem, 1.5vw, 1.75rem);
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(260px, 24vw, 360px), 1fr));
    gap: clamp(1rem, 1.5vw, 2rem);
    align-items: stretch;
}

/* ==============================================
   ESTADÍSTICAS
   ============================================== */

.stat-card {
    background: white;
    border: var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

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

.stat-value {
    font-size: 1.875rem;
    font-weight: 800;
    color: var(--text);
    display: block;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.813rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: var(--space-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ==============================================
   EMPTY STATE
   ============================================== */

.empty-state {
    text-align: center;
    padding: var(--space-8);
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-4);
    color: var(--gray-400);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: var(--space-4);
    color: var(--gray-400);
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 var(--space-2) 0;
}

.empty-state-text {
    font-size: 0.938rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.6;
}

.empty-state p {
    font-size: 0.938rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.6;
}

/* ==============================================
   UTILIDADES
   ============================================== */

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: var(--space-2);
}

.gap-4 {
    gap: var(--space-4);
}

.gap-3 {
    gap: var(--space-3);
}

.gap-8 {
    gap: var(--space-8);
}

.w-full {
    width: 100%;
}

.max-w-7xl {
    max-width: min(var(--content-wide), 90vw);
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.px-8 {
    padding-left: 2rem;
    padding-right: 2rem;
}

.py-8 {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.py-4 {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.px-3 {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.px-2 {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.py-0\.5 {
    padding-top: 0.125rem;
    padding-bottom: 0.125rem;
}

.py-1\.5 {
    padding-top: 0.375rem;
    padding-bottom: 0.375rem;
}

.space-y-8 > * + * {
    margin-top: 2rem;
}

.bg-white { background-color: #ffffff !important; }
.bg-gray-50 { background-color: var(--gray-50) !important; }
.bg-gray-100 { background-color: var(--gray-100) !important; }
.bg-red-50 { background-color: #fef2f2 !important; }
.bg-red-100 { background-color: #fee2e2 !important; }
.bg-green-100 { background-color: #dcfce7 !important; }

.text-gray-600 { color: var(--gray-600) !important; }
.text-gray-700 { color: var(--gray-700) !important; }
.text-red-600 { color: #dc2626 !important; }
.text-red-700 { color: #b91c1c !important; }
.text-green-700 { color: #047857 !important; }
.text-\[10px\] { font-size: 10px; line-height: 1.2; }

.rounded-full { border-radius: var(--radius-full); }
.border-b { border-bottom: 1px solid rgba(15, 23, 42, 0.08); }
.shadow-sm { box-shadow: var(--shadow-sm); }
.sticky { position: sticky; }
.top-0 { top: 0; }
.z-50 { z-index: 50; }

.flex-1 { flex: 1 1 0%; }
.flex-shrink-0 { flex-shrink: 0; }
.justify-center { justify-content: center; }

.transition-all { transition-property: all; transition-timing-function: ease-in-out; }
.duration-200 { transition-duration: 0.2s; }

.text-sm { font-size: 0.875rem; line-height: 1.4; }
.font-medium { font-weight: 500; }

.hover\:bg-red-100:hover { background-color: #fee2e2 !important; }

/* ==============================================
   TOOLTIPS (solo CSS)
   ============================================== */

[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::before,
[data-tooltip]::after {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1000;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    background: var(--gray-900);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.75rem;
    line-height: 1.4;
    white-space: nowrap;
    max-width: 250px;
    text-align: center;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    margin-bottom: 8px;
}

[data-tooltip]::after {
    content: '';
    border: 5px solid transparent;
    border-top-color: var(--gray-900);
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-2px);
    margin-bottom: 3px;
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Tooltip abajo */
[data-tooltip-pos="bottom"]::before {
    bottom: auto;
    top: 100%;
    transform: translateX(-50%) translateY(8px);
    margin-bottom: 0;
    margin-top: 8px;
}

[data-tooltip-pos="bottom"]::after {
    bottom: auto;
    top: 100%;
    border-top-color: transparent;
    border-bottom-color: var(--gray-900);
    transform: translateX(-50%) translateY(2px);
    margin-bottom: 0;
    margin-top: 3px;
}

[data-tooltip-pos="bottom"]:hover::before,
[data-tooltip-pos="bottom"]:hover::after {
    transform: translateX(-50%) translateY(0);
}

/* Tooltip izquierda */
[data-tooltip-pos="left"]::before {
    bottom: auto;
    left: auto;
    right: 100%;
    top: 50%;
    transform: translateY(-50%) translateX(-8px);
    margin-bottom: 0;
    margin-right: 8px;
}

[data-tooltip-pos="left"]::after {
    bottom: auto;
    left: auto;
    right: 100%;
    top: 50%;
    border-top-color: transparent;
    border-left-color: var(--gray-900);
    transform: translateY(-50%) translateX(-2px);
    margin-bottom: 0;
    margin-right: 3px;
}

[data-tooltip-pos="left"]:hover::before,
[data-tooltip-pos="left"]:hover::after {
    transform: translateY(-50%) translateX(0);
}

/* Tooltip derecha */
[data-tooltip-pos="right"]::before {
    bottom: auto;
    left: 100%;
    top: 50%;
    transform: translateY(-50%) translateX(8px);
    margin-bottom: 0;
    margin-left: 8px;
}

[data-tooltip-pos="right"]::after {
    bottom: auto;
    left: 100%;
    top: 50%;
    border-top-color: transparent;
    border-right-color: var(--gray-900);
    transform: translateY(-50%) translateX(2px);
    margin-bottom: 0;
    margin-left: 3px;
}

[data-tooltip-pos="right"]:hover::before,
[data-tooltip-pos="right"]:hover::after {
    transform: translateY(-50%) translateX(0);
}

/* Variantes de color */
[data-tooltip-type="success"]::before {
    background: var(--success);
}

[data-tooltip-type="success"]::after {
    border-top-color: var(--success);
}

[data-tooltip-type="warning"]::before {
    background: var(--warning);
    color: var(--gray-900);
}

[data-tooltip-type="warning"]::after {
    border-top-color: var(--warning);
}

[data-tooltip-type="error"]::before {
    background: var(--error);
}

[data-tooltip-type="error"]::after {
    border-top-color: var(--error);
}

[data-tooltip-type="info"]::before {
    background: var(--info);
}

[data-tooltip-type="info"]::after {
    border-top-color: var(--info);
}

/* ==============================================
   MICRO-ANIMACIONES
   ============================================== */

/* Animación de fade-in para cards */
.card {
    animation: fadeIn 0.3s ease-out;
}

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

/* Skeleton loader para tablas */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius);
}

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

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: 1rem;
}

/* Mejores hover effects */
.btn, .action-btn, a[class*="btn"] {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Estados de éxito/error en botones */
.btn-success-state {
    background: var(--success) !important;
    border-color: var(--success) !important;
    animation: successPulse 0.5s ease;
}

.btn-error-state {
    background: var(--error) !important;
    border-color: var(--error) !important;
    animation: errorShake 0.5s ease;
}

@keyframes successPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes errorShake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

/* Card hover effect mejorado */
.metric-card, .dashboard-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.metric-card:hover, .dashboard-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

/* Fade-in staggered para listas */
.table tbody tr {
    animation: fadeInUp 0.3s ease-out backwards;
}

.table tbody tr:nth-child(1) { animation-delay: 0.05s; }
.table tbody tr:nth-child(2) { animation-delay: 0.1s; }
.table tbody tr:nth-child(3) { animation-delay: 0.15s; }
.table tbody tr:nth-child(4) { animation-delay: 0.2s; }
.table tbody tr:nth-child(5) { animation-delay: 0.25s; }

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

/* Smooth transitions para inputs */
.input, select {
    transition: all 0.2s ease;
}

.input:focus, select:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

/* Badge pulse para notificaciones */
.badge-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

/* Spinner suave */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.fa-spin {
    animation: spin 1s linear infinite;
}

/* Slide-in para modales y toasts (ya implementados) */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Progress bar smooth */
.progress-bar {
    transition: width 0.3s ease;
}

/* Focus visible mejorado */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    transition: outline-offset 0.2s ease;
}

/* ==============================================
   MEDIA QUERIES RESPONSIVAS
   ============================================== */

@media (max-width: 1200px) {
    .cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }

    main,
    .container {
        padding-left: clamp(1rem, 3vw, 1.5rem);
        padding-right: clamp(1rem, 3vw, 1.5rem);
    }

    header .flex {
        flex-wrap: wrap;
        gap: 0.85rem;
    }

    header nav {
        justify-content: center;
        flex-wrap: wrap;
    }

    .form-row {
        flex-direction: column;
    }
}

@media (max-width: 992px) {
    .table {
        font-size: 0.8rem;
    }

    .card {
        padding: clamp(1rem, 4vw, 1.25rem);
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .nav-link span {
        display: none;
    }
}

@media (min-width: 1600px) {
    :root {
        --content-wide: 1560px;
    }

    main {
        max-width: var(--content-wide);
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
