/* ═══════════════════════════════════════════════════════════════════
   TBP Deal Builder — Stylesheet
   Brand: Teal (#2CBAB7), Coral (#E8734A), Warm Red (#D94040)
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --tbp-teal: #2CBAB7;
    --tbp-teal-dark: #1f9e9b;
    --tbp-teal-light: #e8f7f6;
    --tbp-coral: #E8734A;
    --tbp-coral-dark: #d4613b;
    --tbp-red: #D94040;
    --tbp-gold: #F5A623;
    --tbp-gold-light: #fef7e8;
    --tbp-green: #28a745;
    --tbp-green-light: #e6f9ed;
    --tbp-text: #1d1d1f;
    --tbp-text-secondary: #6b7280;
    --tbp-bg: #f8f9fa;
    --tbp-white: #ffffff;
    --tbp-border: #e5e7eb;
    --tbp-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --tbp-radius: 12px;
    --tbp-radius-sm: 8px;
}

/* ─── Base Container ─────────────────────────────────────────────── */

.tbp-deal-builder {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    max-width: 1100px;
    margin: 0 auto;
    padding: 30px 20px;
    color: var(--tbp-text);
}

.tbp-deal-builder * {
    box-sizing: border-box;
}

.tbp-deal-builder h1 {
    font-size: 2.2rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 5px;
}

.tbp-deal-builder .tbp-subtitle {
    text-align: center;
    color: var(--tbp-text-secondary);
    font-size: 1.05rem;
    margin-bottom: 30px;
}

/* ─── Step Sections ──────────────────────────────────────────────── */

.tbp-section {
    display: none;
    animation: tbpFadeIn 0.4s ease;
}

.tbp-section.active {
    display: block;
}

@keyframes tbpFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── Entry Toggle (Upgrade / New Contract) ──────────────────────── */

.tbp-entry-toggle {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
}

.tbp-entry-btn {
    font-family: 'Inter', sans-serif;
    padding: 14px 40px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.tbp-entry-btn.upgrade {
    background: var(--tbp-teal);
    color: white;
    border-color: var(--tbp-teal);
}

.tbp-entry-btn.upgrade:hover {
    background: var(--tbp-teal-dark);
}

.tbp-entry-btn.upgrade.inactive {
    background: transparent;
    color: var(--tbp-teal);
    border-color: var(--tbp-teal);
}

.tbp-entry-btn.new-contract {
    background: transparent;
    color: var(--tbp-coral);
    border-color: var(--tbp-coral);
}

.tbp-entry-btn.new-contract:hover {
    background: rgba(232, 115, 74, 0.08);
}

.tbp-entry-btn.new-contract.active {
    background: var(--tbp-coral);
    color: white;
}

/* ─── Lookup Form ────────────────────────────────────────────────── */

.tbp-lookup-form {
    max-width: 500px;
    margin: 0 auto;
    background: var(--tbp-white);
    padding: 30px;
    border-radius: var(--tbp-radius);
    box-shadow: var(--tbp-shadow);
}

.tbp-lookup-form h3 {
    font-size: 1.2rem;
    margin-bottom: 20px;
}

.tbp-input-group {
    margin-bottom: 18px;
}

.tbp-input-group label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 6px;
    color: var(--tbp-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tbp-input-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--tbp-border);
    border-radius: var(--tbp-radius-sm);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s;
}

.tbp-input-group input:focus {
    outline: none;
    border-color: var(--tbp-teal);
}

.tbp-btn-primary {
    font-family: 'Inter', sans-serif;
    width: 100%;
    padding: 14px;
    background: var(--tbp-teal);
    color: white;
    border: none;
    border-radius: var(--tbp-radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.tbp-btn-primary:hover {
    background: var(--tbp-teal-dark);
}

.tbp-btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.tbp-error-msg {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--tbp-red);
    padding: 10px 15px;
    border-radius: var(--tbp-radius-sm);
    margin-bottom: 15px;
    font-size: 0.9rem;
    display: none;
}

.tbp-error-msg.visible {
    display: block;
}

.tbp-loading {
    text-align: center;
    padding: 20px;
    color: var(--tbp-text-secondary);
}

.tbp-loading .spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--tbp-border);
    border-top-color: var(--tbp-teal);
    border-radius: 50%;
    animation: tbpSpin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

