:root {
    --bg-color: #fdf6f9;
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --primary-color: #e8a0bf;
    --primary-color-light: #f4d3e3;
    --secondary-color: #a2d2ff;
    --text-color: #555;
    --text-color-light: #888;
    --border-color: #f0e6e6;
    --shadow-color: rgba(0, 0, 0, 0.05);

    --color-blue: #a2d2ff;
    --color-dark: #4a4a4a;
    --color-yellow: #ffecb3;
    --color-red: #ffcdd2;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 14px;
}

a {
    text-decoration: none;
    color: inherit;
}

.container {
    display: flex;
}

/* --- Sidebar --- */
.sidebar {
    width: 260px;
    flex: 0 0 260px;
    height: 100vh;
    background-color: var(--sidebar-bg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    position: sticky;
    top: 0;
}

.sidebar-header .logo {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
}

.logo-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 15px;
    background-color: var(--primary-color-light);
}

.logo-name {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary-color);
}

.user-info {
    text-align: center;
    margin-bottom: 30px;
}

.user-name {
    font-weight: 500;
}

.sidebar-nav {
    flex-grow: 1;
}

.sidebar-nav ul {
    list-style: none;
}

.nav-item a {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: background-color 0.3s, color 0.3s;
}

.nav-item a i {
    font-size: 20px;
    margin-right: 15px;
}

.nav-item a span {
    font-weight: 500;
}

.nav-item.active a, .nav-item a:hover {
    background-color: var(--primary-color-light);
    color: var(--primary-color);
}

.sidebar-footer {
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.logout {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-radius: 8px;
    transition: background-color 0.3s, color 0.3s;
}

.logout:hover {
    background-color: var(--color-red);
    color: #b71c1c;
}

/* --- Password visibility toggle --- */
.password-field {
    position: relative;
}
.password-field input.form-control,
.password-field input[type="password"],
.password-field input[type="text"] {
    padding-right: 42px;
}
.toggle-visibility {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-color-light);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}
.toggle-visibility i { font-size: 20px; }
.toggle-visibility:hover { color: var(--text-color); }

/* --- Main Content --- */
.main-content {
    flex-grow: 1;
    min-width: 0;
    padding: 30px;
}

.header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.title {
    font-size: 28px;
    font-weight: 600;
}

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

/* --- Sección de búsqueda --- */
.search-section {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px var(--shadow-color);
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.search-container {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.search-filters {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.date-filters {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    min-width: 140px;
}

.date-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(232, 160, 191, 0.2);
}

.date-separator {
    color: var(--text-color-light);
    font-weight: 500;
}

.search-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    min-width: 250px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(232, 160, 191, 0.2);
}

.search-input:not(:placeholder-shown) {
    border-color: var(--primary-color);
}

/* Animación para el indicador de búsqueda */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Animaciones para notificaciones */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.searching {
    animation: pulse 1.5s infinite;
}

.btn-outline {
    background-color: transparent;
    color: var(--text-color-light);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

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

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

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    background-color: #fff;
    border: 1px solid var(--border-color);
}

.btn-sm.active, .btn-sm:hover {
    background-color: var(--primary-color-light);
    color: var(--primary-color);
    border-color: var(--primary-color-light);
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    background-color: #6c757d;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.btn-danger {
    background-color: #e53935;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}
.btn-danger:hover {
    background-color: #c62828;
}

.btn-info {
    background-color: #17a2b8;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

/* --- Cards --- */
.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.card {
    background-color: var(--card-bg);
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--shadow-color);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    color: var(--text-color-light);
}

.card-header i {
    font-size: 24px;
}

.card-body .card-value {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 5px;
}

.card-body .card-detail {
    font-size: 12px;
    color: var(--text-color-light);
    display: flex;
    align-items: center;
    gap: 5px;
}

.card.card-blue .card-header i, .card.card-blue .card-body .card-value {
    color: var(--color-blue);
}
.card.card-dark .card-header i, .card.card-dark .card-body .card-value {
    color: var(--color-dark);
}
.card.card-yellow .card-header i, .card.card-yellow .card-body .card-value {
    color: #f59e0b;
}
.card.card-red .card-header i, .card.card-red .card-body .card-value {
    color: #ef4444;
}
.card.card-green .card-header i, .card.card-green .card-body .card-value {
    color: #22c55e;
}

.card.card-purple .card-header i, .card.card-purple .card-body .card-value {
    color: #a855f7;
}

.card.card-teal .card-header i, .card.card-teal .card-body .card-value {
    color: #14b8a6;
}

/* --- Charts --- */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.chart-card {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--shadow-color);
}

.chart-card h3 {
    margin-bottom: 20px;
    font-weight: 600;
    font-size: 18px;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.chart-header h3 {
    margin: 0;
}

.chart-select {
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--card-bg);
    color: var(--text-color);
    font-size: 14px;
}

/* --- Productos Ranking --- */
.productos-ranking {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.producto-ranking-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s ease;
}

.producto-ranking-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.producto-ranking-position {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-weight: bold;
    font-size: 18px;
    margin-right: 15px;
    flex-shrink: 0;
}

.producto-ranking-position.gold {
    background: #f59e0b;
}

.producto-ranking-position.silver {
    background: #6b7280;
}

.producto-ranking-position.bronze {
    background: #cd7c2f;
}

.producto-ranking-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    margin-right: 15px;
    flex-shrink: 0;
}

