:root {
    --tg-primary-color: #f48222;
    --tg-secondary-color: #5a568f;
    --tg-bg-soft: #f8fafc;
    --tg-text-main: #1e293b;
    --tg-text-muted: #64748b;
    --tg-border-color: #e2e8f0;
    --tg-radius-lg: 16px;
    --tg-radius-md: 12px;
    --tg-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --tg-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --tg-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.insurance-simulator {
    padding: 60px 0;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.simulator-header {
    margin-bottom: 40px;
}

.simulator-title {
    font-weight: 800;
    color: var(--tg-secondary-color);
    font-size: 2.25rem;
    letter-spacing: -0.025em;
}

.title-underline {
    width: 60px;
    height: 4px;
    background: var(--tg-primary-color);
    margin: 15px auto;
    border-radius: 2px;
}

.simulator-card {
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-radius: var(--tg-radius-lg);
    box-shadow: var(--tg-shadow-lg);
    padding: 40px;
    margin: 0 auto;
    max-width: 900px;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.section-group {
    margin-bottom: 30px;
}

.section-title {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--tg-text-muted);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--tg-border-color);
}

/* Modern Floating Input Style */
.form-group-custom {
    position: relative;
    margin-bottom: 20px;
}

.form-control, .form-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    color: var(--tg-text-main);
    background-color: white;
    border: 1.5px solid var(--tg-border-color);
    border-radius: var(--tg-radius-md);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    height: 52px;
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--tg-primary-color);
    box-shadow: 0 0 0 4px rgba(244, 130, 34, 0.1);
    transform: translateY(-1px);
}

.input-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--tg-text-main);
    margin-bottom: 6px;
}

.helper-text {
    font-size: 0.75rem;
    color: var(--tg-text-muted);
    margin-top: 4px;
}

/* Service Cards */
.sim-service-card-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.sim-service-card {
    background: white;
    border: 1.5px solid var(--tg-border-color);
    border-radius: var(--tg-radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sim-service-card:hover {
    border-color: var(--tg-primary-color);
    background: #fffaf7;
    transform: translateY(-2px);
}

.sim-service-card.sim-active {
    border-color: var(--tg-primary-color);
    background: #fffaf7;
    box-shadow: 0 4px 12px rgba(244, 130, 34, 0.1);
}

.sim-service-icon {
    width: 44px;
    height: 44px;
    background: #f1f5f9;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tg-text-main);
    transition: all 0.3s ease;
}

.sim-active .sim-service-icon {
    background: var(--tg-primary-color);
    color: white;
}

.sim-service-text {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--tg-text-main);
}

/* Insurers Grid */
.seguradoras-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.seguradora-label {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border: 1.5px solid var(--tg-border-color);
    border-radius: var(--tg-radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.seguradora-label:hover {
    border-color: var(--tg-primary-color);
}

.seguradora-input:checked + .seguradora-label {
    border-color: var(--tg-secondary-color);
    background: #f5f3ff;
}

.seguradora-icon {
    margin-right: 12px;
    color: var(--tg-text-muted);
}

.seguradora-input:checked + .seguradora-label .seguradora-icon {
    color: var(--tg-secondary-color);
}

/* Buttons */
.submit-btn {
    background: var(--tg-primary-color);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: var(--tg-radius-md);
    font-size: 1.125rem;
    font-weight: 700;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px 0 rgba(244, 130, 34, 0.39);
}

.submit-btn:hover {
    background: #e3741b;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(244, 130, 34, 0.23);
}

.submit-btn:active {
    transform: translateY(0);
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Result Cards - Premium Style */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 28px;
    margin-top: 48px; /* espaço extra para o badge "Melhor Proposta" */
}

.result-card {
    background: white;
    border-radius: 20px;
    padding: 28px 24px 24px;
    border: 1.5px solid var(--tg-border-color);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible; /* permite badge ficar acima do card */
    box-sizing: border-box;
    word-break: break-word;
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--tg-primary-color);
    opacity: 0;
    transition: opacity 0.3s;
}

.result-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.06);
}

.result-card:hover::before {
    opacity: 1;
}

.provider-logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.price-box {
    background: var(--tg-bg-soft);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}

.price-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--tg-secondary-color);
    display: block;
}

/* SweetAlert2 Overrides */
.swal2-popup {
    border-radius: 20px !important;
    padding: 2em !important;
}

.swal2-title {
    font-weight: 800 !important;
    color: var(--tg-secondary-color) !important;
}

.swal2-confirm {
    background-color: var(--tg-primary-color) !important;
    border-radius: 12px !important;
    font-weight: 700 !important;
    padding: 12px 32px !important;
}

/* ── Provider logo in result card ── */
.provider-logo {
    width: 50px; height: 50px;
    border-radius: 14px;
    background: var(--tg-secondary-color);
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 20px;
}

/* ── Form Sections ── */
.form-section {
    margin-bottom: 28px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--tg-border-color);
}
.form-section:last-of-type { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.section-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--tg-text-muted);
    margin-bottom: 14px;
}

