* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f4f6f8;
    color: #1f2937;
    direction: rtl;
}

.container {
    width: min(1000px, 94%);
    margin: 30px auto;
}

.page-header {
    margin-bottom: 20px;
}

.page-header h1 {
    margin: 0 0 6px;
    font-size: 30px;
}

.company-name {
    font-size: 18px;
    font-weight: 700;
    color: #1f4f8a;
}

.test-note {
    margin-top: 4px;
    color: #6b7280;
    font-size: 14px;
}

.card {
    background: #ffffff;
    border: 1px solid #dfe3e8;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 18px;
}

.card h2 {
    margin: 0 0 18px;
    font-size: 20px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-weight: 600;
}

input,
select {
    width: 100%;
    padding: 10px 11px;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    background: #ffffff;
    font-size: 16px;
}

input:focus,
select:focus {
    outline: none;
    border-color: #1f4f8a;
}

.checks {
    display: flex;
    flex-wrap: wrap;
    gap: 26px;
    margin-top: 20px;
}

.check-row {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.check-row input {
    width: auto;
    margin: 0;
}

.calculate {
    display: inline-block;
    border: 0;
    border-radius: 6px;
    padding: 12px 30px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    background: #1f4f8a;
    color: #ffffff;
    margin-bottom: 20px;
}

.calculate:hover {
    background: #173d6b;
}

.message {
    padding: 13px 15px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.error {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.result table {
    width: 100%;
    border-collapse: collapse;
}

.result th,
.result td {
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
}

.result th {
    text-align: right;
    font-weight: 600;
}

.result td {
    text-align: left;
    white-space: nowrap;
}

.result .subtotal {
    font-weight: 700;
    background: #f8fafc;
}

.result .total {
    font-size: 20px;
    font-weight: 700;
    background: #eaf1f8;
}

.result .total th,
.result .total td {
    border-bottom: 0;
}

@media (max-width: 700px) {
    .container {
        width: 95%;
        margin: 18px auto;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .checks {
        flex-direction: column;
        gap: 12px;
    }

    .result th,
    .result td {
        font-size: 14px;
    }
}

/* ==========================================
   Results page
========================================== */

.results-header {
    margin-bottom: 24px;
}

.request-summary {
    margin-bottom: 28px;
}

.summary-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 18px;
}

.summary-top h2 {
    margin: 0;
}

.edit-link {
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.summary-grid > div {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.summary-label {
    font-size: 13px;
    color: #667085;
}

.results-section {
    margin-top: 20px;
}

.results-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.results-title h2 {
    margin: 0;
}

.results-title span {
    color: #667085;
    font-size: 14px;
}

.company-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
}

.company-card {
    position: relative;
    background: #fff;
    border: 1px solid #d9dee7;
    border-radius: 10px;
    padding: 22px;
    overflow: hidden;
}

.company-card.best-result {
    border-width: 2px;
}

.best-badge {
    position: absolute;
    top: 0;
    right: 0;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 700;
    background: #eef5ff;
}

.company-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-top: 10px;
    padding-bottom: 18px;
    border-bottom: 1px solid #eceff3;
}

.company-name {
    font-size: 23px;
    font-weight: 700;
}

.company-subtitle {
    margin-top: 4px;
    font-size: 13px;
    color: #667085;
}

.company-price {
    text-align: left;
}

.company-price span {
    display: block;
    font-size: 12px;
    color: #667085;
    margin-bottom: 3px;
}

.company-price strong {
    font-size: 26px;
}

.coverage-list {
    padding: 12px 0;
}

.coverage-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 9px 0;
    border-bottom: 1px solid #f0f1f3;
    font-size: 14px;
}

.coverage-row:last-child {
    border-bottom: 0;
}

.company-actions {
    margin-top: 16px;
}

.proposal-button {
    width: 100%;
    padding: 11px 18px;
    border: 0;
    border-radius: 6px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
}

.proposal-button:disabled {
    opacity: .55;
    cursor: default;
}

.company-error {
    margin-top: 20px;
    padding: 16px;
    background: #fff4f4;
    border-radius: 6px;
}

.company-error strong {
    display: block;
    margin-bottom: 8px;
}

.company-notes {
    margin-top: 12px;
    font-size: 13px;
}

.results-footer {
    margin: 28px 0;
}

.back-button {
    display: inline-block;
    text-decoration: none;
    font-weight: 600;
}

@media (max-width: 900px) {

    .company-grid {
        grid-template-columns: 1fr;
    }

    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }

}

@media (max-width: 520px) {

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .company-card-header {
        flex-direction: column;
    }

    .company-price {
        text-align: right;
    }

}

/* =========================================================
   Results page - redesigned
========================================================= */

.results-page {
    max-width: 1180px;
}

.comparison-summary {
    background: #ffffff;
    border: 1px solid #dfe3e8;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 32px;
}

.comparison-summary-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.comparison-summary-head h2 {
    margin: 0 0 4px;
    font-size: 20px;
}

.comparison-summary-head p {
    margin: 0;
    font-size: 13px;
    color: #667085;
}

.change-data-button {
    border: 1px solid #b8c4d4;
    background: #ffffff;
    border-radius: 7px;
    padding: 9px 16px;
    font-weight: 700;
    cursor: pointer;
}

.comparison-summary-items {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.summary-chip {
    background: #f6f8fb;
    border: 1px solid #e5e9ef;
    border-radius: 8px;
    padding: 9px 14px;
    min-width: 125px;
}

.summary-chip span {
    display: block;
    font-size: 11px;
    color: #667085;
    margin-bottom: 2px;
}

.summary-chip strong {
    font-size: 14px;
}

.offers-section {
    margin-top: 10px;
}

.offers-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 16px;
}

.offers-heading h2 {
    margin: 0;
    font-size: 24px;
}

.offers-heading p {
    margin: 5px 0 0;
    color: #667085;
    font-size: 13px;
}

.offers-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}

