/**
 * LAS PITITAS v3.0 - Estilos Mobile-First
 * ========================================
 */

/* ==========================================
   VARIABLES CSS
   ========================================== */
:root {
    /* Colores principales */
    --primary: #f59e0b;
    --primary-dark: #d97706;
    --primary-light: #fbbf24;
    
    --secondary: #1a1a2e;
    --secondary-light: #16213e;
    
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    /* Fondos */
    --bg-dark: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-input: #16213e;
    
    /* Texto */
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Bordes */
    --border-color: #2d2d44;
    --border-radius: 12px;
    --border-radius-lg: 16px;
    
    /* Sombras */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
    
    /* Espaciado */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    
    /* Tamaños de fuente */
    --font-xs: 12px;
    --font-sm: 14px;
    --font-md: 16px;
    --font-lg: 18px;
    --font-xl: 24px;
    --font-2xl: 32px;
    
    /* Altura mínima de elementos touch */
    --touch-min: 48px;
    
    /* Safe areas */
    --safe-top: env(safe-area-inset-top, 0);
    --safe-bottom: env(safe-area-inset-bottom, 0);
}

/* ==========================================
   RESET Y BASE
   ========================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
}

/* ==========================================
   TIPOGRAFÍA
   ========================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
}

h1 { font-size: var(--font-2xl); }
h2 { font-size: var(--font-xl); }
h3 { font-size: var(--font-lg); }

p { margin-bottom: var(--space-md); }

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

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

/* Indicador de versión */
.version-indicator {
    position: fixed;
    top: 8px;
    right: 8px;
    background: rgba(245, 158, 11, 0.9);
    color: #000;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    z-index: 9999;
    pointer-events: none;
}

/* Filtros inline */
.filtros-inline {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
}

.filtros-inline .form-input-sm {
    flex: 1;
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-sm);
}

.filtros-inline .btn-sm {
    padding: var(--space-xs) var(--space-sm);
    min-width: 40px;
}

/* Resumen historial */
.historial-resumen {
    display: flex;
    justify-content: space-around;
    padding: var(--space-sm);
    background: var(--bg-card);
    border-radius: var(--border-radius);
    margin-bottom: var(--space-sm);
}

.historial-resumen .resumen-item {
    text-align: center;
    font-size: var(--font-sm);
    font-weight: 500;
}

/* Comprobante modal */
.comprobante-numero {
    font-size: var(--font-lg);
    font-weight: 700;
    color: var(--primary);
}

.comprobante-monto {
    font-size: var(--font-2xl);
    font-weight: 700;
    margin: var(--space-sm) 0;
}

/* ==========================================
   CAJA MEJORADA
   ========================================== */
.filtros-caja {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}

.filtros-rapidos {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.filtro-btn {
    flex: 1;
    padding: var(--space-md) var(--space-sm);
    border: none;
    background: var(--bg-input);
    color: var(--text-secondary);
    border-radius: var(--border-radius);
    font-size: var(--font-base, 16px);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filtro-btn:active {
    transform: scale(0.95);
}

.filtros-fecha {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
}

.filtros-fecha .form-input-sm {
    flex: 1;
    padding: var(--space-xs);
    font-size: var(--font-sm);
}

/* Movimientos lista */
.movimientos-lista {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.movimiento-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--bg-card);
    border-radius: var(--border-radius);
}

.movimiento-icono {
    font-size: 20px;
}

.movimiento-contenido {
    flex: 1;
    min-width: 0;
}

.movimiento-titulo {
    font-weight: 500;
    font-size: var(--font-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.movimiento-fecha {
    font-size: 11px;
    color: var(--text-muted);
}

.movimiento-monto {
    font-weight: 600;
    font-size: var(--font-sm);
    white-space: nowrap;
}

/* ==========================================
   FILTROS LISTA Y TOGGLE ACTIVO
   ========================================== */
.filtros-lista {
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
}

.filtros-lista .form-input {
    flex: 1;
}

.filtros-lista .form-select-sm {
    flex: 0 0 100px;
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-sm);
}

/* Item inactivo */
.list-item.item-inactivo {
    opacity: 0.6;
}

.badge-inactivo {
    display: inline-block;
    background: var(--danger);
    color: white;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
}

/* Toggle activo container */
.toggle-activo-container {
    margin-top: var(--space-md);
}

.toggle-activo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-activo.activo {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success);
}

.toggle-activo.inactivo {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
}

.toggle-activo .toggle-label {
    font-weight: 500;
}

.toggle-activo .toggle-action {
    font-size: var(--font-sm);
    color: var(--text-muted);
    text-decoration: underline;
}

.toggle-activo:active {
    transform: scale(0.98);
}

/* Header actions */
.modal-header .header-actions {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
}

/* ==========================================
   BADGES DE MODIFICADO
   ========================================== */
.badge-modificado {
    display: inline-block;
    background: var(--warning);
    color: #000;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
    vertical-align: middle;
}

.badge-modificado-sm {
    font-size: 10px;
    margin-left: 4px;
}

.detalle-modificacion {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning);
    border-radius: var(--border-radius);
    padding: var(--space-sm);
    font-size: var(--font-sm);
    color: var(--warning);
    margin-top: var(--space-md);
    text-align: center;
}

