/* ========================================
   🥞 Gofresquina Sistema Profesional
   Diseño Corporativo Moderno
   ======================================== */

/* Importar fuentes profesionales */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ========================================
   VARIABLES CSS - Paleta Profesional
   ======================================== */
:root {
    /* Colores Primarios - Azul Corporativo */
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-300: #93c5fd;
    --primary-400: #60a5fa;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --primary-800: #1e40af;
    --primary-900: #1e3a8a;
    
    /* Colores Secundarios - Grises Profesionales */
    --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;
    
    /* Colores de Estado */
    --success-50: #ecfdf5;
    --success-500: #10b981;
    --success-600: #059669;
    --success-700: #047857;
    
    --warning-50: #fffbeb;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    --warning-700: #b45309;
    
    --error-50: #fef2f2;
    --error-500: #ef4444;
    --error-600: #dc2626;
    --error-700: #b91c1c;
    
    --info-50: #eff6ff;
    --info-500: #3b82f6;
    --info-600: #2563eb;
    --info-700: #1d4ed8;
    
    /* Colores de Acento - Dorado Elegante */
    --accent-50: #fffbeb;
    --accent-100: #fef3c7;
    --accent-200: #fde68a;
    --accent-300: #fcd34d;
    --accent-400: #fbbf24;
    --accent-500: #f59e0b;
    --accent-600: #d97706;
    --accent-700: #b45309;
    
    /* Sombras Profesionales */
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    
    /* Bordes Redondeados */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    
    /* Espaciado */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Transiciones */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 250ms ease-in-out;
    --transition-slow: 350ms ease-in-out;
}

/* ========================================
   RESET Y BASE
   ======================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--primary-50) 100%);
    color: var(--gray-900);
    min-height: 100vh;
    font-weight: 400;
    line-height: 1.6;
}

/* ========================================
   NAVBAR PROFESIONAL
   ======================================== */
.navbar {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    padding: var(--spacing-md) 0;
    transition: var(--transition-normal);
}

.navbar-brand {
    font-weight: 700 !important;
    font-size: 1.5rem !important;
    color: var(--primary-700) !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.navbar-brand:hover {
    color: var(--primary-600) !important;
    transform: translateY(-1px);
    transition: var(--transition-fast);
}

.navbar-text {
    color: var(--gray-600) !important;
    font-weight: 500;
    font-size: 0.875rem;
}

.nav-link {
    color: var(--gray-600) !important;
    font-weight: 500;
    font-size: 0.875rem;
    padding: var(--spacing-sm) var(--spacing-md) !important;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    text-decoration: none;
}

.nav-link:hover {
    color: var(--primary-600) !important;
    background-color: var(--primary-50);
    transform: translateY(-1px);
}

.badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    background-color: var(--primary-100);
    color: var(--primary-700);
}

/* ========================================
   CARDS PROFESIONALES
   ======================================== */
.card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-normal);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: var(--primary-200);
}

.card-body {
    padding: var(--spacing-xl);
}

.card-title {
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--spacing-sm);
    font-size: 1.125rem;
}

.card-text {
    color: var(--gray-600);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* KPI Cards */
.kpi-card {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
    color: white;
    border: none;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(30px, -30px);
}

.kpi-card .card-body {
    position: relative;
    z-index: 1;
}

.kpi-card .card-title {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    margin-bottom: var(--spacing-xs);
}

.kpi-card .card-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    font-weight: 500;
}

.kpi-card i {
    font-size: 2.5rem;
    opacity: 0.8;
    margin-bottom: var(--spacing-md);
}

/* Module Cards */
.module-card {
    background: white;
    border: 1px solid var(--gray-200);
    transition: var(--transition-normal);
}

.module-card:hover {
    border-color: var(--primary-300);
    box-shadow: var(--shadow-lg);
}

.module-card .card-body {
    text-align: center;
    padding: var(--spacing-2xl);
}

