/* Reset y configuración base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4facfe;
    --secondary-color: #00f2fe;
    --accent-color: #ff6b6b;
    --success-color: #43e97b;
    --warning-color: #fa709a;
    --danger-color: #ff6b6b;
    --info-color: #667eea;
    
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --text-light: #718096;
    --text-white: #ffffff;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f7fafc;
    --bg-accent: #edf2f7;
    --bg-sidebar: #2d3748;
    --bg-sidebar-hover: #4a5568;
    
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    
    --shadow-sm: 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);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --gradient-primary: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    --gradient-accent: linear-gradient(135deg, var(--accent-color), var(--primary-color));
    --gradient-success: linear-gradient(135deg, var(--success-color), var(--accent-color));
    
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --border-radius-xl: 16px;
    
    --transition: all 0.3s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    overflow-x: hidden;
}

/* Notificaciones / Toasts */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notification {
    background: white;
    padding: 15px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    animation: slideIn 0.3s ease;
    border-left: 4px solid var(--primary-color);
}

.notification.success { border-left-color: var(--success-color); }
.notification.error { border-left-color: var(--danger-color); }
.notification.warning { border-left-color: var(--warning-color); }
.notification.info { border-left-color: var(--info-color); }

.notification-icon {
    font-size: 20px;
}

.notification.success .notification-icon { color: var(--success-color); }
.notification.error .notification-icon { color: var(--danger-color); }
.notification.warning .notification-icon { color: var(--warning-color); }
.notification.info .notification-icon { color: var(--info-color); }

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    margin-bottom: 2px;
    font-size: 14px;
}

.notification-message {
    font-size: 13px;
    color: var(--text-secondary);
}

.notification-close {
    cursor: pointer;
    color: var(--text-light);
    font-size: 14px;
}

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

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

/* Header */
.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 70px;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 100%;
    max-width: 100%;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    height: 40px;
    width: auto;
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 30px;
}

.user-info, .fecha-hora {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-weight: 500;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

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

.user-info i, .fecha-hora i {
    color: var(--primary-color);
}

/* Main Container */
.main-container {
    display: flex;
    margin-top: 70px;
    min-height: calc(100vh - 70px);
}

/* Sidebar - Siempre visible y contraído (solo iconos) */
.sidebar {
    width: 70px;
    background: var(--bg-sidebar);
    color: var(--text-white);
    position: fixed;
    left: 0;
    top: 70px;
    bottom: 0;
    overflow-y: auto;
    overflow-x: visible;
    z-index: 999;
    transition: width 0.3s ease;
}

.sidebar:hover {
    width: 250px;
    overflow-x: visible;
}

.sidebar-header {
    padding: 15px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.sidebar-header h3 {
    font-size: 0;
    font-weight: 600;
    display: none;
}

.sidebar-nav {
    padding: 10px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 15px 10px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: var(--transition);
    border-left: 3px solid transparent;
    position: relative;
    width: 100%;
    overflow: visible;
}

.nav-item:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-white);
}

.nav-item.active {
    background: var(--bg-sidebar-hover);
    color: var(--text-white);
    border-left-color: var(--primary-color);
}

.nav-item i {
    width: 24px;
    text-align: center;
    font-size: 20px;
    flex-shrink: 0;
}

.nav-item span {
    display: block;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
    width: 0;
    overflow: hidden;
}

.sidebar:hover .nav-item span {
    opacity: 1;
    width: auto;
}

.nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 10px 15px;
}

.nav-section-title {
    padding: 10px;
    font-size: 0;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 10px;
    display: none;
}

/* Content */
.content {
    flex: 1;
    margin-left: 70px;
    padding: 0;
    background: var(--bg-secondary);
    position: relative;
    width: calc(100% - 70px);
}

#iframe-container {
    width: 100%;
    height: calc(100vh - 70px);
    background: var(--bg-secondary);
}

#iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Ocultar headers de módulos cargados en iframe */
#iframe-container iframe[src*="catalogos"] body header.header,
#iframe-container iframe[src*="catalogos"] body .catalog-page-title,
#iframe-container iframe[src*="inventario"] body header.header,
#iframe-container iframe[src*="compras"] body header.header,
#iframe-container iframe[src*="reportes"] body header.header {
    display: none !important;
}

.content iframe {
    width: 100%;
    height: calc(100vh - 70px);
    border: none;
    display: block;
}

.section {
    display: none;
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    min-height: calc(100vh - 110px);
}

