/* Estilos para el modal de Despacho de Aceite - MEJORADO */
.modal-oil {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    overflow: hidden;
}

/* Tamaño variable según contenido */
.modal-oil-content {
    max-width: 95%;
    width: 600px; /* Tamaño por defecto para formulario */
    max-height: 90vh;
    margin: 2% auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden !important;
}

/* Tamaño compacto para datos existentes */
.modal-oil-content.compact {
    width: 500px;
    max-height: 70vh;
}

/* HEADER MEJORADO CON DOS LÍNEAS */
.oil-header.sticky-header {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 20px 25px 15px 25px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
    border-radius: 12px 12px 0 0;
}

.oil-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.oil-title h2 {
    margin: 0;
    font-size: 1.5em;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Badge de solo lectura en el título */
#oilSoloLecturaBadge {
    background: #dc3545;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: none;
}

/* Header info con dos líneas */
.oil-header-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.oil-header-line {
    display: flex;
    align-items: center;
    gap: 25px;
    width: 100%;
    flex-wrap: nowrap;
    overflow: hidden;
}

.oil-header-line .header-item {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.oil-header-line .header-item strong {
    font-size: 11px;
    opacity: 0.8;
    font-weight: 600;
}

.oil-header-line .header-item span {
    font-weight: 500;
}

/* X DE CERRAR MEJORADA */
.close-modal-oil {
    position: absolute;
    top: 15px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    color: #333;
    font-size: 28px;
    cursor: pointer;
    padding: 5px 15px;
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 10001;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.close-modal-oil:hover {
    background: #dc3545;
    color: white;
    transform: scale(1.1);
}

/* BODY MEJORADO */
.oil-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.oil-section {
    padding: 20px 25px;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
}

.oil-section:last-of-type {
    border-bottom: none;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.section-header h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-weight: 600;
    font-size: 18px;
}

/* FORM CONTROLS MEJORADOS */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
    font-size: 13px;
}

.form-group select,
.form-group input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* FOOTER MEJORADO - BOTONES SEPARADOS */
.oil-footer {
    padding: 20px 25px;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
    border-radius: 0 0 12px 12px;
}

.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    min-width: 160px;
    justify-content: center;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    min-width: 160px;
    justify-content: center;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ESTILOS PARA DATOS EXISTENTES - MÁS COMPACTOS */
.existing-data-compact {
    padding: 15px 0;
}

.existing-data-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 10px;
}

.existing-data-item {
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #3498db;
}

.existing-data-label {
    font-size: 11px;
    color: #6c757d;
    margin-bottom: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.existing-data-value {
    font-size: 13px;
    font-weight: 500;
    color: #495057;
}

/* ESTADOS IDÉNTICOS AL MODAL PEDIDO */
.status-pedido {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.status-citado { background: #ffc107; color: #000; }
.status-taller { background: #17a2b8; color: #fff; }
.status-proceso { background: #6f42c1; color: #fff; }
.status-cerrado_pagado { background: #28a745; color: #fff; }
.status-cerrado { background: #6c757d; color: #fff; }

/* ESTILOS PARA MODO SOLO LECTURA */
.modo-solo-lectura .oil-section {
    opacity: 0.8;
    background: #f8f9fa;
}

.modo-solo-lectura .form-group select,
.modo-solo-lectura .form-group input {
    background: #e9ecef;
    cursor: not-allowed;
    border-color: #ced4da;
}

.modo-solo-lectura .btn-primary,
.modo-solo-lectura .btn-secondary {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.modo-solo-lectura .btn-primary:hover,
.modo-solo-lectura .btn-secondary:hover {
    transform: none;
    box-shadow: none;
}

/* LOADING STATES */
.loading-oil {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 2s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* TOAST NOTIFICATIONS */
.toast-container {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 10000;
    max-width: 300px;
}

.toast {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    margin-bottom: 8px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: toastSlideIn 0.3s ease-out;
    min-width: 250px;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.toast-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.toast-icon {
    margin-right: 10px;
    font-size: 16px;
}

.toast-success .toast-icon {
    color: #28a745;
}

.toast-error .toast-icon {
    color: #dc3545;
}

.toast-message {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 3px;
    margin-left: 6px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.toast-close:hover {
    opacity: 1;
}

/* RESPONSIVE MEJORADO */
@media (max-width: 768px) {
    .modal-oil-content {
        margin: 5% auto;
        width: 98%;
        max-height: 95vh;
    }
    
    .modal-oil-content.compact {
        width: 95%;
        max-height: 80vh;
    }
    
    .oil-header-line {
        flex-direction: column;
        gap: 8px;
    }
    
    .oil-header-line .header-item {
        min-width: 100%;
    }
    
    .oil-footer {
        flex-direction: column;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
        min-width: auto;
    }
    
    .existing-data-grid {
        grid-template-columns: 1fr;
    }
    
    .oil-title {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .close-modal-oil {
        position: relative;
        top: auto;
        right: auto;
        align-self: flex-end;
        margin-top: -40px;
    }
}

@media (max-width: 1200px) {
    .oil-header-line {
        gap: 15px;
    }
    
    .oil-header-line .header-item {
        font-size: 12px;
    }
}

/* ESTILOS PARA MODAL DE IDENTIFICACIÓN (COPIADOS DE VB) */
.modal-identificacion-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10002;
}

.modal-identificacion-content {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

.identificacion-header {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
    border-radius: 12px 12px 0 0;
}

.identificacion-header h3 {
    margin: 0;
    font-size: 1.3em;
    font-weight: 600;
    color: white;
}

.identificacion-body {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
    display: flex;
    flex-direction: column;
}

.identificacion-body p {
    margin-bottom: 20px;
    color: #495057;
    line-height: 1.5;
    font-size: 14px;
}

.scanner-section {
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.scanner-input {
    display: flex;
    gap: 10px;
    align-items: center;
}

.scanner-input input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}

.scanner-input input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.btn-success {
    background: linear-gradient(135deg, #27ae60, #219a52);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.btn-success:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.identificacion-footer {
    padding: 20px 25px;
    background: #f8f9fa;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
    border-radius: 0 0 12px 12px;
}

#identificacionInfo {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #28a745;
}

#identificacionInfo span {
    font-size: 14px;
}

#identificacionNombre {
    color: #28a745;
    font-weight: 600;
}

/* Responsive para modal de identificación */
@media (max-width: 768px) {
    .modal-identificacion-content {
        margin: 5% auto;
        width: 95%;
        max-height: 95vh;
    }
    
    .scanner-input {
        flex-direction: column;
    }
    
    .scanner-input input {
        width: 100%;
    }
    
    .identificacion-footer {
        flex-direction: column;
    }
    
    .identificacion-footer button {
        width: 100%;
        justify-content: center;
    }
}