/**
 * Estilos Globales del Sistema
 * Sistema de Facturación Electrónica - República Dominicana
 * 
 * Incluir en todas las páginas después de Bootstrap:
 * <link rel="stylesheet" href="css/global-styles.css">
 */

/* ========================================
   VARIABLES CSS
   ======================================== */

:root {
    /* Colores Principales */
    --primary: #2B5C8A;
    --primary-dark: #1a365d;
    --primary-light: #3B7EA1;
    
    /* Colores Secundarios */
    --secondary: #059669;
    --secondary-light: #10b981;
    --accent: #f59e0b;

    /* Colores de Acento */
    --success: #28A745;
    --success-light: #20c997;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #2563eb;

    /* Básicos */
    --dark: #1f2937;
    --light: #f8fafc;
    --white: #ffffff;
    
    /* Grises */
    --gray-50: #f7fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e0;
    --gray-400: #a0aec0;
    --gray-500: #718096;
    --gray-600: #4a5568;
    --gray-700: #2d3748;
    --gray-800: #1a202c;
    --gray-900: #171923;
    
    /* Espaciado */
    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 20px;
    --spacing-lg: 30px;
    --spacing-xl: 40px;
    
    /* Bordes */
    --border-radius-sm: 6px;
    --border-radius-md: 10px;
    --border-radius-lg: 12px;
    --border-radius-xl: 16px;
    
    /* Sombras */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.15);
    
    /* Tamaños */
    --header-height: 70px;
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 70px;
}

/* ========================================
   RESET Y BASE
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--gray-800);
    background: var(--gray-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    zoom: 0.8;
}

/* ========================================
   LAYOUT PRINCIPAL
   ======================================== */

.main-wrapper {
    display: flex;
    min-height: 100vh;
    padding-top: var(--header-height);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: var(--spacing-lg);
    transition: margin-left 0.3s ease;
    min-height: calc(100vh - var(--header-height));
}

.main-content.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed-width);
}

/* ========================================
   CONTENEDOR DE PÁGINA
   ======================================== */

.page-container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ========================================
   HEADERS DE PÁGINA
   ======================================== */

.page-header {
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--gray-200);
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: var(--spacing-xs);
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-subtitle {
    font-size: 15px;
    color: var(--gray-500);
    margin-bottom: var(--spacing-md);
}

.page-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--gray-500);
}

.page-breadcrumb a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

.page-breadcrumb a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.page-breadcrumb i {
    font-size: 10px;
    color: var(--gray-400);
}

/* ========================================
   CARDS
   ======================================== */

.card {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    margin-bottom: var(--spacing-md);
    overflow: hidden;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: var(--spacing-md) 25px;
    border-bottom: 1px solid var(--gray-200);
    background: white;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-800);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body {
    padding: 25px;
}

.card-footer {
    padding: var(--spacing-md) 25px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

/* ========================================
   STATS CARDS
   ======================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    margin-bottom: var(--spacing-lg);
}

.stat-card {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 16px 18px;
    border: 1px solid var(--gray-200);
    transition: all 0.3s;
    cursor: pointer;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.stat-icon.primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
}

.stat-icon.success {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-light) 100%);
    color: white;
}

.stat-icon.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    color: white;
}

.stat-icon.danger {
    background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
    color: white;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1.2;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: var(--gray-500);
    font-weight: 500;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 10px;
}

.stat-change.positive {
    background: #d1f4e0;
    color: #059669;
}

.stat-change.negative {
    background: #fee;
    color: #dc2626;
}

/* ========================================
   BOTONES
   ======================================== */

.btn {
    padding: 12px 24px;
    border-radius: var(--border-radius-md);
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn i {
    font-size: 16px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(43, 92, 138, 0.3);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-light) 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
    color: white;
}

.btn-outline-primary {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: white;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   BADGES
   ======================================== */

.badge {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-primary {
    background: var(--primary);
    color: white;
}

.badge-success {
    background: #d1f4e0;
    color: #059669;
}

.badge-warning {
    background: #fef3c7;
    color: #d97706;
}

.badge-danger {
    background: #fee;
    color: #dc2626;
}

.badge-info {
    background: #dbeafe;
    color: #2563eb;
}

/* ========================================
   FORMS
   ======================================== */

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius-md);
    font-size: 14px;
    transition: all 0.3s;
    background: var(--gray-50);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(43, 92, 138, 0.1);
}

.form-control::placeholder {
    color: var(--gray-400);
}

/* ========================================
   TABLES
   ======================================== */

.table {
    width: 100%;
    background: white;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    border-collapse: separate;
    border-spacing: 0;
}

.table thead {
    background: var(--gray-100);
}

.table th {
    padding: 15px 20px;
    text-align: left;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-700);
}

.table td {
    padding: 15px 20px;
    border-top: 1px solid var(--gray-200);
    font-size: 14px;
    color: var(--gray-700);
}

.table tbody tr:hover {
    background: var(--gray-50);
}

/* ========================================
   ALERTS
   ======================================== */

.alert {
    padding: 16px 20px;
    border-radius: var(--border-radius-md);
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert i {
    font-size: 20px;
}

.alert-success {
    background: #d1f4e0;
    color: #059669;
    border-left: 4px solid #059669;
}

.alert-warning {
    background: #fef3c7;
    color: #d97706;
    border-left: 4px solid #d97706;
}

.alert-danger {
    background: #fee;
    color: #dc2626;
    border-left: 4px solid #dc2626;
}

.alert-info {
    background: #dbeafe;
    color: #2563eb;
    border-left: 4px solid #2563eb;
}

/* ========================================
   UTILITIES
   ======================================== */

.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--gray-500) !important; }

.bg-primary { background: var(--primary) !important; }
.bg-success { background: var(--success) !important; }
.bg-light { background: var(--gray-50) !important; }

.d-flex { display: flex !important; }
.align-items-center { align-items: center !important; }
.justify-content-between { justify-content: space-between !important; }
.gap-2 { gap: 16px !important; }

.mt-2 { margin-top: 16px !important; }
.mb-2 { margin-bottom: 16px !important; }
.mb-3 { margin-bottom: 24px !important; }
.mb-4 { margin-bottom: 32px !important; }

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 992px) {
    .main-content {
        margin-left: 0;
        padding: var(--spacing-md);
    }
    
    .page-title {
        font-size: 24px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .main-content {
        padding: 15px;
    }
    
    .card-header,
    .card-body,
    .card-footer {
        padding: 15px;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ========================================
   ANIMACIONES
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* ========================================
   DARK MODE (Opcional)
   ======================================== */

body.dark-mode {
    --gray-50: #1a202c;
    --gray-100: #2d3748;
    --gray-200: #4a5568;
    background: #1a202c;
    color: #e2e8f0;
}

body.dark-mode .card {
    background: #2d3748;
    border-color: #4a5568;
}

body.dark-mode .main-header,
body.dark-mode .main-sidebar {
    background: #2d3748;
    border-color: #4a5568;
}