/* assets/css/style.css - Sistema POS Óptica */

/* ===== Variables CSS ===== */
:root {
    --primary-color: #dc2626;
    --secondary-color: #2563eb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --dark-color: #1f2937;
    --light-color: #f9fafb;
    --white-color: #ffffff;
    --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;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --border-radius: 8px;
    --transition: all 0.3s ease;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* ===== Reset y Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    font-size: 14px;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: var(--light-color);
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

img {
    max-width: 100%;
    height: auto;
}

ul, ol {
    list-style: none;
}

/* ===== Layout Principal ===== */
.main-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--white-color);
    border-right: 1px solid var(--gray-200);
    box-shadow: var(--shadow-md);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: var(--transition);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    background: var(--secondary-color);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.sidebar-title h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--dark-color);
}

.sidebar-title p {
    font-size: 12px;
    color: var(--gray-500);
}

.sidebar-menu {
    padding: 20px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--gray-700);
    transition: var(--transition);
    cursor: pointer;
}

.menu-item:hover {
    background: var(--gray-100);
    color: var(--primary-color);
}

.menu-item.active {
    background: var(--primary-color);
    color: var(--white-color);
    border-left: 4px solid var(--secondary-color);
}

.menu-item i {
    margin-right: 12px;
    font-size: 18px;
    width: 24px;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 20px;
    transition: var(--transition);
}

/* ===== Header ===== */
.header {
    background: var(--white-color);
    padding: 16px 24px;
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-radius: var(--border-radius);
}

.header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-title h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark-color);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--gray-100);
    border-radius: var(--border-radius);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--secondary-color);
    color: var(--white-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* ===== Cards ===== */
.card {
    background: var(--white-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    padding: 24px;
    margin-bottom: 24px;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--gray-200);
}

.card-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark-color);
}

.card-body {
    color: var(--gray-700);
}

/* ===== Botones ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    white-space: nowrap;
}

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

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

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

.btn-primary:hover {
    background: #b91c1c;
}

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

.btn-secondary:hover {
    background: #1d4ed8;
}

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

.btn-success:hover {
    background: #059669;
}

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

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

.btn-light {
    background: var(--gray-200);
    color: var(--dark-color);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

/* ===== Formularios ===== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--gray-700);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control:disabled {
    background: var(--gray-100);
    cursor: not-allowed;
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* ===== Tablas ===== */
.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white-color);
}

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

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 2px solid var(--gray-200);
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-700);
}

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

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

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

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

/* ===== Reportes ===== */
.reports-container {
    max-width: 1400px;
    margin: 0 auto;
}

.filters-section {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    color: var(--white-color);
    margin-bottom: 24px;
}

.filters-section h2 {
    color: var(--white-color);
    margin-bottom: 20px;
}

.filters-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    align-items: end;
}

.filter-group label {
    color: var(--white-color);
    margin-bottom: 8px;
    display: block;
}

.filter-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Resumen Ejecutivo */
.executive-summary {
    margin-bottom: 24px;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.summary-card {
    background: var(--white-color);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.summary-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.summary-card.revenue {
    border-left: 4px solid var(--success-color);
}

.summary-card.expenses {
    border-left: 4px solid var(--danger-color);
}

.summary-card.profit {
    border-left: 4px solid var(--secondary-color);
}

.summary-card.transactions {
    border-left: 4px solid var(--warning-color);
}

.card-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.revenue .card-icon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.expenses .card-icon {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.profit .card-icon {
    background: rgba(37, 99, 235, 0.1);
    color: var(--secondary-color);
}

.transactions .card-icon {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.card-content h3 {
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: 4px;
}

.card-content .amount {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark-color);
    margin: 0;
}

.card-content .percentage {
    font-size: 12px;
    color: var(--gray-500);
}

/* Estado de Resultados */
.profit-loss-statement {
    margin-bottom: 32px;
}

.financial-table {
    width: 100%;
    border-collapse: collapse;
}

.financial-table tr.section-header td {
    background: var(--gray-100);
    padding: 12px 16px;
    font-weight: 600;
    font-size: 14px;
    color: var(--gray-800);
}

.financial-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--gray-200);
}

.financial-table td.indent {
    padding-left: 32px;
}

.financial-table tr.subtotal td {
    font-weight: 600;
    border-top: 2px solid var(--gray-300);
    background: var(--gray-50);
}

.financial-table tr.total td {
    font-weight: 700;
    font-size: 16px;
    border-top: 3px double var(--gray-400);
    border-bottom: 3px double var(--gray-400);
    padding: 14px 16px;
}

.financial-table tr.highlight td {
    background: rgba(37, 99, 235, 0.05);
}

.financial-table .negative {
    color: var(--danger-color);
}

/* Gráficas */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.chart-container {
    background: var(--white-color);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.chart-container.full-width {
    grid-column: 1 / -1;
}

.chart-container h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--gray-200);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-300);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    color: var(--white-color);
    margin-top: 16px;
    font-size: 16px;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal {
    background: var(--white-color);
    border-radius: var(--border-radius);
    padding: 24px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

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

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--gray-200);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-500);
}

/* ===== Alertas ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-left: 4px solid var(--success-color);
    color: #065f46;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid var(--danger-color);
    color: #991b1b;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-left: 4px solid var(--warning-color);
    color: #92400e;
}

.alert-info {
    background: rgba(37, 99, 235, 0.1);
    border-left: 4px solid var(--secondary-color);
    color: #1e40af;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .filters-form {
        grid-template-columns: 1fr;
    }
    
    .header {
        flex-direction: column;
        gap: 12px;
    }
}

/* ===== Utilidades ===== */
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }
.p-4 { padding: 32px; }

.text-bold { font-weight: 600; }
.text-sm { font-size: 12px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 24px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

.hidden { display: none !important; }