/* Movimiento editable */
.movimiento-item.editable {
    cursor: pointer;
}

.movimiento-item.editable:active {
    background: rgba(255, 255, 255, 0.05);
}

.movimiento-editar {
    font-size: 14px;
    opacity: 0.5;
    margin-left: var(--space-xs);
}

/* Lista productos scroll */
.productos-lista-scroll {
    max-height: 300px;
    overflow-y: auto;
}

.main-content {
    flex: 1;
    padding: var(--space-md);
    padding-bottom: calc(var(--space-xl) + 70px); /* Espacio para nav bottom */
}

/* ==========================================
   HEADER
   ========================================== */
.header {
    background: var(--bg-card);
    padding: var(--space-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-lg);
    font-weight: 600;
}

.header-title .icon {
    font-size: 24px;
}

.header-stock {
    background: var(--bg-input);
    padding: var(--space-xs) var(--space-md);
    border-radius: 20px;
    font-size: var(--font-sm);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.header-stock .stock-count {
    color: var(--primary);
    font-weight: 600;
}

/* ==========================================
   NAVEGACIÓN INFERIOR
   ========================================== */
.nav-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: var(--space-sm);
    padding-bottom: calc(var(--space-sm) + var(--safe-bottom));
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--space-xs);
    color: var(--text-muted);
    font-size: var(--font-xs);
    min-width: 60px;
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item .nav-icon {
    font-size: 24px;
}

/* ==========================================
   BOTONES
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    min-height: var(--touch-min);
    padding: var(--space-sm) var(--space-lg);
    border: none;
    border-radius: var(--border-radius);
    font-size: var(--font-md);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.98);
}

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

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

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

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

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

.btn-block {
    width: 100%;
}

.btn-lg {
    min-height: 56px;
    font-size: var(--font-lg);
    border-radius: var(--border-radius-lg);
}

/* Botón grande con icono (para menú principal) */
.btn-menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--space-lg);
    min-height: 120px;
    width: 100%;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.btn-menu:active {
    background: var(--bg-input);
    transform: scale(0.98);
}

.btn-menu .menu-icon {
    font-size: 48px;
}

.btn-menu .menu-label {
    font-size: var(--font-md);
    font-weight: 500;
}

.btn-menu .menu-sublabel {
    font-size: var(--font-xs);
    color: var(--text-secondary);
}

/* ==========================================
   INPUTS
   ========================================== */
.form-group {
    margin-bottom: var(--space-md);
}

.form-label {
    display: block;
    margin-bottom: var(--space-xs);
    font-size: var(--font-sm);
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    min-height: var(--touch-min);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: var(--font-md);
    transition: border-color 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* Input grande para números */
.form-input-lg {
    font-size: var(--font-xl);
    text-align: center;
    padding: var(--space-md);
    min-height: 64px;
}

/* Select */
.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-md) center;
    padding-right: 48px;
}

/* ==========================================
   CARDS
   ========================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.card-title {
    font-size: var(--font-lg);
    font-weight: 600;
}

/* ==========================================
   GRIDS
   ========================================== */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
}

/* ==========================================
   ALERTAS Y BADGES
   ========================================== */
.alert {
    padding: var(--space-md);
    border-radius: var(--border-radius);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

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

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

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

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: var(--font-xs);
    font-weight: 500;
}

.badge-primary { background: var(--primary); color: var(--secondary); }
.badge-success { background: var(--success); color: white; }
.badge-danger { background: var(--danger); color: white; }