/* ─── Current Plan Card ──────────────────────────────────────────── */

.tbp-current-plan {
    background: var(--tbp-white);
    border-left: 4px solid var(--tbp-teal);
    border-radius: var(--tbp-radius);
    box-shadow: var(--tbp-shadow);
    padding: 25px;
    margin-bottom: 30px;
}

.tbp-current-plan h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.tbp-plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.tbp-plan-item {
    display: flex;
    flex-direction: column;
}

.tbp-plan-item .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--tbp-text-secondary);
    margin-bottom: 2px;
}

.tbp-plan-item .value {
    font-weight: 600;
    font-size: 1rem;
}

.tbp-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 12px;
}

.tbp-badge.eligible {
    background: var(--tbp-green-light);
    color: var(--tbp-green);
}

.tbp-badge.not-eligible {
    background: #fef2f2;
    color: var(--tbp-red);
}

/* ─── Recommended Package ────────────────────────────────────────── */

.tbp-recommended {
    background: var(--tbp-gold-light);
    border: 2px solid var(--tbp-gold);
    border-radius: var(--tbp-radius);
    padding: 25px;
    margin-bottom: 30px;
    position: relative;
}

.tbp-recommended .tbp-recommended-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--tbp-gold);
    color: white;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.tbp-recommended h3 {
    font-size: 1.4rem;
    margin-bottom: 5px;
}

.tbp-recommended .price {
    font-size: 2rem;
    font-weight: 800;
    color: var(--tbp-text);
}

.tbp-recommended .price span {
    font-size: 1rem;
    font-weight: 500;
    color: var(--tbp-text-secondary);
}

.tbp-recommended .saving {
    color: var(--tbp-green);
    font-weight: 600;
    font-size: 0.9rem;
    margin: 8px 0;
}

.tbp-recommended .features {
    list-style: none;
    padding: 0;
    margin: 12px 0;
}

.tbp-recommended .features li {
    padding: 4px 0;
    font-size: 0.9rem;
    color: var(--tbp-text-secondary);
}

.tbp-recommended .features li::before {
    content: '✓ ';
    color: var(--tbp-teal);
    font-weight: 700;
}

.tbp-btn-select-recommended {
    font-family: 'Inter', sans-serif;
    background: var(--tbp-teal);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: var(--tbp-radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 10px;
}

.tbp-btn-select-recommended:hover {
    background: var(--tbp-teal-dark);
    transform: translateY(-1px);
}

/* ─── Package Grid ───────────────────────────────────────────────── */

.tbp-package-section h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--tbp-text-secondary);
}

.tbp-package-category {
    margin-bottom: 25px;
}

.tbp-package-category h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--tbp-text-secondary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--tbp-border);
}

.tbp-package-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.tbp-package-card {
    background: var(--tbp-white);
    border: 2px solid var(--tbp-border);
    border-radius: var(--tbp-radius);
    padding: 18px 14px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.tbp-package-card:hover {
    border-color: var(--tbp-teal);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(44, 186, 183, 0.15);
}

.tbp-package-card.selected {
    border-color: var(--tbp-teal);
    background: var(--tbp-teal-light);
}

.tbp-package-card .pkg-name {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 6px;
}

.tbp-package-card .pkg-price {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--tbp-coral);
    margin-bottom: 8px;
}

.tbp-package-card .pkg-price span {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--tbp-text-secondary);
}

.tbp-package-card .pkg-details {
    font-size: 0.75rem;
    color: var(--tbp-text-secondary);
    line-height: 1.5;
}

.tbp-package-card .pkg-details .detail-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.tbp-package-card.is-suggested::after {
    content: '★ SUGGESTED';
    position: absolute;
    top: -10px;
    right: 10px;
    background: var(--tbp-gold);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    letter-spacing: 0.5px;
}

/* ─── Device Grid ────────────────────────────────────────────────── */

.tbp-device-section {
    margin-top: 30px;
}

