/* ===== SISTEMA DE MODALES PERSONALIZADOS ===== */

#modalContainer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    pointer-events: none;
}

/* Modal Base */
.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: auto;
    z-index: 10001;
}

.custom-modal.active {
    opacity: 1;
    visibility: visible;
}

/* Overlay */
.custom-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 46, 0.85);
    backdrop-filter: blur(5px);
}

/* Modal Content */
.custom-modal-content {
    position: relative;
    background: var(--white);
    border-radius: 20px;
    padding: 40px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9) translateY(-20px);
    transition: transform 0.3s ease;
    z-index: 1;
}

.custom-modal.active .custom-modal-content {
    transform: scale(1) translateY(0);
}

/* Tamaños */
.modal-small {
    width: 400px;
}

.modal-medium {
    width: 600px;
}

.modal-large {
    width: 900px;
}

.modal-full {
    width: 95%;
    height: 90vh;
}

/* Close Button */
.custom-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--light-color);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--dark-color);
    font-size: 18px;
}

.custom-modal-close:hover {
    background: var(--danger);
    color: var(--white);
    transform: rotate(90deg);
}

/* Icon */
.custom-modal-icon {
    text-align: center;
    font-size: 60px;
    margin-bottom: 20px;
    animation: iconPop 0.5s ease;
}

@keyframes iconPop {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* Title */
.custom-modal-title {
    text-align: center;
    font-size: 28px;
    color: var(--dark-color);
    margin-bottom: 15px;
    font-weight: 700;
}

/* Body */
.custom-modal-body {
    text-align: center;
    color: var(--gray);
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 30px;
}

.custom-modal-body p {
    margin-bottom: 10px;
}

/* Footer */
.custom-modal-footer {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Buttons */
.custom-modal-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    min-width: 120px;
}

.custom-modal-btn-confirm {
    background: linear-gradient(135deg, var(--primary-color), #ff8757);
    color: var(--white);
}

.custom-modal-btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 53, 0.4);
}

.custom-modal-btn-cancel {
    background: var(--light-color);
    color: var(--dark-color);
}

.custom-modal-btn-cancel:hover {
    background: var(--gray);
    color: var(--white);
}

/* Modal de confirmación */
.custom-modal-confirm .custom-modal-icon {
    color: var(--primary-color);
}

/* Loading Modal */
.custom-modal-loading .custom-modal-content {
    padding: 40px;
    text-align: center;
}