/* ==========================================
   INDICADOR OFFLINE
   ========================================== */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--danger);
    color: white;
    padding: var(--space-xs) var(--space-md);
    text-align: center;
    font-size: var(--font-sm);
    z-index: 1000;
    display: none;
}

.offline-indicator.show {
    display: block;
}

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */
.toast-container {
    position: fixed;
    bottom: 80px;
    left: var(--space-md);
    right: var(--space-md);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-info { border-left: 4px solid var(--info); }

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

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

/* ==========================================
   LOADING
   ========================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 15, 26, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    z-index: 2000;
}

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

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

.loading-message {
    color: var(--text-secondary);
}

/* ==========================================
   PÁGINA LOGIN
   ========================================== */
.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
}

.login-logo {
    font-size: 64px;
    margin-bottom: var(--space-md);
}

.login-title {
    font-size: var(--font-2xl);
    margin-bottom: var(--space-xs);
}

.login-subtitle {
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
}

.login-form {
    width: 100%;
    max-width: 320px;
}

/* ==========================================
   LISTA DE ITEMS
   ========================================== */
.list-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: var(--space-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.list-item:active {
    background: var(--bg-input);
}

.list-item-icon {
    font-size: 32px;
}

.list-item-content {
    flex: 1;
}

.list-item-title {
    font-weight: 500;
}

.list-item-subtitle {
    font-size: var(--font-sm);
    color: var(--text-secondary);
}

.list-item-value {
    text-align: right;
}

.list-item-value .value {
    font-size: var(--font-lg);
    font-weight: 600;
    color: var(--primary);
}

/* ==========================================
   FILTROS DE FECHA
   ========================================== */
.filter-tabs {
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.filter-tab {
    flex-shrink: 0;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: var(--font-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-tab.active {
    background: var(--primary);
    color: var(--secondary);
    border-color: var(--primary);
}

/* ==========================================
   ESTADÍSTICAS
   ========================================== */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    text-align: center;
}

.stat-icon {
    font-size: 32px;
    margin-bottom: var(--space-xs);
}

.stat-value {
    font-size: var(--font-xl);
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: var(--font-xs);
    color: var(--text-secondary);
}

/* ==========================================
   FAB (Floating Action Button)
   ========================================== */
.fab {
    position: fixed;
    bottom: 90px;
    right: var(--space-md);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--secondary);
    border: none;
    font-size: 24px;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    z-index: 90;
    transition: all 0.3s ease;
}

.fab:active {
    transform: scale(0.95);
}

.fab-menu {
    position: fixed;
    bottom: 160px;
    right: var(--space-md);
    display: none;
    flex-direction: column;
    gap: var(--space-sm);
    z-index: 90;
}

.fab-menu.show {
    display: flex;
}

.fab-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    color: var(--text-primary);
    font-size: var(--font-sm);
    white-space: nowrap;
    box-shadow: var(--shadow-md);
}

/* ==========================================
   MODAL
   ========================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 500;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: var(--space-lg);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: var(--space-sm);
}

/* ==========================================
   RESPONSIVE DESKTOP
   ========================================== */
@media (min-width: 768px) {
    .main-content {
        max-width: 600px;
        margin: 0 auto;
        padding-bottom: var(--space-xl);
    }
    
    
    /* Sidebar para desktop */
    .sidebar {
        display: block;
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 240px;
        background: var(--bg-card);
        border-right: 1px solid var(--border-color);
        padding: var(--space-lg);
    }
    
    .app-container.with-sidebar .main-content {
        margin-left: 240px;
    }
    
    .modal {
        max-width: 500px;
        border-radius: var(--border-radius-lg);
        margin: auto;
    }
    
    .modal-overlay.show {
        align-items: center;
    }
}

/* ==========================================
   UTILIDADES
   ========================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.hidden { display: none !important; }
.flex { display: flex; }
.flex-between { justify-content: space-between; }
.flex-center { align-items: center; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }

/* ==========================================
   RADIO GROUP
   ========================================== */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.radio-option {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.radio-option:has(input:checked) {
    border-color: var(--primary);
    background: rgba(245, 158, 11, 0.1);
}

.radio-option input {
    accent-color: var(--primary);
    width: 20px;
    height: 20px;
}

.radio-option span {
    font-size: var(--font-md);
}

/* ==========================================
   CAJA ESTILOS
   ========================================== */
.caja-section {
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-color);
}

.caja-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.caja-section h4 {
    font-size: var(--font-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.caja-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xs) 0;
}

.caja-row.caja-total {
    font-weight: 600;
    padding-top: var(--space-sm);
    margin-top: var(--space-sm);
    border-top: 1px dashed var(--border-color);
}

.caja-balance {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    background: var(--bg-input);
    border-radius: var(--border-radius);
    font-size: var(--font-lg);
    font-weight: 700;
}

/* ==========================================
   BOTONES ADICIONALES
   ========================================== */
.btn-back {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: var(--space-xs);
    margin-right: var(--space-xs);
}

.btn-icon {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: var(--space-sm);
    opacity: 0.7;
    transition: opacity 0.2s;
}

.btn-icon:hover {
    opacity: 1;
}

/* ==========================================
   LIST ITEM PEQUEÑO
   ========================================== */
.list-item-small {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-input);
    border-radius: var(--border-radius);
    margin-bottom: var(--space-xs);
    font-size: var(--font-sm);
}