.tbp-device-section h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.tbp-device-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.tbp-device-card {
    background: var(--tbp-white);
    border: 2px solid var(--tbp-border);
    border-radius: var(--tbp-radius);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.tbp-device-card:hover {
    border-color: var(--tbp-teal);
    transform: translateY(-2px);
    box-shadow: var(--tbp-shadow);
}

.tbp-device-card.selected {
    border-color: var(--tbp-teal);
    background: var(--tbp-teal-light);
}

.tbp-device-card img {
    width: 120px;
    height: 140px;
    object-fit: contain;
    margin-bottom: 10px;
}

.tbp-device-card .device-name {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 5px;
}

.tbp-device-card .device-price {
    color: var(--tbp-coral);
    font-weight: 600;
    font-size: 0.9rem;
}

/* ─── Tech Specs Tooltip ─────────────────────────────────────────── */

.tbp-device-card .tech-specs-trigger {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--tbp-teal);
    cursor: pointer;
    font-weight: 600;
}

.tbp-device-card .tech-specs-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--tbp-text);
    color: white;
    padding: 14px 18px;
    border-radius: var(--tbp-radius-sm);
    font-size: 0.8rem;
    line-height: 1.7;
    min-width: 220px;
    z-index: 100;
    text-align: left;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

.tbp-device-card .tech-specs-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: var(--tbp-text);
}

.tbp-device-card:hover .tech-specs-tooltip {
    display: block;
    animation: tbpFadeIn 0.2s ease;
}

.tbp-device-card .tech-specs-tooltip .spec-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tbp-device-card .tech-specs-tooltip .spec-row:last-child {
    border-bottom: none;
}

.tbp-device-card .tech-specs-tooltip .spec-label {
    color: rgba(255, 255, 255, 0.6);
}

.tbp-device-card .tech-specs-tooltip .spec-value {
    font-weight: 600;
}

.tbp-device-card .tech-specs-tooltip .raw-specs {
    white-space: pre-wrap;
    font-size: 0.8rem;
    color: #eee;
}

.tbp-device-card .tech-specs-tooltip .raw-specs ul {
    padding-left: 15px;
    margin: 5px 0;
}

.tbp-device-card .tech-specs-tooltip .raw-specs p {
    margin: 0 0 5px 0;
}

/* ─── Colour Swatches / Pills ────────────────────────────────────── */

.tbp-colour-section {
    margin-top: 25px;
}

.tbp-colour-section h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.tbp-colour-pills {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tbp-colour-pill {
    padding: 10px 18px;
    border-radius: 20px;
    border: 2px solid var(--tbp-border);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    background: var(--tbp-white);
    transition: all 0.2s;
    color: var(--tbp-text);
}

.tbp-colour-pill:hover {
    border-color: var(--tbp-teal);
    background: var(--tbp-teal-light);
}

.tbp-colour-pill.selected {
    border-color: var(--tbp-teal);
    background: var(--tbp-teal);
    color: white;
}

/* ─── Summary / Cart ─────────────────────────────────────────────── */

.tbp-summary {
    background: var(--tbp-white);
    border: 2px solid var(--tbp-teal);
    border-radius: var(--tbp-radius);
    padding: 25px;
    margin-top: 30px;
}

.tbp-summary h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.tbp-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--tbp-border);
    font-size: 0.95rem;
}

.tbp-summary-row:last-of-type {
    border-bottom: none;
}

.tbp-summary-row .label {
    color: var(--tbp-text-secondary);
}

.tbp-summary-row .value {
    font-weight: 600;
}

.tbp-summary-total {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid var(--tbp-text);
    font-size: 1.2rem;
    font-weight: 700;
}