.module-card i {
    font-size: 3rem;
    margin-bottom: var(--spacing-lg);
    opacity: 0.8;
}

.module-card .card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
}

.module-card .card-text {
    color: var(--gray-500);
    margin-bottom: var(--spacing-xl);
    font-size: 0.875rem;
}

/* ========================================
   BOTONES PROFESIONALES
   ======================================== */
.btn {
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    transition: var(--transition-fast);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    line-height: 1;
}

.btn:focus {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

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

.btn-primary:hover {
    background-color: var(--primary-600);
    border-color: var(--primary-600);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-success:hover {
    background-color: var(--success-600);
    border-color: var(--success-600);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-warning:hover {
    background-color: var(--warning-600);
    border-color: var(--warning-600);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-danger:hover {
    background-color: var(--error-600);
    border-color: var(--error-600);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-info:hover {
    background-color: var(--info-600);
    border-color: var(--info-600);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline-primary {
    background-color: transparent;
    color: var(--primary-600);
    border-color: var(--primary-300);
}

.btn-outline-primary:hover {
    background-color: var(--primary-50);
    color: var(--primary-700);
    border-color: var(--primary-400);
}

.btn-outline-secondary {
    background-color: transparent;
    color: var(--gray-600);
    border-color: var(--gray-300);
}

.btn-outline-secondary:hover {
    background-color: var(--gray-50);
    color: var(--gray-700);
    border-color: var(--gray-400);
}

/* ========================================
   TABLAS PROFESIONALES
   ======================================== */
.table {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.table thead th {
    background-color: var(--gray-50);
    color: var(--gray-700);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 1rem;
    border: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table tbody td {
    padding: 1rem;
    border-top: 1px solid var(--gray-200);
    color: var(--gray-700);
    font-size: 0.875rem;
}

.table tbody tr {
    transition: var(--transition-fast);
}

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

/* ========================================
   FORMULARIOS PROFESIONALES
   ======================================== */
.form-control {
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    transition: var(--transition-fast);
    background-color: white;
}

.form-control:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

.form-select {
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    background-color: white;
}

.form-select:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

.form-label {
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: var(--spacing-sm);
    font-size: 0.875rem;
}

/* ========================================
   ALERTAS PROFESIONALES
   ======================================== */
.alert {
    border-radius: var(--radius-lg);
    border: 1px solid;
    padding: 1rem 1.25rem;
    margin-bottom: var(--spacing-lg);
    font-size: 0.875rem;
    font-weight: 500;
}

.alert-success {
    background-color: var(--success-50);
    border-color: var(--success-200);
    color: var(--success-700);
}

.alert-danger {
    background-color: var(--error-50);
    border-color: var(--error-200);
    color: var(--error-700);
}

.alert-warning {
    background-color: var(--warning-50);
    border-color: var(--warning-200);
    color: var(--warning-700);
}

.alert-info {
    background-color: var(--info-50);
    border-color: var(--info-200);
    color: var(--info-700);
}

/* ========================================
   MODALES PROFESIONALES
   ======================================== */
.modal-content {
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    overflow: hidden;
}

.modal-header {
    background-color: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    padding: 1.5rem;
}

.modal-title {
    font-weight: 600;
    color: var(--gray-900);
    font-size: 1.125rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    background-color: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    padding: 1rem 1.5rem;
}

/* ========================================
   BADGES PROFESIONALES
   ======================================== */
.badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success {
    background-color: var(--success-100);
    color: var(--success-700);
}

.badge-warning {
    background-color: var(--warning-100);
    color: var(--warning-700);
}

.badge-danger {
    background-color: var(--error-100);
    color: var(--error-700);
}

.badge-info {
    background-color: var(--info-100);
    color: var(--info-700);
}

.badge-primary {
    background-color: var(--primary-100);
    color: var(--primary-700);
}

/* ========================================
   ANIMACIONES PROFESIONALES
   ======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

.slide-in-right {
    animation: slideInRight 0.5s ease-out;
}

/* ========================================
   UTILIDADES PROFESIONALES
   ======================================== */
.text-primary { color: var(--primary-600) !important; }
.text-secondary { color: var(--gray-600) !important; }
.text-success { color: var(--success-600) !important; }
.text-warning { color: var(--warning-600) !important; }
.text-danger { color: var(--error-600) !important; }
.text-info { color: var(--info-600) !important; }

.bg-primary { background-color: var(--primary-500) !important; }
.bg-secondary { background-color: var(--gray-100) !important; }
.bg-success { background-color: var(--success-500) !important; }
.bg-warning { background-color: var(--warning-500) !important; }
.bg-danger { background-color: var(--error-500) !important; }
.bg-info { background-color: var(--info-500) !important; }

.border-primary { border-color: var(--primary-300) !important; }
.border-secondary { border-color: var(--gray-300) !important; }
.border-success { border-color: var(--success-300) !important; }
.border-warning { border-color: var(--warning-300) !important; }
.border-danger { border-color: var(--error-300) !important; }
.border-info { border-color: var(--info-300) !important; }

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.25rem !important;
    }
    
    .card-body {
        padding: var(--spacing-lg);
    }
    
    .module-card .card-body {
        padding: var(--spacing-xl);
    }
    
    .btn {
        font-size: 0.8rem;
        padding: 0.625rem 1.25rem;
    }
    
    .kpi-card .card-title {
        font-size: 1.5rem;
    }
    
    .kpi-card i {
        font-size: 2rem;
    }
}

@media (max-width: 576px) {
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .card-body {
        padding: var(--spacing-md);
    }
    
    .module-card .card-body {
        padding: var(--spacing-lg);
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ========================================
   ESTADOS DE CARGA Y INTERACCION
   ======================================== */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn:disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* ========================================
   SCROLLBAR PERSONALIZADO
   ======================================== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    .navbar,
    .btn,
    .modal {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid var(--gray-300);
    }
    
    body {
        background: white;
    }
}

/* ========================================
   SIDEBAR Y LAYOUT ADMIN
   ======================================== */

.wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

#sidebar {
    width: 250px;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
    color: white;
    transition: all 0.3s;
    overflow-y: auto;
}

#sidebar.active {
    margin-left: -250px;
}

.sidebar-header {
    padding: 20px;
    background: rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
}

.sidebar-header p {
    margin: 5px 0 0 0;
    font-size: 0.9rem;
    opacity: 0.8;
}

#sidebar .components {
    padding: 0;
    margin: 0;
    list-style: none;
}

#sidebar .components li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#sidebar .components li a {
    padding: 15px 20px;
    display: block;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

#sidebar .components li a:hover,
#sidebar .components li.active a {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: white;
}

#sidebar .components li a i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

#content {
    width: calc(100% - 250px);
    margin-left: 250px;
    min-height: 100vh;
    transition: all 0.3s;
}

#content.active {
    width: 100%;
    margin-left: 0;
}

.header {
    background: white;
    padding: 20px 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid var(--gray-200);
}

.main-content {
    padding: 30px;
    background: var(--gray-50);
    min-height: calc(100vh - 80px);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--gray-200);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-500), var(--primary-600));
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--gray-600);
    font-weight: 500;
}

/* Table Container */
.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.chart-title {
    padding: 20px 25px 15px;
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-800);
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.chart-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--gray-200);
    padding: 25px;
    margin-bottom: 20px;
}

.chart-container canvas {
    width: 100% !important;
    height: 300px !important;
}

/* Form Container */
.form-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--gray-200);
    padding: 25px;
}

/* Animations */
.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

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

/* Responsive */
@media (max-width: 768px) {
    #sidebar {
        margin-left: -250px;
    }
    
    #sidebar.active {
        margin-left: 0;
    }
    
    #content {
        width: 100%;
        margin-left: 0;
    }
    
    .main-content {
        padding: 20px 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .header {
        padding: 15px 20px;
    }
}