/* ==========================================
   MEJORAS RESPONSIVE
   ========================================== */
@media (max-width: 380px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
    
    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-sm);
    }
    
    .stat-card {
        padding: var(--space-sm);
    }
    
    .stat-icon {
        font-size: 24px;
    }
    
    .stat-value {
        font-size: var(--font-lg);
    }
}

/* ==========================================
   MODAL COMPROBANTE EXITO
   ========================================== */
.comprobante-exito {
    text-align: center;
    padding: var(--space-lg) 0;
}

.comprobante-icono {
    font-size: 64px;
    margin-bottom: var(--space-sm);
}

.comprobante-tipo {
    font-size: var(--font-lg);
    font-weight: 600;
    color: var(--success);
    margin-bottom: var(--space-xs);
}

.comprobante-numero {
    font-size: var(--font-xl);
    font-weight: 700;
    color: var(--primary);
}

.comprobante-acciones {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.comprobante-acciones .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

/* ==========================================
   MODAL FULL (detalle cliente/proveedor)
   ========================================== */
.modal-full {
    max-height: 90vh;
    overflow-y: auto;
}

/* ==========================================
   INFO CARD (detalle)
   ========================================== */
.info-card {
    background: var(--bg-input);
    border-radius: var(--border-radius);
    padding: var(--space-md);
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-color);
}

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

.info-label {
    color: var(--text-muted);
    font-size: var(--font-sm);
}

.info-value {
    font-weight: 500;
    text-align: right;
}

.saldo-row.debe {
    background: rgba(239, 68, 68, 0.1);
    margin: var(--space-sm) calc(var(--space-md) * -1);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--border-radius);
}

.saldo-row.debe .info-value {
    color: var(--danger);
    font-weight: 700;
}

.saldo-row.ok .info-value {
    color: var(--success);
}

/* ==========================================
   CLIENTE ACCIONES
   ========================================== */
.cliente-acciones {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.cliente-acciones .btn {
    flex: 1;
    padding: var(--space-sm);
    font-size: var(--font-sm);
}

/* ==========================================
   HISTORIAL LISTA
   ========================================== */
.historial-lista {
    max-height: 300px;
    overflow-y: auto;
}

.historial-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    border-bottom: 1px solid var(--border-color);
}

.historial-item:last-child {
    border-bottom: none;
}

.historial-icono {
    font-size: 20px;
    width: 32px;
    text-align: center;
}

.historial-contenido {
    flex: 1;
}

.historial-titulo {
    font-weight: 500;
    font-size: var(--font-sm);
}

.historial-fecha {
    font-size: 11px;
    color: var(--text-muted);
}

.historial-monto {
    font-weight: 600;
    font-size: var(--font-md);
}

/* ==========================================
   CONFIG ROW
   ========================================== */
.config-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-sm) 0;
    border-bottom: 1px dotted var(--border-color);
}

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

/* List item small mejorado para productos */
.list-item-small {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-input);
    border-radius: var(--border-radius);
    margin-bottom: var(--space-xs);
    cursor: pointer;
    transition: background 0.2s;
}

.list-item-small:hover {
    background: var(--bg-card);
}

.list-item-small .list-item-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.list-item-small .list-item-title {
    font-weight: 500;
    font-size: var(--font-sm);
}

