/* Cotizador de Envíos - Frontend Styles */

/* Button Container */
.cotizador-button-container {
    text-align: center;
    margin: 20px 0;
}

.cotizador-btn-modal {
    background: linear-gradient(135deg, #0067FF 0%, #0052CC 100%);
    color: white;
    border: none;
    padding-top: 10px;
    padding-right: 20px;
    padding-bottom: 10px;
    padding-left: 20px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0, 103, 255, 0.3);
}

.cotizador-btn-modal:hover {
    background: linear-gradient(135deg, #0052CC 0%, #0041A3 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 103, 255, 0.4);
}

.cotizador-btn-icon {
    font-size: 20px;
}

/* Modal Styles */
.cotizador-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
}

.cotizador-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.cotizador-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    max-width: 900px;
    width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.cotizador-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #e1e1e1;
    background: #f8f9fa;
}

.cotizador-modal-title {
    margin: 0;
    color: #333;
    font-size: 24px;
    font-weight: 600;
}

.cotizador-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.cotizador-modal-close:hover {
    background: #e1e1e1;
    color: #333;
}

.cotizador-modal-body {
    max-height: calc(90vh - 80px);
    overflow-y: auto;
    padding: 0;
}

.cotizador-modal-form {
    border: none;
    box-shadow: none;
    margin: 0;
    border-radius: 0;
    padding-top: 20px;
}

body.cotizador-modal-open {
    overflow: hidden;
}

.cotizador-envios-wrapper {
    max-width: 600px;
    margin: 20px auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
}

.cotizador-title {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 28px;
    font-weight: 600;
}

/* Progress Bar */
.cotizador-progress {
    margin-bottom: 40px;
}

.progress-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    margin-bottom: 20px;
}

.progress-bar::before {
    content: '';
    position: absolute;
    top: 25px;
    left: 0;
    right: 0;
    height: 2px;
    background: #e1e1e1;
    z-index: 1;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    background: #ffffff;
    padding: 0 10px;
}

.step-number {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #e1e1e1;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.progress-step.active .step-number {
    background: #0067FF;
    color: white;
}

.progress-step.completed .step-number {
    background: #46b450;
    color: white;
}

.step-label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
    text-align: center;
}

.progress-step.active .step-label {
    color: #0067FF;
    font-weight: 600;
}

.progress-step.completed .step-label {
    color: #46b450;
}

/* Form Steps */
.form-step {
    display: none;
    animation: fadeIn 0.3s ease;
}

.form-step.active {
    display: block;
}

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

.form-step h4 {
    color: #333;
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 600;
    padding-bottom: 10px;
    border-bottom: 2px solid #e1e1e1;
}

/* Form Elements */
.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
    flex: 1;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e1e1;
    border-radius: 6px;
    font-size: 16px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #0067FF;
    box-shadow: 0 0 0 3px rgba(0, 103, 255, 0.1);
}