.section.active {
    display: block;
}

/* Dashboard Styles */
.dashboard-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: 25px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

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

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.section-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.section-actions {
    display: flex;
    gap: 10px;
}

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

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

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

.btn-secondary {
    background: var(--bg-accent);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

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

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

.btn-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: var(--text-white);
}

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

.btn-warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: var(--text-white);
}

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

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

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

/* Punto de Venta */
.pos-title-bar {
    background: var(--bg-primary);
    padding: 15px 20px;
    border-bottom: 2px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
}

.pos-title-bar h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    min-width: 150px;
}

.pos-title-bar h2::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

.pos-title-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-start;
    flex: 1;
    margin-left: 20px;
}

.pos-title-actions .documentos-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pos-title-actions .documentos-buttons .btn {
    font-size: 12px;
    padding: 8px 16px;
}

.pos-container {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 0;
    padding: 0;
    margin-top: 0;
    height: calc(100vh - 70px);
    overflow: hidden;
    width: 100%;
}

/* Productos Section */
.productos-section {
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.productos-header {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* Panel de botones de documentos encima del buscador */
.documentos-panel {
    background: var(--bg-secondary);
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
}

.documentos-panel .btn {
    font-size: 12px;
    padding: 8px 16px;
    white-space: nowrap;
}

.search-container {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.search-container input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
}

.search-container input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(240, 147, 251, 0.1);
}

.btn-search {
    padding: 12px 16px;
    background: var(--gradient-primary);
    color: var(--text-white);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

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

.categorias-container {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    width: 100%;
}

.categorias-lista {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.categoria-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-accent);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}

.categoria-btn:hover,
.categoria-btn.active {
    background: var(--gradient-primary);
    color: var(--text-white);
    border-color: transparent;
}

.productos-grid {
    flex: 1;
    padding: 10px 15px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.producto-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 10px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: var(--shadow-sm);
}

.producto-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.producto-imagen {
    height: 120px;
    background: var(--bg-accent);
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.producto-imagen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.producto-imagen i {
    font-size: 32px;
    color: var(--text-light);
}

.producto-info h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
    line-height: 1.3;
}

.producto-stock {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.producto-stock.low {
    color: var(--warning-color);
}

.producto-stock.out {
    color: var(--danger-color);
}

.producto-precio {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-color);
    margin-top: auto;
}

/* Carrito Section */
.carrito-section {
    background: var(--bg-primary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    z-index: 10;
}

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

.carrito-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.carrito-items {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.carrito-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
    animation: slideIn 0.3s ease;
}

.item-info h4 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}

.item-price {
    font-size: 13px;
    color: var(--text-secondary);
}

.item-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qty-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: var(--transition);
}

.qty-btn:hover {
    background: var(--bg-accent);
    border-color: var(--text-light);
}

.item-qty {
    font-size: 14px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.item-total {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 14px;
    min-width: 60px;
    text-align: right;
}

.item-remove {
    color: var(--text-light);
    cursor: pointer;
    padding: 4px;
    transition: var(--transition);
}

.item-remove:hover {
    color: var(--danger-color);
}

.carrito-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.resumen-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.resumen-row.total {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 15px;
    margin-bottom: 20px;
}

.btn-pagar {
    width: 100%;
    padding: 15px;
    background: var(--gradient-success);
    color: var(--text-white);
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

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

.btn-pagar:disabled {
    background: var(--text-light);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Modales */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

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

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.btn-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-light);
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

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

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

/* Tablas */
.table-container {
    overflow-x: auto;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-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);
}

.data-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    font-size: 14px;
    color: var(--text-primary);
}

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

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

/* Responsive */
@media (max-width: 1024px) {
    .pos-container {
        grid-template-columns: 1fr 320px;
    }
    
    .productos-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (max-width: 768px) {
    .pos-container {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }
    
    .sidebar {
        width: 0;
        overflow: hidden;
    }
    
    .sidebar.active {
        width: 250px;
    }
    
    .content {
        margin-left: 0;
        width: 100%;
    }
    
    .pos-title-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .pos-title-actions {
        margin-left: 0;
        width: 100%;
        overflow-x: auto;
        padding-bottom: 5px;
    }
    
    .carrito-section {
        position: fixed;
        right: -100%;
        top: 70px;
        bottom: 0;
        width: 80%;
        max-width: 350px;
        transition: right 0.3s ease;
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    }
    
    .carrito-section.active {
        right: 0;
    }
}