.list-item-small .list-item-subtitle {
    font-size: 11px;
    color: var(--text-muted);
}

.list-item-small .list-item-value {
    font-weight: 600;
    color: var(--primary);
}

/* ==========================================
   ENTREGAS MULTI-ITEM
   ========================================== */
.modal-body-scroll {
    max-height: 60vh;
    overflow-y: auto;
    padding-bottom: var(--space-md);
}

.modal-footer {
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-color);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: var(--space-md) 0 var(--space-sm);
    font-weight: 600;
}

.section-header .btn-sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-sm);
}

/* Items de entrega - Diseño profesional móvil */
.entrega-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-input);
    border-radius: var(--border-radius);
    margin-bottom: var(--space-xs);
    border-left: 3px solid var(--primary);
}

.entrega-item-info {
    min-width: 0;
}

.entrega-item-nombre {
    font-weight: 600;
    font-size: var(--font-md);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.entrega-item-detalle {
    font-size: var(--font-sm);
    color: var(--text-muted);
    display: flex;
    gap: var(--space-sm);
}

.entrega-item-detalle .huevos {
    color: var(--text-light);
}

.entrega-item-detalle .precio {
    color: var(--primary);
    font-weight: 500;
}

.entrega-item-cantidad {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border-radius: 20px;
    padding: 2px;
}

.btn-cantidad {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: var(--primary);
    color: var(--secondary);
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s, opacity 0.1s;
}

.btn-cantidad:active {
    transform: scale(0.9);
}

.cantidad-valor {
    min-width: 32px;
    text-align: center;
    font-weight: 700;
    font-size: var(--font-md);
}

.entrega-item .btn-eliminar {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.entrega-item .btn-eliminar:active {
    background: rgba(239, 68, 68, 0.3);
}

/* Items vacíos */
.entrega-items-vacio {
    text-align: center;
    padding: var(--space-lg);
    background: var(--bg-input);
    border-radius: var(--border-radius);
    border: 2px dashed var(--border-color);
    color: var(--text-muted);
}

/* Totales de entrega */
.entrega-totales {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    margin: var(--space-md) 0;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-xs) 0;
}

.total-destacado {
    font-size: var(--font-lg);
    font-weight: 700;
    color: var(--primary);
    border-top: 1px solid var(--border-color);
    padding-top: var(--space-sm);
    margin-top: var(--space-sm);
}

/* Pagos container */
.pagos-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
}

.pago-cc-info {
    grid-column: span 2;
    display: flex;
    justify-content: space-between;
    padding: var(--space-sm);
    background: rgba(245, 158, 11, 0.1);
    border-radius: var(--border-radius);
    font-weight: 500;
}

.form-hint {
    font-size: var(--font-sm);
    margin-top: var(--space-xs);
}

/* Detalle de entrega */
.detalle-entrega {
    padding: var(--space-sm);
}

.detalle-header {
    text-align: center;
    margin-bottom: var(--space-md);
}

.detalle-numero {
    font-size: var(--font-lg);
    font-weight: 700;
    color: var(--primary);
}

.detalle-fecha {
    color: var(--text-muted);
    font-size: var(--font-sm);
}

.detalle-cliente {
    background: var(--bg-input);
    padding: var(--space-sm);
    border-radius: var(--border-radius);
    margin-bottom: var(--space-md);
}

.detalle-entrega h4 {
    margin: var(--space-md) 0 var(--space-sm);
    font-size: var(--font-sm);
    color: var(--text-muted);
    text-transform: uppercase;
}

.detalle-items, .detalle-pagos {
    background: var(--bg-input);
    border-radius: var(--border-radius);
    padding: var(--space-sm);
}

.detalle-item-row, .detalle-pago-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-xs) 0;
    border-bottom: 1px dotted var(--border-color);
}

.detalle-item-row:last-child, .detalle-pago-row:last-child {
    border-bottom: none;
}

.detalle-total {
    display: flex;
    justify-content: space-between;
    padding: var(--space-md);
    background: var(--primary);
    color: var(--secondary);
    border-radius: var(--border-radius);
    margin-top: var(--space-sm);
    font-weight: 600;
}

.detalle-obs {
    margin-top: var(--space-md);
    padding: var(--space-sm);
    background: var(--bg-input);
    border-radius: var(--border-radius);
    font-size: var(--font-sm);
    color: var(--text-muted);
}