.producto-ranking-image-placeholder {
    width: 60px;
    height: 60px;
    background: #e5e7eb;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    flex-shrink: 0;
    color: #9ca3af;
    font-size: 24px;
}

.producto-ranking-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.producto-ranking-nombre {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 5px;
    font-size: 16px;
}

.producto-ranking-cantidad {
    color: #6b7280;
    font-size: 14px;
}

.producto-ranking-cantidad .numero {
    font-weight: 600;
    color: var(--primary-color);
}

/* Colores especiales para bottom ranking */
#productos-bottom-container .producto-ranking-item:nth-child(1) .producto-ranking-position {
    background: #ef4444;
}

#productos-bottom-container .producto-ranking-item:nth-child(2) .producto-ranking-position {
    background: #f97316;
}

#productos-bottom-container .producto-ranking-item:nth-child(3) .producto-ranking-position {
    background: #eab308;
}

/* --- Period Indicator --- */
.period-indicator {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 12px 20px;
    margin: 15px 0 20px 0;
    color: #374151;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.period-indicator i {
    font-size: 16px;
    color: var(--primary-color);
}

.period-indicator span:first-of-type {
    font-weight: 500;
    color: #6b7280;
}

.period-indicator span:last-of-type {
    font-weight: 600;
    color: #1f2937;
}

/* --- Modal --- */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Evitar scroll */
    background-color: rgba(0,0,0,0.4);
}

/* Modal visible - centrado */
.modal[style*="block"] {
    display: flex !important;
    justify-content: center;
    align-items: center;
}

/* Evitar scroll del body cuando modal está abierto */
body.modal-open {
    overflow: hidden;
}

.modal-content {
    background-color: #fefefe;
    margin: 0; /* Quitar margen automático */
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 800px; /* Aumentar ancho máximo para ventas */
    max-height: 90vh; /* Limitar altura máxima */
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    overflow-y: auto; /* Scroll interno si es necesario */
    position: relative; /* Para posicionamiento correcto */
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 22px;
}

.close-btn {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
}

.close-btn:hover,
.close-btn:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
}

/* Asegurar que los inputs de archivo sean clicables en todos los navegadores */
.form-group input[type="file"] {
    position: relative;
    z-index: 10;
    cursor: pointer;
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* --- Data Table --- */
.table-container {
    background-color: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--shadow-color);
}

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

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

.data-table thead th {
    font-weight: 600;
    color: var(--text-color-light);
}

.data-table .btn-edit {
    padding: 6px 10px;
    font-size: 13px;
    background-color: var(--secondary-color);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.3s ease;
    min-width: 75px;
    height: 32px;
    font-weight: 500;
}

.data-table .btn-edit:hover {
    background-color: #8bb3d9;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(162, 210, 255, 0.3);
}

/* Estilo específico para botón "Ver" */
.data-table .btn-edit.btn-view {
    background-color: #8BB3D9;
    color: #fff;
}

.data-table .btn-edit.btn-view:hover {
    background: #6a9bc7;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(139, 179, 217, 0.3);
}

.data-table .btn-edit.btn-view i {
    color: #fff;
}

.data-table .btn-edit.btn-view-sale,
.data-table .btn-edit.btn-view-purchase,
.data-table .btn-edit.btn-view-expense {
    background-color: #8BB3D9;
    color: #fff;
}

.data-table .btn-edit.btn-view-sale:hover,
.data-table .btn-edit.btn-view-purchase:hover,
.data-table .btn-edit.btn-view-expense:hover {
    background: #6a9bc7;
}

.data-table .btn-edit.btn-view-sale i,
.data-table .btn-edit.btn-view-purchase i,
.data-table .btn-edit.btn-view-expense i {
    color: #fff;
}

/* Estilo para botón "Editar" alineado a la derecha */
.data-table .btn-edit.btn-edit-action {
    background-color: var(--secondary-color);
    margin-left: 8px;
}

