/* TWS Property Calculators – Frontend Styles */

.tws-calc-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    max-width: 100%;
    margin: 0 auto;
    color: #1a1a2e;
}

/* ── TABS ───────────────────────────────────────────────────────────────────── */

.tws-calc-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 0;
    padding: 16px 16px 0;
    background: #f4f6f9;
    border-radius: 12px 12px 0 0;
    border: 1px solid #dde2ea;
    border-bottom: none;
}

.tws-tab {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px 6px 0 0;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    cursor: pointer;
    transition: all 0.18s ease;
    line-height: 1;
    white-space: nowrap;
}

.tws-tab:hover {
    background: #fff;
    color: #1a1a2e;
    border-color: #dde2ea;
}

.tws-tab.active {
    background: var(--secondary, #9F2121);
    color: #fff;
    border-color: var(--secondary, #9F2121);
    border-bottom-color: var(--secondary, #9F2121);
    font-weight: 700;
    margin-bottom: -1px;
    position: relative;
    z-index: 2;
}

/* ── PANELS ─────────────────────────────────────────────────────────────────── */

.tws-calc-panel {
    display: none;
    background: #fff;
    border: 1px solid #dde2ea;
    border-radius: 0 0 12px 12px;
    padding: 28px 32px 32px;
}

.tws-calc-panel.active {
    display: block;
}

/* ── PANEL HEADER ───────────────────────────────────────────────────────────── */

.tws-calc-header {
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid #eef0f4;
}

.tws-calc-header h3 {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 6px;
    color: #1a1a2e;
}

.tws-calc-header p {
    font-size: 14px;
    color: #666;
    margin: 0;
}

/* ── FORM FIELDS ────────────────────────────────────────────────────────────── */

.tws-calc-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.tws-field-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.tws-field-row label {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.tws-field-row input[type="number"],
.tws-field-row input[type="text"] {
    padding: 10px 14px;
    border: 1.5px solid #d0d5dd;
    border-radius: 7px;
    font-size: 15px;
    color: #1a1a2e;
    background: #fafbfc;
    transition: border-color 0.15s;
    width: 100%;
    box-sizing: border-box;
    -moz-appearance: textfield;
}

.tws-field-row input[type="number"]:focus {
    outline: none;
    border-color: #9F2121;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(159, 33, 33, 0.08);
}

.tws-field-row input::-webkit-outer-spin-button,
.tws-field-row input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

.tws-field-row small {
    font-size: 11.5px;
    color: #999;
}

.tws-optional {
    font-size: 11px;
    font-weight: 400;
    color: #aaa;
    background: #f4f6f9;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 4px;
}

.tws-checkbox-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
}

.tws-checkbox-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #9F2121;
}

/* ── CALCULATE BUTTON ───────────────────────────────────────────────────────── */

.tws-calc-btn {
    margin-top: 6px;
    padding: 12px 28px;
    background: #9F2121;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.18s, transform 0.1s;
    align-self: flex-start;
    letter-spacing: 0.2px;
}

.tws-calc-btn:hover {
    background: #7d1a1a;
}

.tws-calc-btn:active,
.tws-calc-btn.loading {
    transform: scale(0.98);
    background: #7d1a1a;
    opacity: 0.8;
}

/* ── RESULTS ────────────────────────────────────────────────────────────────── */

.tws-calc-result {
    margin-top: 24px;
    border-top: 1px solid #eef0f4;
    padding-top: 20px;
}

.tws-result-inner {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tws-result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
    border-bottom: 1px solid #f0f2f6;
}

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

.tws-result-label {
    color: #555;
}

.tws-result-value {
    font-weight: 600;
    color: #1a1a2e;
}

.tws-result-row.highlight .tws-result-value {
    color: #9F2121;
    font-size: 16px;
}

.tws-result-row.positive .tws-result-value {
    color: #16a34a;
}

.tws-result-divider {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #999;
    padding: 14px 0 4px;
}

.tws-result-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding: 14px 18px;
    background: #fdf2f2;
    border-radius: 8px;
    border-left: 4px solid #9F2121;
    font-weight: 700;
    font-size: 16px;
    color: #9F2121;
}

.tws-result-disclaimer {
    font-size: 11.5px;
    color: #aaa;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px dashed #e0e0e0;
}

.tws-result-error {
    color: #cc0000;
    font-size: 14px;
    padding: 10px;
    background: #fff0f0;
    border-radius: 6px;
    border: 1px solid #ffcccc;
}

/* ── RESPONSIVE ─────────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .tws-calc-panel {
        padding: 20px 16px 24px;
    }

    /* Mobile: single-row horizontal scroll strip */
    .tws-calc-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        padding: 10px 12px;
        gap: 6px;
        border-radius: 10px 10px 0 0;
        border-bottom: 2px solid #dde2ea;
        /* Hide scrollbar — visible on drag, hidden at rest */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .tws-calc-tabs::-webkit-scrollbar {
        display: none;
    }

    .tws-tab {
        flex: 0 0 auto;
        font-size: 12.5px;
        font-weight: 600;
        padding: 8px 14px;
        border-radius: 20px;
        border: 1.5px solid #dde2ea;
        white-space: nowrap;
        background: #fff;
        color: #555;
        /* Remove desktop bottom-tab styling */
        margin-bottom: 0;
    }

    .tws-tab:hover {
        background: #f4f6f9;
        border-color: #c0c8d4;
        color: #1a1a2e;
    }

    .tws-tab.active {
        background: var(--secondary, #9F2121);
        color: #fff;
        border-color: var(--secondary, #9F2121);
        font-weight: 700;
        margin-bottom: 0;
        box-shadow: 0 2px 8px rgba(159, 33, 33, 0.30);
    }

    /* Panel connects cleanly below the strip */
    .tws-calc-panel {
        border-radius: 0 0 10px 10px;
        border-top: none;
    }

    .tws-result-total {
        font-size: 14px;
    }

    /* Calc button full-width on mobile */
    .tws-calc-btn {
        width: 100%;
        text-align: center;
        align-self: stretch;
    }
}

/* ── EMAIL BAR ──────────────────────────────────────────────────────────────── */

.tws-email-bar {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px dashed #e0e0e0;
    text-align: right;
}

.tws-email-btn {
    background: transparent;
    border: 1.5px solid #9F2121;
    color: #9F2121;
    padding: 9px 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    letter-spacing: 0.2px;
}

.tws-email-btn:hover {
    background: #9F2121;
    color: #fff;
}

/* ── EMAIL MODAL ────────────────────────────────────────────────────────────── */

.tws-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    padding: 20px;
    box-sizing: border-box;
}

.tws-modal-overlay.visible {
    opacity: 1;
}

.tws-modal {
    background: #fff;
    border-radius: 12px;
    padding: 32px 36px;
    max-width: 460px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    transform: translateY(10px);
    transition: transform 0.2s ease;
}

.tws-modal-overlay.visible .tws-modal {
    transform: translateY(0);
}

.tws-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 18px;
    color: #aaa;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.15s;
}