/* ==========================================
   PRODUCCIÓN - SELECTOR FECHA
   ========================================== */
.fecha-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    padding: var(--space-sm);
    background: var(--bg-input);
    border-radius: var(--border-radius);
}

.fecha-input {
    text-align: center;
    font-weight: 600;
    max-width: 160px;
}

.fecha-selector .btn-icon:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Item con registro exitoso */
.list-item-success {
    border-left: 3px solid var(--success);
}

.produccion-resumen {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: var(--font-sm);
    gap: 2px;
}

/* Textarea */
.form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* ==========================================
   HISTORIAL PRODUCCIÓN
   ========================================== */
.filtros-historial {
    background: var(--bg-card);
    padding: var(--space-md);
    border-radius: var(--border-radius);
    margin-bottom: var(--space-md);
}

.filtro-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
}

.historial-totales {
    margin-bottom: var(--space-md);
}

/* Tabs container */
.tabs-container {
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
    background: var(--bg-card);
    padding: 4px;
    border-radius: var(--border-radius);
}

.tab-btn {
    flex: 1;
    padding: var(--space-sm);
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 500;
    border-radius: calc(var(--border-radius) - 2px);
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--primary);
    color: var(--secondary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Gráficos */
.graficos-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.grafico-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: var(--space-md);
}

.grafico-card h4 {
    margin: 0 0 var(--space-sm);
    font-size: var(--font-sm);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.grafico-wrapper {
    position: relative;
    height: 200px;
    width: 100%;
}

.grafico-wrapper canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
}

.totales-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
    text-align: center;
}

.total-item {
    background: var(--bg-card);
    padding: var(--space-sm);
    border-radius: var(--border-radius);
}

.total-valor {
    font-size: var(--font-lg);
    font-weight: 700;
}

.total-label {
    font-size: 11px;
    color: var(--text-muted);
}

.historial-produccion-lista {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.historial-prod-item {
    background: var(--bg-card);
    padding: var(--space-md);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: transform 0.1s;
}

.historial-prod-item:active {
    transform: scale(0.98);
}

.historial-prod-fecha {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-xs);
}

.fecha-dia {
    font-weight: 600;
}

.fecha-gallinero {
    color: var(--text-muted);
    font-size: var(--font-sm);
}

.historial-prod-datos {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dato-huevos {
    display: flex;
    gap: var(--space-md);
}

.dato-postura {
    font-weight: 600;
    color: var(--primary);
}

.historial-prod-obs {
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px dashed var(--border-color);
    font-size: var(--font-sm);
}

.obs-preview {
    color: var(--text-muted);
}

.obs-mas {
    color: var(--primary);
    font-weight: 500;
}

/* Modal detalle producción */
.detalle-prod-resumen {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.detalle-stat {
    background: var(--bg-input);
    padding: var(--space-md);
    border-radius: var(--border-radius);
    text-align: center;
}

.detalle-stat-valor {
    font-size: var(--font-xl);
    font-weight: 700;
}

.detalle-stat-label {
    font-size: var(--font-sm);
    color: var(--text-muted);
}

.detalle-info {
    background: var(--bg-input);
    border-radius: var(--border-radius);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}

.detalle-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-xs) 0;
}

.detalle-label {
    color: var(--text-muted);
}

.detalle-valor {
    font-weight: 500;
}

.detalle-observaciones {
    background: var(--bg-input);
    border-radius: var(--border-radius);
    padding: var(--space-md);
}

.detalle-observaciones h4 {
    margin-bottom: var(--space-sm);
    font-size: var(--font-md);
}

.obs-contenido {
    line-height: 1.6;
    white-space: pre-wrap;
}

/* Responsive totales */
@media (max-width: 380px) {
    .totales-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .detalle-prod-resumen {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =============================================
   AGREGAR AL FINAL DE app.css
   ============================================= */

/* Warning en pago CC sin proveedor */
.pago-cc-info.pago-cc-warning {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--danger);
    color: var(--danger);
}

/* Ajuste para modal egreso con scroll */
#modal-egreso .modal-body-scroll {
    max-height: calc(90vh - 180px);
    overflow-y: auto;
    padding-right: var(--space-sm);
}

/* Form hint para proveedor */
#egreso-proveedor-saldo {
    margin-top: var(--space-xs);
    font-size: var(--font-sm);
}