.form-group input.error,
.form-group select.error,
.form-group textarea.error {
    border-color: #dc3232;
    box-shadow: 0 0 0 3px rgba(220, 50, 50, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-text {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.field-error {
    color: #dc3232;
    font-size: 12px;
    margin-top: 5px;
    display: none;
}

/* Buttons */
.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e1e1e1;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: #0067FF;
    color: white;
}

.btn-primary:hover {
    background: #0052CC;
}

.btn-secondary {
    background: #f1f1f1;
    color: #333;
}

.btn-secondary:hover {
    background: #e1e1e1;
}

.btn-success {
    background: #46b450;
    color: white;
}

.btn-success:hover {
    background: #399946;
}

.btn-outline {
    background: transparent;
    border: 2px solid #0067FF;
    color: #0067FF;
}

.btn-outline:hover {
    background: #0067FF;
    color: white;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.cotizar-btn .btn-loader {
    display: none;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Results Section */
.cotizacion-summary {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.cotizacion-summary h5 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e1e1e1;
}

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

.summary-row span:first-child {
    font-weight: 600;
    color: #666;
}

.summary-row span:last-child {
    color: #333;
}

/* Rates Section */
.cotizacion-rates h5 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.rates-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rate-card {
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 16px;
    background: white;
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
}

.rate-card:hover {
    border-color: #0067FF;
    box-shadow: 0 2px 8px rgba(0, 103, 255, 0.1);
}

.rate-card.selected {
    border-color: #46b450;
    box-shadow: 0 2px 8px rgba(70, 180, 80, 0.2);
    background: #f8fff8;
}

/* Nueva estructura: Logo - Nombre - Flete en fila principal */
.rate-main-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.rate-carrier-section {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.carrier-logo {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: #666;
    border: 1px solid #e1e1e1;
    flex-shrink: 0;
}

.carrier-name {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    margin: 0;
    line-height: 1.2;
}

.main-price {
    font-size: 20px;
    font-weight: 700;
    color: #0067FF;
    margin: 0;
}

/* Detalles compactos debajo */
.rate-details-compact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
    font-size: 13px;
    color: #666;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.detail-label {
    color: #666;
    font-weight: 500;
}

.detail-value {
    color: #333;
    font-weight: 600;
}

.detail-item.total {
    grid-column: 1 / -1;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e1e1e1;
    font-size: 14px;
}

.detail-item.total .detail-value {
    color: #46b450;
    font-size: 16px;
    font-weight: 700;
}

.rate-actions {
    margin-top: 12px;
    text-align: right;
}

.rate-actions .btn {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 6px;
}

.rate-selected-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #46b450;
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    z-index: 10;
}

/* Error and No Results */
.cotizacion-error,
.cotizacion-no-results {
    text-align: center;
    padding: 40px 20px;
}

.error-icon,
.no-results-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.cotizacion-error h5,
.cotizacion-no-results h5 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 20px;
}

.error-message {
    color: #dc3232;
    margin-bottom: 20px;
    font-size: 16px;
}

.suggestions {
    text-align: left;
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
}

.suggestions h6 {
    margin: 0 0 10px 0;
    color: #333;
}

.suggestions ul {
    margin: 0;
    padding-left: 20px;
}

.suggestions li {
    color: #666;
    margin-bottom: 5px;
}

/* Loading States */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
}

.spinner-large {
    width: 48px;
    height: 48px;
    border: 4px solid #e1e1e1;
    border-top: 4px solid #0067FF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.cotizacion-loading {
    text-align: center;
    padding: 40px 20px;
}

.loading-spinner {
    margin-bottom: 20px;
}

.loading-spinner .spinner {
    width: 32px;
    height: 32px;
    border-width: 3px;
    margin: 0 auto;
}

/* Responsive Design */
@media (max-width: 768px) {
    .cotizador-envios-wrapper {
        margin: 10px;
        padding: 15px;
    }

    .progress-bar {
        flex-wrap: wrap;
        gap: 10px;
    }

    .progress-step {
        flex: 1;
        min-width: 60px;
    }

    .step-number {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }

    .step-label {
        font-size: 10px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-actions {
        flex-direction: column;
        gap: 10px;
    }

    .rates-container {
        gap: 10px;
    }

    .rate-main-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .rate-carrier-section {
        gap: 8px;
    }

    .carrier-logo {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .carrier-name {
        font-size: 14px;
    }

    .main-price {
        font-size: 18px;
        align-self: flex-end;
    }

    .rate-details-compact {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}

@media (max-width: 480px) {
    .cotizador-title {
        font-size: 22px;
    }

    .form-step h4 {
        font-size: 18px;
    }

    .progress-step {
        min-width: 50px;
    }

    .step-number {
        width: 35px;
        height: 35px;
        font-size: 12px;
    }

    .step-label {
        font-size: 9px;
    }

    /* Modal responsive adjustments */
    .cotizador-modal-content {
        width: 95vw;
        max-height: 95vh;
    }

    .cotizador-modal-header {
        padding: 15px 20px;
    }

    .cotizador-modal-title {
        font-size: 20px;
    }

    .cotizador-btn-modal {
        padding: 12px 20px;
        font-size: 16px;
        border-radius: 100px;
    }
}