.custom-modal-spinner {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--light-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.custom-modal-loading-text {
    color: var(--gray);
    font-size: 16px;
    margin: 0;
}

/* Toast Notifications */
.custom-toast {
    position: fixed;
    top: 80px;
    right: -400px;
    background: var(--white);
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    transition: right 0.3s ease;
    z-index: 10002;
    font-size: 15px;
}

.custom-toast.show {
    right: 20px;
}

.custom-toast i {
    font-size: 24px;
}

.custom-toast-success {
    border-left: 4px solid var(--success);
}

.custom-toast-success i {
    color: var(--success);
}

.custom-toast-error {
    border-left: 4px solid var(--danger);
}

.custom-toast-error i {
    color: var(--danger);
}

.custom-toast-warning {
    border-left: 4px solid var(--warning);
}

.custom-toast-warning i {
    color: var(--warning);
}

.custom-toast-info {
    border-left: 4px solid var(--secondary-color);
}

.custom-toast-info i {
    color: var(--secondary-color);
}

/* Responsive */
@media (max-width: 768px) {
    .custom-modal-content {
        padding: 25px;
        border-radius: 15px;
    }

    .modal-small,
    .modal-medium,
    .modal-large {
        width: 95%;
    }

    .custom-modal-title {
        font-size: 22px;
    }

    .custom-modal-icon {
        font-size: 50px;
    }

    .custom-modal-btn {
        padding: 10px 20px;
        font-size: 14px;
        min-width: 100px;
    }

    .custom-toast {
        min-width: 280px;
        max-width: 90%;
    }
}

/* Scrollbar personalizado para modales */
.custom-modal-content::-webkit-scrollbar {
    width: 8px;
}

.custom-modal-content::-webkit-scrollbar-track {
    background: var(--light-color);
    border-radius: 10px;
}

.custom-modal-content::-webkit-scrollbar-thumb {
    background: var(--gray);
    border-radius: 10px;
}

.custom-modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* ===== QUICK QUOTE MODAL ===== */
.quick-quote-modal .modal-content {
    max-width: 700px !important;
    width: 95%;
}

.quick-quote-form {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.form-section {
    background: var(--light-color);
    padding: 25px;
    border-radius: 12px;
    border-left: 4px solid var(--primary-color);
}

.form-section h3 {
    color: var(--dark-color);
    font-size: 1.2rem;
    margin: 0 0 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-section h3 i {
    color: var(--primary-color);
    font-size: 1.3rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: var(--white);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Vehicle Selector Styles */
.vehicle-selector-group {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px dashed #e0e0e0;
}

.vehicle-selector-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.vehicle-selector-group label i {
    color: var(--primary-color);
}

.optional-label {
    font-size: 12px;
    color: var(--gray);
    font-weight: 400;
    font-style: italic;
}

.vehicle-select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: var(--white);
    cursor: pointer;
    transition: all 0.3s ease;
}

.vehicle-select:hover {
    border-color: var(--primary-color);
}

.vehicle-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.vehicle-select option {
    padding: 10px;
}

/* ===== TOGGLE SWITCH PROFESIONAL ===== */
.toggle-switch-label {
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.toggle-switch-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch-slider {
    position: relative;
    width: 56px;
    height: 28px;
    background: #e0e0e0;
    border-radius: 34px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-switch-slider::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Toggle ON state */
.toggle-switch-input:checked + .toggle-switch-slider {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 0 12px rgba(102, 126, 234, 0.4);
}

.toggle-switch-input:checked + .toggle-switch-slider::before {
    transform: translateX(28px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

/* Hover effects */
.toggle-switch-label:hover .toggle-switch-slider {
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.15);
}

.toggle-switch-input:checked + .toggle-switch-slider:hover {
    box-shadow: 0 0 16px rgba(102, 126, 234, 0.6);
}

/* Focus state for accessibility */
.toggle-switch-input:focus + .toggle-switch-slider {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Text styling */
.toggle-switch-text {
    font-size: 15px;
    font-weight: 500;
    color: var(--dark-color);
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-switch-text i {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.toggle-switch-input:checked ~ .toggle-switch-text {
    color: #667eea;
    font-weight: 600;
}

.toggle-switch-input:checked ~ .toggle-switch-text i {
    transform: scale(1.1);
}

/* Disabled state */
.toggle-switch-input:disabled + .toggle-switch-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.toggle-switch-input:disabled ~ .toggle-switch-text {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Highlight save vehicle checkbox */
.save-vehicle-group {
    transition: all 0.3s ease;
    padding: 12px 0;
}

.save-vehicle-group.highlight {
    background: linear-gradient(135deg, #fff9e6 0%, #fffbf0 100%);
    padding: 18px 20px;
    border-radius: 12px;
    border-left: 4px solid #ffc107;
    animation: pulseHighlight 2s ease-in-out;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.15);
}

.save-vehicle-group.highlight .toggle-switch-text {
    font-weight: 700;
    color: #f57c00;
}

.save-vehicle-group.highlight .toggle-switch-text i {
    animation: bounce 0.6s ease-in-out;
}

@keyframes pulseHighlight {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(255, 193, 7, 0.15);
    }
    50% {
        box-shadow: 0 6px 25px rgba(255, 193, 7, 0.35);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.2);
    }
    50% {
        transform: scale(0.95);
    }
    75% {
        transform: scale(1.1);
    }
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 2px solid var(--light-color);
}

.btn-whatsapp {
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
    color: var(--white);
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
}

.btn-whatsapp:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 211, 102, 0.4);
}

/* ===== COMPARE MODAL IMPROVEMENTS ===== */
.compare-actions {
    display: flex;
    gap: 12px;
    padding: 25px 35px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-top: 2px solid #e0e0e0;
    flex-wrap: wrap;
}

.compare-actions .btn {
    flex: 1;
    min-width: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 15px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.compare-actions .btn-secondary {
    background-color: #e0e0e0;
    color: var(--dark-color);
}

.compare-actions .btn-secondary:hover {
    background-color: #d32f2f;
    color: var(--white);
}

/* Scrollbar personalizado para el modal de comparación */
.compare-content::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.compare-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.compare-content::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
}

.compare-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #ff5722, #003d6b);
}

.compare-body::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.compare-body::-webkit-scrollbar-track {
    background: #f8f9fa;
}

.compare-body::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 10px;
}

.compare-body::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

.compare-table .best-value {
    background: linear-gradient(135deg, #fff9e6 0%, #fffbf0 100%);
    border-left: 4px solid #ffc107 !important;
    border-right: 4px solid #ffc107 !important;
    position: relative;
    box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.1);
}

.compare-table thead .best-value {
    background: linear-gradient(135deg, #fff9e6 0%, #fffbf0 100%);
    padding-top: 50px; /* Espacio para el badge */
    position: relative;
}

.compare-table thead .best-value::before {
    content: '⭐ Mejor Precio';
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ffc107 0%, #ffb300 100%);
    color: var(--dark-color);
    padding: 8px 20px;
    border-radius: 25px;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.5);
    z-index: 20;
    letter-spacing: 0.5px;
}

/* Remove Button in Comparison */
.remove-compare-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    background: rgba(220, 53, 69, 0.9);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 14px;
    z-index: 30;
}

.remove-compare-btn:hover:not(:disabled) {
    background: #dc3545;
    border-color: white;
    transform: scale(1.1);
}

.remove-compare-btn:disabled {
    background: rgba(108, 117, 125, 0.5);
    cursor: not-allowed;
    opacity: 0.5;
}

/* Remove Button Mobile */
.remove-compare-btn-mobile {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(220, 53, 69, 0.3);
    background: rgba(220, 53, 69, 0.95);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 16px;
    z-index: 30;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.remove-compare-btn-mobile:hover:not(:disabled) {
    background: #dc3545;
    border-color: white;
    transform: scale(1.1);
}

.remove-compare-btn-mobile:disabled {
    background: rgba(108, 117, 125, 0.5);
    cursor: not-allowed;
    opacity: 0.5;
}

/* Empty Slot */
.empty-slot {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    border: 2px dashed #cbd5e0 !important;
    opacity: 0.8;
}

.add-more-product {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    color: #6c757d;
}

.add-more-product i {
    font-size: 48px;
    margin-bottom: 15px;
    color: #adb5bd;
}

.add-more-product p {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 5px 0;
}

.add-more-product small {
    font-size: 12px;
    color: #adb5bd;
}

.add-more-product-mobile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #6c757d;
    text-align: center;
}

.add-more-product-mobile i {
    font-size: 56px;
    margin-bottom: 20px;
    color: #adb5bd;
}

.add-more-product-mobile p {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 10px 0;
}

.add-more-product-mobile small {
    font-size: 13px;
    color: #adb5bd;
    line-height: 1.4;
}

.empty-slot-cell {
    background: #f8f9fa;
    color: #adb5bd;
    font-style: italic;
}

.empty-card {
    border: 2px dashed #cbd5e0;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

/* Las celdas del body NO tienen badge, solo el resaltado */
.compare-table tbody .best-value {
    background: linear-gradient(135deg, #fff9e6 0%, #fffbf0 100%);
}

/* ===== CONFIRM DIALOG MODAL ===== */
.confirm-modal {
    z-index: 10010 !important;
}

.confirm-content {
    max-width: 450px;
    width: 90%;
    padding: 40px;
    text-align: center;
    border-radius: 20px;
    background: white;
}

.confirm-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulseConfirm 2s infinite;
}

.confirm-icon i {
    font-size: 40px;
    color: white;
}

@keyframes pulseConfirm {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 154, 158, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 20px rgba(255, 154, 158, 0);
    }
}

.confirm-body h3 {
    font-size: 24px;
    color: var(--dark-color);
    margin: 0 0 15px 0;
    font-weight: 700;
}

.confirm-body p {
    font-size: 16px;
    color: #6c757d;
    margin: 0 0 30px 0;
    line-height: 1.6;
}

.confirm-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.confirm-actions .btn {
    flex: 1;
    max-width: 150px;
    padding: 12px 20px;
    font-weight: 600;
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: none;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(220, 53, 69, 0.3);
}

/* ===== MINIMIZED COMPARE MODAL ===== */
.compare-modal.minimized {
    align-items: flex-end;
    justify-content: flex-end;
    padding: 20px;
}

.compare-modal.minimized .compare-content {
    max-width: 350px;
    max-height: 450px;
    width: 100%;
    transform: scale(1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    overflow: hidden;
}

.compare-modal.minimized .modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    cursor: pointer;
}

.compare-modal.minimized .modal-header h2 {
    font-size: 16px;
}

.compare-modal.minimized .compare-body {
    max-height: 300px;
    overflow-y: auto;
    padding: 15px;
}

.compare-modal.minimized .compare-actions {
    display: none;
}

.compare-modal.minimized .compare-table-desktop {
    display: none;
}

.compare-modal.minimized .compare-cards-mobile {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.compare-modal.minimized .compare-card {
    padding: 10px;
}

.compare-modal.minimized .compare-card-image img {
    width: 60px;
    height: 60px;
}

.compare-modal.minimized .compare-card-title {
    font-size: 13px;
}

.compare-modal.minimized .compare-card-price {
    font-size: 16px;
}

.compare-modal.minimized .compare-card-details,
.compare-modal.minimized .btn-block {
    display: none;
}

.compare-modal.minimized .empty-card {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .form-section {
        padding: 20px 15px;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }

    .compare-actions {
        flex-direction: column;
    }

    .compare-actions .btn {
        width: 100%;
        min-width: auto;
    }
    
    .confirm-content {
        padding: 30px 20px;
    }
    
    .confirm-actions {
        flex-direction: column;
    }
    
    .confirm-actions .btn {
        max-width: 100%;
    }
    
    .compare-modal.minimized .compare-content {
        max-width: 100%;
        margin: 0 10px 10px 0;