/**
 * LAS PITITAS v4.0 - Estilos Adicionales
 * =======================================
 * Agregar al final de app.css
 */

/* ==========================================
   MÓDULO PEDIDOS
   ========================================== */

/* Proyección Resumen */
.proyeccion-header {
    margin-bottom: 0.75rem;
}

.proyeccion-header h4 {
    margin: 0;
    font-size: 1rem;
}

.stats-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.stat-mini {
    text-align: center;
    padding: 0.5rem 0.25rem;
    background: var(--bg-tertiary);
    border-radius: 0.5rem;
}

.stat-mini .stat-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
}

.stat-mini .stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stock-info {
    text-align: center;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

/* Productos a Preparar */
.productos-preparar-lista {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.producto-preparar-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 0.5rem;
}

.producto-preparar-item .producto-nombre {
    font-weight: 500;
}

.producto-preparar-item .producto-cantidad strong {
    font-size: 1.1rem;
    color: var(--primary);
}

/* Lista de Pedidos */
.fecha-grupo {
    margin-bottom: 1rem;
}

.fecha-titulo {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-color);
}

.pedido-card {
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-left: 4px solid var(--border-color);
    position: relative;
}

.pedido-card.estado-pendiente {
    border-left-color: #f59e0b;
}

.pedido-card.estado-confirmado {
    border-left-color: #3b82f6;
}

.pedido-card.estado-entregado {
    border-left-color: #10b981;
    opacity: 0.7;
}

.pedido-card.estado-cancelado {
    border-left-color: #ef4444;
    opacity: 0.5;
}