.offer-card {
    position: relative;
    background: #ffffff;
    border: 1px solid #dfe3e8;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.05);
}

.offer-card.winner {
    border-width: 2px;
}

.winner-label {
    position: absolute;
    top: -12px;
    right: 18px;
    background: #eef5ff;
    border: 1px solid #cfdff5;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.offer-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
}

.offer-company {
    display: flex;
    align-items: center;
    gap: 11px;
}

.company-placeholder-logo {
    width: 42px;
    height: 42px;
    border-radius: 9px;
    background: #f1f4f8;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    font-weight: 700;
}

.offer-company h3 {
    margin: 0;
    font-size: 21px;
}

.offer-company span {
    display: block;
    margin-top: 2px;
    color: #667085;
    font-size: 12px;
}

.offer-price {
    text-align: left;
}

.offer-price span {
    display: block;
    color: #667085;
    font-size: 11px;
    margin-bottom: 3px;
}

.offer-price strong {
    font-size: 27px;
    line-height: 1.1;
}

.offer-divider {
    height: 1px;
    background: #eceff3;
    margin: 18px 0 10px;
}

.offer-details > div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 9px 0;
    border-bottom: 1px solid #f1f2f4;
}

.offer-details > div:last-child {
    border-bottom: 0;
}

.offer-details span {
    color: #5d6673;
    font-size: 13px;
}

.offer-details strong {
    font-size: 13px;
    text-align: left;
}

.offer-actions {
    margin-top: 18px;
}

.full-offer-button {
    width: 100%;
    border: 0;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 700;
}

.full-offer-button:disabled {
    opacity: .55;
}

.offer-note {
    margin-top: 12px;
    padding: 10px 12px;
    background: #fff9e8;
    border-radius: 7px;
    font-size: 12px;
}

.offer-error {
    margin-top: 20px;
    padding: 15px;
    background: #fff3f3;
    border-radius: 8px;
}

.offer-error strong {
    display: block;
    margin-bottom: 7px;
}

.general-error-box {
    background: #fff;
    border: 1px solid #e1b7b7;
    border-radius: 12px;
    padding: 24px;
    margin-top: 24px;
}

.general-error-box h2 {
    margin-top: 0;
}

.general-error-box button {
    margin-top: 16px;
    padding: 10px 16px;
    font-weight: 700;
    cursor: pointer;
}

@media (max-width: 1000px) {

    .offers-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}

@media (max-width: 700px) {

    .comparison-summary-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .offers-grid {
        grid-template-columns: 1fr;
    }

    .offer-card-top {
        flex-direction: column;
    }

    .offer-price {
        text-align: right;
    }

}

@media (max-width: 480px) {

    .summary-chip {
        min-width: calc(50% - 6px);
        flex: 1;
    }

}