.tws-modal-close:hover {
    color: #333;
}

.tws-modal h3 {
    margin: 0 0 8px;
    font-size: 19px;
    font-weight: 800;
    color: #1a1a2e;
}

.tws-modal p {
    font-size: 14px;
    color: #666;
    margin: 0 0 20px;
    line-height: 1.5;
}

.tws-modal-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.tws-modal-field label {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.tws-modal-field input[type="email"] {
    padding: 11px 14px;
    border: 1.5px solid #d0d5dd;
    border-radius: 7px;
    font-size: 15px;
    color: #1a1a2e;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.tws-modal-field input[type="email"]:focus {
    outline: none;
    border-color: #9F2121;
    box-shadow: 0 0 0 3px rgba(159,33,33,0.08);
}

.tws-modal-send-btn {
    width: 100%;
    padding: 13px;
    background: #9F2121;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.18s;
    margin-bottom: 12px;
}

.tws-modal-send-btn:hover {
    background: #7d1a1a;
}

.tws-modal-send-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.tws-modal-note {
    font-size: 11.5px !important;
    color: #bbb !important;
    margin: 0 !important;
    text-align: center;
}

.tws-fb-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
}

.tws-fb-error {
    background: #fff0f0;
    border: 1px solid #ffcccc;
    color: #cc0000;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
}