.data-table .btn-edit.btn-edit-action:hover {
    background-color: #8bb3d9;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(162, 210, 255, 0.3);
}

/* Botón Eliminar más compacto (solo ícono) */
.data-table .btn-edit.btn-delete-sale {
    min-width: 38px;
    width: 38px;
    height: 30px;
    padding: 0;
    background-color: #e53935;
    color: #fff;
    border: none;
}
.data-table .btn-edit.btn-delete-sale i {
    font-size: 16px;
    color: #fff;
}
.data-table .btn-edit.btn-delete-sale:hover {
    background-color: #c62828;
}

.data-table .btn-edit.btn-delete-product {
    background-color: #e53935;
    color: #fff;
    border: none;
    border-radius: 8px;
}
.data-table .btn-edit.btn-delete-product i {
    color: #fff;
}
.data-table .btn-edit.btn-delete-product:hover {
    background-color: #c62828;
}

/* Contenedor de acciones para mejor alineación */
.data-table td .button-group {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-start;
}

.data-table .btn-edit i {
    font-size: 16px;
}

#products-table-body .button-group .btn-edit {
    min-width: 38px;
    width: 38px;
    height: 30px;
    padding: 0;
    border-radius: 8px;
}

#products-table-body .button-group .btn-edit i {
    font-size: 16px;
}

/* Estilo para fila seleccionada */
.data-table tr.selected {
    background-color: var(--primary-color-light);
    border-left: 4px solid var(--primary-color);
}

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

/* Estilos para tooltip de productos con bajo stock */
.tooltip {
    position: absolute;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 0;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    min-width: 300px;
    max-width: 400px;
}

.tooltip.show {
    opacity: 1;
    visibility: visible;
}

.tooltip-content {
    padding: 15px;
}

.tooltip-content h4 {
    margin: 0 0 10px 0;
    color: var(--text-color);
    font-size: 14px;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.tooltip-content .product-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-color-light);
}

.tooltip-content .product-item:last-child {
    border-bottom: none;
}

.tooltip-content .product-name {
    font-weight: 500;
    color: var(--text-color);
    font-size: 13px;
}

.tooltip-content .product-stock {
    font-weight: 600;
    color: var(--danger-color);
    font-size: 12px;
    background-color: rgba(220, 53, 69, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.tooltip-content .no-products {
    color: var(--text-color-light);
    font-style: italic;
    text-align: center;
    padding: 10px 0;
}

/* Estilos específicos para la página de compras */

/* Estilos para el formulario de compras */
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(232, 160, 191, 0.2);
}

.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background-color: var(--card-bg);
    color: var(--text-color);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(232, 160, 191, 0.2);
}

/* Estilos para campos readonly */
.form-group input[readonly] {
    background-color: var(--border-color-light);
    color: var(--text-color-light);
    cursor: not-allowed;
}

/* Estilos para múltiples productos en compras */
.producto-item {
    margin-bottom: 15px;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--card-bg);
}

.producto-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 15px;
    align-items: end;
}

.form-group-small {
    display: flex;
    flex-direction: column;
}

.form-group-small label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-color-light);
    margin-bottom: 5px;
}

.form-group-small input,
.form-group-small select {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

.form-group-small input:focus,
.form-group-small select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(232, 160, 191, 0.2);
}

.btn-remove-product {
    padding: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#add-product-btn {
    margin-top: 0;
}

#add-drop-btn {
    margin-top: 0;
}

/* Estilos para badges de estado */
.estado-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.estado-pedido {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* --- Drop Modal --- */
.drop-modal .modal-content {
    overflow-x: hidden;
}
.drop-modal .drop-product-row {
    position: relative;
    display: grid;
    grid-template-columns: 1.2fr 2fr;
    gap: 24px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px 56px 20px 20px;
    transition: box-shadow .2s ease, transform .2s ease;
}
.drop-modal .drop-product-row:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}
.drop-modal .drop-fields {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}
.drop-modal .field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-color-light);
    margin-bottom: 6px;
}
.drop-modal .field input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.drop-modal .field input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-color-light);
}
.drop-modal .remove-drop-row {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
}
.drop-modal .drop-photo .dropzone {
    width: 100%;
    height: 100%;
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color .3s ease, background-color .3s ease;
    position: relative;
    overflow: hidden;
    background-size: cover;
    background-position: center;
}
.drop-modal .drop-photo .dropzone:hover {
    border-color: var(--primary-color);
    background-color: var(--bg-color);
}
.drop-modal .drop-photo .dropzone.has-image .dropzone-text {
    opacity: 0;
    transform: scale(0.9);
}
.drop-modal .drop-photo .dropzone.has-image:hover .dropzone-text {
    opacity: 1;
    background: rgba(0,0,0,0.5);
    color: #fff;
    transform: scale(1);
}
.drop-modal .drop-photo .dropzone input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
.drop-modal .drop-photo .dropzone .dropzone-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-color-light);
    transition: opacity .3s ease, transform .3s ease, background .3s ease, color .3s ease;
    padding: 10px;
    border-radius: 8px;
    width: 100%;
    height: 100%;
    justify-content: center;
}
.drop-modal .drop-photo .dropzone .dropzone-text i {
    font-size: 32px;
}
.drop-modal .drop-photo .dropzone .dropzone-text span {
    font-size: 13px;
    font-weight: 500;
    text-align: center;
}
@media (max-width: 768px) {
    .drop-modal .drop-product-row {
        grid-template-columns: 1fr;
        padding-right: 20px;
    }
    .drop-modal .drop-fields {
        grid-template-columns: 1fr;
    }
}


