/**
 * Estilos Principales del Sistema
 * Diseño elegante, limpio y fácil de usar
 */

:root {
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-success: #10b981;
    --color-danger: #ef4444;
    --color-warning: #f59e0b;
    --color-info: #3b82f6;
    
    --color-bg: #f8fafc;
    --color-bg-white: #ffffff;
    --color-text: #1e293b;
    --color-text-light: #64748b;
    --color-border: #e2e8f0;
    
    --sidebar-width: 260px;
    --header-height: 70px;
    
    --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);
    
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: white;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar.active {
    transform: translateX(0);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    font-size: 18px;
    color: var(--color-primary);
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--color-text);
    padding: 5px;
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-section {
    margin-bottom: 20px;
}

.nav-section-title {
    padding: 10px 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--color-text);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--color-bg);
    border-left-color: var(--color-primary);
    color: var(--color-primary);
}

.nav-icon {
    margin-right: 12px;
    font-size: 20px;
}

/* ============================================
   HEADER
   ============================================ */
.main-header {
    background: white;
    height: var(--header-height);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    margin-right: 15px;
    color: var(--color-text);
    display: none;
}

.header-content {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content h1 {
    font-size: 24px;
    font-weight: 600;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-name {
    font-weight: 500;
}

.user-role {
    font-size: 14px;
    color: var(--color-text-light);
    background: var(--color-bg);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
}

.btn-logout {
    padding: 8px 16px;
    background: var(--color-danger);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: #dc2626;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: 0;
    padding: 30px;
    min-height: calc(100vh - var(--header-height));
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
}

.card-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    border: none;
    font-size: 16px;
    transition: all 0.2s;
    min-height: 44px; /* Touch-friendly */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
}

.btn-success {
    background: var(--color-success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--color-danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-secondary {
    background: var(--color-text-light);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
    min-height: 36px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 18px;
    min-height: 52px;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--color-text);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-file {
    padding: 8px;
}

.file-preview {
    margin-top: 10px;
    padding: 10px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
}

.file-preview img {
    max-width: 200px;
    max-height: 200px;
    border-radius: var(--radius-sm);
}

.form-error {
    color: var(--color-danger);
    font-size: 14px;
    margin-top: 5px;
}

.form-help {
    color: var(--color-text-light);
    font-size: 14px;
    margin-top: 5px;
}

/* ============================================
   GRID
   ============================================ */
.grid {
    display: grid;
    gap: 24px;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* ============================================
   STAT CARDS (Dashboard)
   ============================================ */
.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--color-primary);
}

.stat-card.success::before {
    background: var(--color-success);
}

.stat-card.danger::before {
    background: var(--color-danger);
}

.stat-card.info::before {
    background: var(--color-info);
}

.stat-label {
    font-size: 14px;
    color: var(--color-text-light);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 4px;
}

.stat-icon {
    font-size: 40px;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.1;
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background: var(--color-bg);
}

.table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--color-text);
    border-bottom: 2px solid var(--color-border);
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
}

.table tbody tr:hover {
    background: var(--color-bg);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-primary {
    background: #dbeafe;
    color: #1e40af;
}

.badge-secondary {
    background: #f1f5f9;
    color: #475569;
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: var(--radius-lg);
    padding: 30px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 24px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--color-text-light);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   MODAL IMAGE (Para comprobantes)
   ============================================ */
.modal-image-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.85) !important;
    z-index: 99999 !important;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
    margin: 0 !important;
}

.modal-image-overlay.active {
    display: flex !important;
}

.modal-image-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-image-content {
    position: relative;
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    max-width: 100%;
    max-height: 100%;
    overflow: auto;
}

.modal-image {
    max-width: 100%;
    max-height: 85vh;
    height: auto;
    display: block;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.modal-image-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 24px;
    cursor: pointer;
    color: var(--color-text);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.modal-image-close:hover {
    background: white;
    transform: scale(1.1);
    color: var(--color-danger);
}

.modal-image-close:active {
    transform: scale(0.95);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: white;
    padding: 16px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-left: 4px solid var(--color-success);
}

.toast.error {
    border-left: 4px solid var(--color-danger);
}

.toast.info {
    border-left: 4px solid var(--color-info);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================
   UTILITIES
   ============================================ */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-success {
    color: var(--color-success);
}

.text-danger {
    color: var(--color-danger);
}

.text-primary {
    color: var(--color-primary);
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0,0,0,0.1);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    text-align: center;
    padding: 24px 20px;
    margin-top: 40px;
    border-top: 1px solid var(--color-border);
    background-color: var(--color-bg-white);
    color: var(--color-text-light);
    font-size: 14px;
}

footer p {
    margin: 0;
}

footer a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-block;
    position: relative;
}

footer a:hover {
    color: var(--color-primary-dark);
    transform: translateY(-1px);
}

footer a:active {
    transform: translateY(0);
}

/* Efecto de subrayado animado en hover */
footer a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 50%;
    background-color: var(--color-primary);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

footer a:hover::after {
    width: 100%;
}