.pedido-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.pedido-numero {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.pedido-estado {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 1rem;
    text-transform: uppercase;
    font-weight: 600;
}

.badge-pendiente {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.badge-confirmado {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.badge-entregado {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.badge-cancelado {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.pedido-cliente {
    margin-bottom: 0.5rem;
}

.pedido-items {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.pedido-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-muted);
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.btn-entregar {
    position: absolute;
    right: 0.75rem;
    bottom: 0.75rem;
}

/* Modal Pedido */
.items-lista {
    max-height: 200px;
    overflow-y: auto;
}

.item-pedido {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
}

.item-pedido .item-info {
    flex: 1;
}

.item-pedido .item-info strong {
    display: block;
}

.item-pedido .item-info small {
    color: var(--text-muted);
}

.item-cantidad {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-cantidad {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.btn-danger-icon {
    color: #ef4444;
}

/* Productos Grid en selector */
.productos-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.producto-opcion {
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 0.5rem;
    cursor: pointer;
}

.producto-opcion:active {
    background: var(--primary);
    color: white;
}

.producto-opcion strong {
    display: block;
    margin-bottom: 0.25rem;
}

.producto-opcion small {
    color: var(--text-muted);
}

.producto-opcion:active small {
    color: rgba(255,255,255,0.8);
}

/* Pedido Totales */
.pedido-totales {
    background: var(--bg-tertiary);
}

.pedido-totales .stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
}

.pedido-totales .stat-row:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
}

/* Detalle Pedido Modal */
.detalle-estado {
    text-align: center;
}

.badge-lg {
    font-size: 0.85rem;
    padding: 0.4rem 1rem;
}

.detalle-info p {
    margin: 0.5rem 0;
}

.items-detalle {
    background: var(--bg-tertiary);
    border-radius: 0.5rem;
    overflow: hidden;
}

.item-detalle {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.item-detalle:last-child {
    border-bottom: none;
}

.totales-detalle {
    background: var(--bg-tertiary);
    border-radius: 0.5rem;
    padding: 0.75rem;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
}

.total-final {
    border-top: 1px solid var(--border-color);
    padding-top: 0.5rem;
    margin-top: 0.25rem;
    font-size: 1.1rem;
}

/* ==========================================
   MÓDULO USUARIOS
   ========================================== */

.usuario-card {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    gap: 0.75rem;
}

.usuario-card.inactivo {
    opacity: 0.5;
}

.usuario-avatar {
    width: 48px;
    height: 48px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.usuario-info {
    flex: 1;
}

.usuario-info strong {
    display: block;
    margin-bottom: 0.25rem;
}

.usuario-info .text-muted {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.badge-actual {
    font-size: 0.7rem;
    background: var(--primary);
    color: white;
    padding: 0.1rem 0.4rem;
    border-radius: 0.25rem;
    margin-left: 0.25rem;
}

.badge-rol {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
    text-transform: uppercase;
}

.badge-admin {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.badge-produccion {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.badge-entregas {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.usuario-estado {
    margin-right: 0.5rem;
}

.estado-activo {
    color: #10b981;
    font-size: 1.5rem;
}

.estado-inactivo {
    color: #ef4444;
    font-size: 1.5rem;
}

.rol-descripcion {
    padding: 0.75rem;
    background: var(--bg-tertiary);
}

/* ==========================================
   UTILIDADES ADICIONALES
   ========================================== */

.section-title {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 1rem 0 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.text-success {
    color: #10b981 !important;
}

.text-danger {
    color: #ef4444 !important;
}

.text-sm {
    font-size: 0.8rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

/* Modal Large */
.modal-lg {
    max-width: 500px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

/* Responsive */
@media (max-width: 400px) {
    .stats-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-mini .stat-value {
        font-size: 1rem;
    }
}

/* ==========================================
   PARCHE v4.0 - Menú visible en TODAS las pantallas
   Agregar al FINAL de app.css
   ========================================== */

/* Forzar que el menú inferior SIEMPRE sea visible */
.nav-bottom {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1000 !important;
}

/* En desktop, centrar el menú y limitar ancho */
@media (min-width: 768px) {
    .nav-bottom {
        max-width: 600px;
        left: 50% !important;
        transform: translateX(-50%);
        border-radius: 16px 16px 0 0;
    }
    
    /* Asegurar espacio para el menú en desktop */
    .main-content {
        padding-bottom: 100px !important;
    }
}

/* Asegurar que los items del nav se vean correctamente */
.nav-item {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
}

.nav-item:hover {
    background: rgba(245, 158, 11, 0.1);
    border-radius: 8px;
}

/* ==========================================
   FIX: Modales en móvil - Botones visibles
   ========================================== */

/* Asegurar que el contenido del modal no quede detrás del nav */
.modal {
    max-height: calc(90vh - 80px) !important;
    margin-bottom: 80px !important;
}

/* Modal con scroll interno */
.modal-body-scroll {
    max-height: calc(70vh - 160px) !important;
    overflow-y: auto;
}

/* Footer del modal siempre visible */
.modal-footer {
    position: sticky;
    bottom: 0;
    background: var(--bg-card);
    padding: var(--space-md);
    margin: 0 calc(var(--space-lg) * -1);
    margin-bottom: calc(var(--space-lg) * -1);
    border-top: 1px solid var(--border-color);
}

/* Para modales sin clase modal-footer, agregar padding al final */
.modal > .btn:last-child,
.modal > button:last-child {
    margin-bottom: 80px;
}

/* Específico para modal de producción */
.modal .form-group:last-of-type {
    margin-bottom: var(--space-lg);
}

.modal .btn-primary.btn-block.btn-lg {
    margin-bottom: 20px;
}

/* En pantallas pequeñas, más espacio */
@media (max-height: 700px) {
    .modal {
        max-height: 85vh !important;
    }
    
    .modal-body-scroll {
        max-height: 50vh !important;
    }
}

.btn-nuevo-grande {
    background: linear-gradient(135deg, #ff9800 0%, #ff6f00 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    width: 100%;
    margin-bottom: 16px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
    transition: transform 0.2s;
}

.btn-nuevo-grande:active {
    transform: scale(0.98);
}

.clasificacion-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

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

.clasificacion-item label {
    display: block;
    font-size: 12px;
    margin-bottom: 4px;
    color: var(--text-secondary);
}

.clasificacion-item input {
    text-align: center;
    font-size: 18px;
    padding: 8px;
}

.stock-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 20px;
    border-radius: 16px;
}

.stock-total {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.stock-icon {
    font-size: 40px;
}

.stock-value {
    font-size: 32px;
    font-weight: 700;
    color: white;
}

.stock-label {
    font-size: 14px;
    color: rgba(255,255,255,0.8);
}

.stock-desglose {
    border-top: 1px solid rgba(255,255,255,0.2);
    padding-top: 15px;
}

.stock-desglose-items {
    display: flex;
    justify-content: space-around;
}

.stock-item {
    font-size: 14px;
    color: white;
    background: rgba(255,255,255,0.15);
    padding: 6px 12px;
    border-radius: 20px;
}