.estado-entregado {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Estilos para la celda de estado */
.estado-cell {
    vertical-align: middle;
    text-align: center;
    white-space: nowrap;
}

.estado-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    margin-right: 8px;
}

.estado-pedido {
    background-color: #ffc107;
    color: #000;
}

.estado-entregado {
    background-color: #28a745;
    color: white;
}

.btn-cambiar-estado {
    padding: 4px 6px;
    border: none;
    border-radius: 4px;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
}

.btn-cambiar-estado:hover {
    background-color: var(--primary-color-dark);
}

.btn-cambiar-estado i {
    font-size: 14px;
}

.data-table .product-photo {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
}

/* --- Estilos para el Modal de Detalles de Venta --- */
#sale-details-content .sale-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

#sale-details-content .sale-details-info p {
    margin: 0;
    font-size: 14px;
    color: var(--text-color-light);
}

#sale-details-content .sale-details-info p strong {
    display: block;
    font-size: 16px;
    color: var(--text-color);
    font-weight: 600;
}

#sale-details-content .sale-details-products h4 {
    margin-top: 0;
    margin-bottom: 10px;
    font-weight: 600;
}

#sale-details-content .sale-details-summary {
    text-align: right;
    margin-top: 20px;
    font-size: 1.3em;
    font-weight: 700;
    color: var(--primary-color);
}

