/* ========================================
   LA VASQUITA — App Pedidos
   Estilos principales
   ======================================== */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #F9FAFB;
    color: #1F2937;
    font-size: 14px;
    line-height: 1.5;
}

/* === TOPBAR === */
.topbar {
    background: #3C3489;
    color: white;
    padding: 16px 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-content {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.topbar h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
}

.topbar-subtitle {
    margin: 4px 0 0;
    font-size: 13px;
    opacity: 0.85;
}

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

.badge-stats {
    background: rgba(255,255,255,0.2);
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 13px;
}

.btn-link {
    color: white;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-link:hover {
    background: rgba(255,255,255,0.15);
}

/* === TOOLBAR === */
.toolbar {
    background: white;
    padding: 14px 24px;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    position: sticky;
    top: 80px;
    z-index: 90;
}

.buscador {
    flex: 1;
    min-width: 250px;
    max-width: 400px;
    padding: 10px 16px;
    border: 2px solid #E5E7EB;
    border-radius: 10px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.buscador:focus {
    outline: none;
    border-color: #3C3489;
}

.toolbar-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-secondary {
    background: white;
    color: #4B5563;
    border: 2px solid #E5E7EB;
    padding: 9px 16px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}

.btn-secondary:hover {
    border-color: #3C3489;
    color: #3C3489;
}

.btn-primary-grande {
    background: linear-gradient(135deg, #3C3489 0%, #6D4FCC 100%);
    color: white;
    border: none;
    padding: 11px 24px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
}

.btn-primary-grande:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(60, 52, 137, 0.3);
}

.btn-primary-grande:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary-grande.grande {
    padding: 16px 32px;
    font-size: 16px;
}

/* === CONTENIDO === */
.contenido {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px;
}

.info-banner {
    background: #FEF3C7;
    color: #78350F;
    padding: 14px 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 14px;
    border-left: 4px solid #F59E0B;
}

/* === BLOQUE DE CATEGORÍA === */
.categoria-bloque {
    margin-bottom: 32px;
    background: white;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.cat-titulo {
    padding: 14px 20px;
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #1F2937;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cat-count {
    font-size: 12px;
    background: rgba(0,0,0,0.1);
    padding: 4px 10px;
    border-radius: 10px;
    font-weight: 600;
}

/* === TABLA === */
.tabla-wrapper {
    overflow-x: auto;
}

.tabla-pedido {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.tabla-pedido th {
    background: #F3F4F6;
    padding: 10px 8px;
    text-align: center;
    font-weight: 700;
    color: #4B5563;
    border-bottom: 2px solid #E5E7EB;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tabla-pedido td {
    padding: 8px;
    border-bottom: 1px solid #F3F4F6;
    vertical-align: middle;
}

.th-ci, .td-ci {
    width: 70px;
    text-align: center;
    font-family: monospace;
    color: #6B7280;
    font-size: 12px;
}

.th-nombre, .td-nombre {
    text-align: left;
    font-weight: 500;
    min-width: 200px;
}

.th-formato, .td-formato {
    color: #6B7280;
    font-size: 12px;
    width: 160px;
}

.th-num {
    width: 90px;
}

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

.td-sugerido {
    text-align: center;
    font-weight: 700;
    color: #C2410C;
}

.td-min, .td-max {
    text-align: center;
    color: #6B7280;
    font-size: 12px;
    width: 50px;
}

.th-notas, .td-notas {
    width: 180px;
}

/* INPUTS de la tabla */
.input-num {
    width: 70px;
    padding: 6px 8px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    text-align: center;
    font-size: 13px;
    transition: all 0.2s;
}

.input-num:focus {
    outline: none;
    border-color: #3C3489;
    background: #F5F3FF;
}

.input-stock {
    background: #FFFBEB;
    border-color: #FCD34D;
}

.input-cant {
    background: #ECFDF5;
    border-color: #6EE7B7;
}

.input-notas {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 12px;
}

.input-notas:focus {
    outline: none;
    border-color: #3C3489;
}

/* Indicadores visuales del autosave */
.guardando {
    border-color: #FBBF24 !important;
    background: #FEF3C7 !important;
}

.guardado {
    border-color: #10B981 !important;
    background: #D1FAE5 !important;
}

.error {
    border-color: #EF4444 !important;
    background: #FEE2E2 !important;
}

/* Filas marcadas */
.row-solicitado {
    background: #F0FDF4;
}

.row-solicitado .td-nombre {
    color: #14532D;
    font-weight: 600;
}

.row-bajo {
    background: #FEF2F2;
}

.row-bajo.row-solicitado {
    background: #FFFBEB;
}

/* === FOOTER ACTIONS === */
.footer-actions {
    text-align: center;
    margin-top: 32px;
    padding: 32px;
    background: white;
    border-radius: 14px;
}

.footer-actions .hint {
    margin-top: 12px;
    color: #6B7280;
    font-size: 13px;
}

/* === TOAST === */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1F2937;
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    z-index: 1000;
    max-width: 400px;
}

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

.toast-success {
    background: #059669;
}

.toast-error {
    background: #DC2626;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .topbar h1 {
        font-size: 18px;
    }
    .toolbar {
        top: 100px;
    }
    .tabla-pedido {
        font-size: 12px;
    }
    .input-num {
        width: 55px;
    }
}