/* ── Client Type Tabs ── */
.client-type-tabs { display: flex; gap: 12px; }
.client-tab {
    flex: 1;
    padding: 12px 16px;
    border: 1.5px solid var(--tg-border-color);
    border-radius: var(--tg-radius-md);
    background: white;
    font-size: 14px;
    font-weight: 600;
    color: var(--tg-text-muted);
    cursor: pointer;
    transition: all .2s;
}
.client-tab.active {
    border-color: var(--tg-primary-color);
    background: #fff7f0;
    color: var(--tg-primary-color);
}
.client-tab:hover:not(.active) { border-color: #cbd5e1; background: #f8fafc; }

/* ── Coverage Cards ── */
.coverage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.coverage-card {
    padding: 18px;
    border: 1.5px solid var(--tg-border-color);
    border-radius: var(--tg-radius-md);
    background: white;
    cursor: pointer;
    transition: all .25s;
    text-align: center;
}
.coverage-card:hover { border-color: var(--tg-primary-color); background: #fffaf7; }
.coverage-card.selected {
    border-color: var(--tg-primary-color);
    background: #fff7f0;
    box-shadow: 0 0 0 3px rgba(244,130,34,.12);
}
.coverage-icon { font-size: 24px; color: var(--tg-primary-color); margin-bottom: 8px; }
.coverage-name { font-size: 14px; font-weight: 700; color: var(--tg-text-main); margin-bottom: 4px; }
.coverage-desc { font-size: 12px; color: var(--tg-text-muted); }

/* ── Vehicle Card ── */
.vehicle-card {
    background: #f8fafc;
    border: 1.5px solid var(--tg-border-color);
    border-radius: var(--tg-radius-md);
    padding: 20px;
    margin-bottom: 14px;
}
.vehicle-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.vehicle-card-title { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--tg-text-main); font-size: 14px; }
.vehicle-num {
    width: 28px; height: 28px;
    background: var(--tg-primary-color);
    color: white;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 800;
}
.btn-remove-vehicle {
    background: none; border: none; color: #e11d48;
    padding: 4px 8px; border-radius: 6px; cursor: pointer; font-size: 13px;
    transition: background .2s;
}
.btn-remove-vehicle:hover { background: #ffe4e6; }

/* ── Providers Grid ── */
.providers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.provider-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px;
    border: 1.5px solid var(--tg-border-color);
    border-radius: var(--tg-radius-md);
    background: white;
    cursor: pointer;
    transition: all .2s;
    position: relative;
}
.provider-chip:hover { border-color: #94a3b8; }
.provider-chip.selected { border-color: var(--tg-secondary-color); background: #f5f3ff; }
.provider-dot {
    width: 32px; height: 32px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 11px; font-weight: 800;
    flex-shrink: 0;
}
.provider-chip-name { font-size: 13px; font-weight: 600; color: var(--tg-text-main); flex: 1; }
.provider-chip-check {
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--tg-secondary-color);
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 10px;
    opacity: 0; transition: opacity .2s;
}
.provider-chip.selected .provider-chip-check { opacity: 1; }

/* ── Buttons ── */
.btn-simulate {
    background: var(--tg-primary-color);
    color: white; border: none;
    padding: 16px 32px;
    border-radius: var(--tg-radius-md);
    font-size: 16px; font-weight: 700;
    width: 100%; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    transition: all .3s;
    box-shadow: 0 4px 14px rgba(244,130,34,.35);
    margin-top: 8px;
}
.btn-simulate:hover { background: #e3741b; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(244,130,34,.4); }
.btn-simulate:active { transform: translateY(0); }
.btn-simulate:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.btn-add-vehicle {
    background: none;
    border: 1.5px dashed var(--tg-primary-color);
    color: var(--tg-primary-color);
    padding: 6px 14px; border-radius: 8px;
    font-size: 12px; font-weight: 700; cursor: pointer;
    transition: all .2s;
}
.btn-add-vehicle:hover { background: #fff7f0; }

.btn-outline-sm {
    background: white;
    border: 1.5px solid var(--tg-border-color);
    color: var(--tg-text-main);
    padding: 6px 14px; border-radius: 8px;
    font-size: 12px; font-weight: 700; cursor: pointer;
    transition: all .2s;
}
.btn-outline-sm:hover { border-color: var(--tg-secondary-color); color: var(--tg-secondary-color); }

/* ── Loading Overlay ── */
.loading-overlay {
    position: fixed; inset: 0;
    background: rgba(15,23,42,.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: none;
    align-items: center; justify-content: center;
}
.loading-overlay.show { display: flex; }
.loading-content { text-align: center; }
.loading-spinner {
    width: 52px; height: 52px;
    border: 4px solid rgba(255,255,255,.2);
    border-top-color: var(--tg-primary-color);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    margin: 0 auto 16px;
}
.loading-text { color: white; font-size: 15px; font-weight: 600; }

/* ── Results ── */
.results-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--tg-border-color);
}
.results-title { font-size: 20px; font-weight: 800; color: var(--tg-text-main); margin: 0 0 4px; }

.result-breakdown-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 12px; margin-bottom: 16px;
}
.breakdown-cell {
    background: #f8fafc;
    border-radius: 10px; padding: 12px;
    text-align: center;
    border: 1px solid var(--tg-border-color);
}
.breakdown-cell small { display: block; font-size: 11px; color: var(--tg-text-muted); font-weight: 600; margin-bottom: 4px; }

.result-card-best {
    border-color: var(--tg-primary-color);
    box-shadow: 0 8px 30px rgba(244,130,34,.15);
}
.result-card-best::before { opacity: 1 !important; }

.best-label {
    position: absolute;
    top: -14px; left: 50%; transform: translateX(-50%);
    background: var(--tg-primary-color);
    color: white; font-size: 11px; font-weight: 700;
    padding: 4px 16px; border-radius: 20px;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(244,130,34,.4);
}

/* ── Mobile Adjustments ── */
@media (max-width: 640px) {
    .simulator-card {
        padding: 25px 20px;
    }

    .simulator-title {
        font-size: 1.75rem;
    }

    .results-grid {
        grid-template-columns: 1fr;
        margin-top: 32px;
    }

    .result-breakdown-grid {
        grid-template-columns: 1fr;
    }
}