/* Estilos para el modal de detalles de compra */
.purchase-details-modal {
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.purchase-info {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.info-row:last-child {
    border-bottom: none;
}

.info-row .label {
    font-weight: 600;
    color: #495057;
    min-width: 120px;
}

.info-row .value {
    color: #212529;
    text-align: right;
}

.info-row .value.total-amount {
    font-size: 1.2em;
    font-weight: 700;
    color: #28a745;
}

.products-section h3 {
    color: #495057;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.products-table-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

.products-details-table th {
    background: #6c757d;
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 600;
}

.products-details-table td {
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.products-details-table tr:last-child td {
    border-bottom: none;
}

.product-image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid #e9ecef;
}

.product-image-placeholder {
    width: 50px;
    height: 50px;
    background: #e9ecef;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 20px;
}

/* Botón de detalles */
.btn-details {
    background: #8BB3D9;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-details:hover {
    background: #6a9bc7;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(139, 179, 217, 0.3);
}

.btn-details i {
    font-size: 16px;
}

.btn-edit-inline {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 10px;
    transition: background-color 0.3s;
}

.btn-edit-inline:hover {
    background: #8bb3d9;
}

.btn-edit-inline i {
    font-size: 14px;
}

/* Estilos para el modal de detalles de gasto */
.expense-details-modal {
    max-width: 600px;
    width: 90%;
}

.expense-info {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
}

/* Estilos para categorías de gastos */
.categoria-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.categoria-renta { background-color: #e3f2fd; color: #1976d2; }
.categoria-servicios { background-color: #f3e5f5; color: #7b1fa2; }
.categoria-telecomunicaciones { background-color: #e8f5e8; color: #388e3c; }
.categoria-mantenimiento { background-color: #fff3e0; color: #f57c00; }
.categoria-marketing { background-color: #fce4ec; color: #c2185b; }
.categoria-personal { background-color: #e0f2f1; color: #00695c; }
.categoria-impuestos { background-color: #ffebee; color: #d32f2f; }
.categoria-otros { background-color: #f5f5f5; color: #616161; }

/* Estilos para métodos de pago */
.metodo-pago-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.metodo-efectivo { background-color: #e8f5e8; color: #388e3c; }
.metodo-tarjeta_debito { background-color: #e3f2fd; color: #1976d2; }

/* Estilos para campo de total con botón de edición */
.input-with-button {
    display: flex;
    gap: 5px;
    align-items: stretch;
}

.input-with-button input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px 0 0 8px;
    border-right: none;
}

.input-with-button .btn-edit-total {
    padding: 10px 12px;
    background-color: var(--secondary-color);
    color: #fff;
    border: 1px solid var(--secondary-color);
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-with-button .btn-edit-total:hover {
    background-color: #7bb8e8;
}

.input-with-button .btn-edit-total i {
    font-size: 16px;
}
.metodo-tarjeta_credito { background-color: #fff3e0; color: #f57c00; }
.metodo-transferencia { background-color: #f3e5f5; color: #7b1fa2; }
.metodo-cheque { background-color: #fce4ec; color: #c2185b; }

/* Estilos para grupo de botones en tabla de gastos */
.button-group {
    display: flex;
    gap: 5px;
    align-items: center;
    justify-content: flex-start;
}

.btn-details-small {
    background: #8BB3D9;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.3s ease;
    min-width: 75px;
    height: 32px;
    font-weight: 500;
}

.btn-details-small:hover {
    background: #6a9bc7;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(139, 179, 217, 0.3);
}

.btn-details-small i {
    font-size: 14px;
}
/* Modal de Drop */
.drop-modal .modal-content {
    max-width: 860px;
    width: 92%;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 20px;
    background: #fff;
}
.drop-modal .modal-header {
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 18px;
}
.drop-modal .modal-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}
.drop-modal .form-group label {
    color: var(--text-color);
    font-weight: 600;
}
.drop-modal #drop-title {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 14px;
}
.drop-modal #add-drop-product-row {
    height: 36px;
    border-radius: 8px;
}
.drop-modal #drop-products-list {
    gap: 12px;
}
.drop-modal .drop-product-row {
    position: relative;
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 12px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 48px 12px 12px;
    transition: box-shadow .2s ease, transform .2s ease;
}
.drop-modal .drop-product-row:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}
.drop-modal .drop-product-row .drop-photo {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 110px;
}
.drop-modal .drop-product-row .drop-photo .dropzone {
    height: 90px;
}
.drop-modal .drop-fields {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.drop-modal .drop-fields .field.full {
    grid-column: 1 / -1;
}
.drop-modal .drop-photo input[type="file"] {
    width: 100%;
}
.drop-modal .drop-product-row label {
    font-size: 11px;
    color: var(--text-color-light);
    margin-bottom: 4px;
}
.drop-modal .drop-product-row input {
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    max-width: 100%;
}
.drop-modal .remove-drop-row {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}
.drop-modal .remove-drop-row i {
    font-size: 18px;
}
.drop-modal .modal-body .btn-primary {
    height: 40px;
    border-radius: 10px;
    font-weight: 600;
}
.drop-modal .modal-body .btn-secondary {
    height: 40px;
    border-radius: 10px;
    font-weight: 600;
}
.drop-modal .modal-content {
    overflow-x: hidden;
}
@media (max-width: 768px) {
    .drop-modal .drop-product-row {
        grid-template-columns: 1fr;
    }
    .drop-modal .drop-fields {
        grid-template-columns: 1fr;
    }
    .drop-modal .drop-product-row .drop-photo {
        width: 100%;
    }
    .drop-modal .drop-product-row .drop-photo .dropzone {
        height: 160px;
    }
}
@media (max-width: 520px) {
    .drop-modal .drop-product-row {
        grid-template-columns: 1fr;
        padding-right: 56px;
    }
}

.data-table tr.drop-child-row td {
    background: #E8A0BF;
}

.inline-sale-status {
    width: auto;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    border: 1px solid transparent;
    background: #f3f4f6;
    color: #111827;
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
    line-height: 1.2;
}

.inline-sale-status:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(232, 160, 191, 0.35);
}

.inline-sale-status.status-updating {
    opacity: 0.6;
    cursor: progress;
}

.inline-sale-status.status-pagada {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.inline-sale-status.status-separada {
    background-color: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

.inline-sale-status.status-pendiente_entregar {
    background-color: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

.inline-sale-status.status-entregado {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.inline-sale-status.status-no_aplica {
    background-color: #e5e7eb;
    border-color: #d1d5db;
    color: #374151;
}

.inline-sale-status.status-empaquetado {
    background-color: #dbeafe;
    border-color: #bfdbfe;
    color: #1e40af;
}

.inline-sale-status.status-enviado {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.inline-sale-status.status-unknown {
    background-color: #f3f4f6;
    border-color: #e5e7eb;
    color: #111827;
}
