/* ====== VARIABLES DE ESTILO ====== */
:root {
    --primary-color: #3b82f6;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;
    
    --background-color: #f8fafc;
    --card-background: #ffffff;
    --text-color: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --hover-color: #f1f5f9;
    
    --font-family: 'Inter', sans-serif;
    --font-size-base: 16px;
    --border-radius: 8px;
    --box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* ====== ESTILOS GENERALES ====== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.5;
    color: var(--text-color);
    background-color: var(--background-color);
}

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

a:hover {
    color: #2563eb;
}

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

/* ====== LAYOUT ====== */
.app-container {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    padding: 2rem;
    margin-left: 250px;
    transition: var(--transition);
}

.sidebar-collapsed .main-content {
    margin-left: 60px;
}

/* ====== HEADER ====== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background-color: var(--card-background);
    box-shadow: var(--box-shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 1000;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo i {
    margin-right: 0.5rem;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

/* ====== SIDEBAR ====== */
.sidebar {
    position: fixed;
    top: 70px;
    left: 0;
    width: 250px;
    height: calc(100vh - 70px);
    background-color: var(--card-background);
    box-shadow: var(--box-shadow);
    overflow-y: auto;
    transition: var(--transition);
    z-index: 999;
}

.sidebar-collapsed .sidebar {
    width: 60px;
}

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 85px;
    left: 10px;
    z-index: 1001;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0;
}

.sidebar-menu li {
    margin-bottom: 0.25rem;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--text-color);
    transition: var(--transition);
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background-color: var(--hover-color);
    color: var(--primary-color);
}

.sidebar-menu i {
    margin-right: 0.75rem;
    font-size: 1.25rem;
}

.sidebar-collapsed .sidebar-menu span {
    display: none;
}

.sidebar-collapsed .sidebar-menu i {
    margin-right: 0;
}

/* ====== PÁGINA ====== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    margin-top: 1rem;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.page-actions {
    display: flex;
    gap: 0.5rem;
}

/* ====== TARJETAS ====== */
.card {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 2rem;
    overflow: hidden;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.card-description {
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.card-body {
    padding: 1.5rem;
}

/* ====== BOTONES ====== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    gap: 0.5rem;
}

.btn i {
    font-size: 1.25rem;
}

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

.btn-primary:hover {
    background-color: #2563eb;
}

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

.btn-secondary:hover {
    background-color: #475569;
}

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

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

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

.btn-danger:hover {
    background-color: #dc2626;
}

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

.btn-warning:hover {
    background-color: #d97706;
}

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

.btn-info:hover {
    background-color: #0891b2;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-block {
    width: 100%;
}

/* ====== FORMULARIOS ====== */
.form {
    margin-bottom: 2rem;
}

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

.form-group {
    flex: 1;
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 1rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

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

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

select.form-control {
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* ====== TABLAS ====== */
.table-container {
    overflow-x: auto;
}

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

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-weight: 600;
    background-color: var(--hover-color);
}

.data-table tr:hover {
    background-color: var(--hover-color);
}

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

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

/* ====== BADGES ====== */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
}

.badge-primary {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
}

.badge-secondary {
    background-color: rgba(100, 116, 139, 0.1);
    color: var(--secondary-color);
}

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

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

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

.badge-info {
    background-color: rgba(6, 182, 212, 0.1);
    color: var(--info-color);
}

/* ====== ALERTAS ====== */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
}

.alert i {
    margin-right: 0.75rem;
    font-size: 1.25rem;
}

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

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

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

.alert-info {
    background-color: rgba(6, 182, 212, 0.1);
    color: var(--info-color);
}

/* ====== PAGINACIÓN ====== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 1.5rem;
}

.pagination-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius);
    background-color: var(--card-background);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.pagination-link:hover {
    background-color: var(--hover-color);
}

.pagination-link.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ====== ESTADÍSTICAS ====== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    display: flex;
    align-items: center;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--border-radius);
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
}

.stat-icon i {
    font-size: 1.5rem;
}

.stat-content h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-content p {
    color: var(--text-secondary);
}

/* ====== DASHBOARD ====== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.dashboard-card {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
}

.dashboard-card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.finance-summary {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.finance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-radius: var(--border-radius);
}

.finance-item.income {
    background-color: rgba(16, 185, 129, 0.1);
}

.finance-item.expense {
    background-color: rgba(239, 68, 68, 0.1);
}

.finance-item.balance {
    background-color: rgba(59, 130, 246, 0.1);
}

.finance-label {
    font-weight: 500;
}

.finance-value {
    font-weight: 700;
}

.product-list,
.recent-sales {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.product-item,
.sale-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-radius: var(--border-radius);
    background-color: var(--hover-color);
}

.product-name,
.sale-id {
    font-weight: 500;
}

.product-quantity,
.sale-amount {
    font-weight: 600;
}

.sale-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sale-client,
.sale-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ====== BÚSQUEDA Y FILTROS ====== */
.search-form,
.filter-form {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.search-input {
    position: relative;
    flex: 1;
}

.search-input i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-input input {
    padding-left: 2.5rem;
}

/* ====== VACÍO ====== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
}

.empty-state i {
    font-size: 3rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary);
}

/* ====== VENTAS ====== */
.sale-details {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

.sale-info {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.info-group {
    background-color: var(--hover-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
}

.info-group h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.info-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.info-value {
    font-weight: 500;
}

.sale-items h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* ====== BOTONES DE ACCIÓN ====== */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

/* ====== FORMULARIO DE VENTA ====== */
.form-section {
    margin-bottom: 2rem;
}

.form-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.product-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: end;
}

/* ====== REPORTES ====== */
.report-summary {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: var(--hover-color);
    border-radius: var(--border-radius);
    display: flex;
    justify-content: space-between;
}

.summary-label {
    font-weight: 500;
}

.summary-value {
    font-weight: 700;
}

/* ====== LOGIN ====== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: var(--background-color);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.login-form {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 2rem;
}

.login-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 2rem;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 992px) {
    .main-content {
        margin-left: 0;
        padding: 1rem;
        padding-top: 90px;
    }
    
    .sidebar {
        transform: translateX(-100%);
        z-index: 1000;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-toggle {
        display: flex;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .sale-details {
        grid-template-columns: 1fr;
    }
    
    .product-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .search-form,
    .filter-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
}

/* ====== IMPRESIÓN ====== */
@media print {
    .header,
    .sidebar,
    .sidebar-toggle,
    .page-actions,
    .action-buttons {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
}