.tbp-summary-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.tbp-btn-add-cart {
    font-family: 'Inter', sans-serif;
    flex: 1;
    padding: 14px;
    background: var(--tbp-coral);
    color: white;
    border: none;
    border-radius: var(--tbp-radius-sm);
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.tbp-btn-add-cart:hover {
    background: var(--tbp-coral-dark);
    transform: translateY(-1px);
}

.tbp-btn-another {
    font-family: 'Inter', sans-serif;
    padding: 14px 20px;
    background: transparent;
    color: var(--tbp-teal);
    border: 2px solid var(--tbp-teal);
    border-radius: var(--tbp-radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.tbp-btn-another:hover {
    background: var(--tbp-teal-light);
}

/* ─── Downgrade Warning Modal ────────────────────────────────────── */

.tbp-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.tbp-modal-overlay.visible {
    display: flex;
}

.tbp-modal {
    background: var(--tbp-white);
    border-radius: var(--tbp-radius);
    padding: 35px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: tbpModalIn 0.3s ease;
}

@keyframes tbpModalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.tbp-modal .warning-icon {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 15px;
}

.tbp-modal h3 {
    text-align: center;
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: var(--tbp-gold);
}

.tbp-modal p {
    color: var(--tbp-text-secondary);
    line-height: 1.6;
    margin-bottom: 15px;
}

.tbp-modal ul {
    padding-left: 20px;
    margin-bottom: 25px;
    color: var(--tbp-text-secondary);
    line-height: 1.8;
}

.tbp-modal .modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tbp-modal .btn-go-back {
    font-family: 'Inter', sans-serif;
    padding: 14px;
    background: var(--tbp-teal);
    color: white;
    border: none;
    border-radius: var(--tbp-radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.tbp-modal .btn-go-back:hover {
    background: var(--tbp-teal-dark);
}

.tbp-modal .btn-proceed {
    font-family: 'Inter', sans-serif;
    padding: 12px;
    background: transparent;
    color: var(--tbp-red);
    border: 1px solid var(--tbp-red);
    border-radius: var(--tbp-radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.tbp-modal .btn-proceed:hover {
    background: #fef2f2;
}

/* ─── Sticky Bottom Bar ──────────────────────────────────────────── */

.tbp-sticky-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--tbp-white);
    border-top: 2px solid var(--tbp-border);
    padding: 15px 30px;
    display: none;
    align-items: center;
    justify-content: space-between;
    z-index: 999;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

.tbp-sticky-bar.visible {
    display: flex;
}

.tbp-sticky-bar .bar-info {
    font-weight: 600;
}

.tbp-sticky-bar .bar-price {
    color: var(--tbp-coral);
    font-size: 1.2rem;
    font-weight: 700;
}

/* ─── Not Eligible Banner ────────────────────────────────────────── */

.tbp-not-eligible {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--tbp-radius);
    padding: 25px;
    text-align: center;
    margin-bottom: 30px;
}

.tbp-not-eligible h3 {
    color: var(--tbp-red);
    margin-bottom: 10px;
}

.tbp-not-eligible p {
    color: var(--tbp-text-secondary);
    margin-bottom: 15px;
}

.tbp-not-eligible .btn-new-contract,
.tbp-not-eligible .btn-search-another {
    font-family: 'Inter', sans-serif;
    padding: 12px 30px;
    color: white;
    border: none;
    border-radius: var(--tbp-radius-sm);
    font-weight: 600;
    cursor: pointer;
    margin: 5px;
}

.tbp-not-eligible .btn-new-contract {
    background: var(--tbp-coral);
}

.tbp-not-eligible .btn-search-another {
    background: var(--tbp-teal);
}

/* ─── Info Banner ────────────────────────────────────────────────── */

.tbp-info-banner {
    background: var(--tbp-teal-light);
    border: 1px solid rgba(44, 186, 183, 0.3);
    border-radius: var(--tbp-radius-sm);
    padding: 12px 20px;
    margin-bottom: 25px;
    font-size: 0.9rem;
    color: var(--tbp-teal-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ─── Responsive ─────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .tbp-deal-builder h1 {
        font-size: 1.6rem;
    }

    .tbp-entry-toggle {
        flex-direction: column;
    }

    .tbp-entry-btn {
        width: 100%;
        text-align: center;
    }

    .tbp-package-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .tbp-device-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .tbp-plan-grid {
        grid-template-columns: 1fr 1fr;
    }

    .tbp-summary-actions {
        flex-direction: column;
    }

    .tbp-sticky-bar {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .tbp-package-grid {
        grid-template-columns: 1fr;
    }

    .tbp-device-grid {
        grid-template-columns: 1fr;
    }
}