/**
 * Quote Builder - Refactored Styles
 * Clean, consolidated CSS
 */

/* Floating Button */
.qb-floating-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: linear-gradient(135deg, #c5a059 0%, #b08d4b 100%);
    color: #0f172a;
    border: none;
    padding: 16px 24px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(197, 160, 89, 0.4);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.qb-floating-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(197, 160, 89, 0.5);
}

.qb-floating-btn span {
    font-size: 20px;
}

/* Modal Overlay */
.quote-builder-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.quote-builder-modal {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 100px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

/* Header */
.qb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: white;
}

.qb-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.qb-title h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.qb-subtitle {
    font-size: 12px;
    color: #94a3b8;
}

.qb-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 20px;
    cursor: pointer;
}

/* Progress */
.qb-progress {
    padding: 16px 24px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.qb-progress-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.qb-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #c5a059 0%, #b08d4b 100%);
    transition: width 0.3s;
}

.qb-step-indicator {
    font-size: 12px;
    color: #64748b;
    text-align: center;
}

/* Body */
.qb-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

/* Step */
.qb-step h4 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #0f172a;
}

/* Sticky client badge — Steps 2–5 */
.qb-client-badge {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    margin: 0 0 16px 0;
    background: linear-gradient(90deg, #eff6ff 0%, #f8fafc 100%);
    border: 1px solid #dbeafe;
    border-left: 3px solid #2563eb;
    border-radius: 8px;
    font-size: 13px;
    color: #0f172a;
}
.qb-cb-name strong { color: #1d4ed8; }
.qb-cb-meta { color: #475569; font-size: 12px; }
.qb-cb-link { color: #2563eb; text-decoration: none; }
.qb-cb-link:hover { text-decoration: underline; }

/* Step 2 read-only contact context block */
.qb-contact-readonly {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    padding: 10px 14px;
    margin: 0 0 14px 0;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    font-size: 12px;
    color: #475569;
}
.qb-contact-readonly span strong { color: #0f172a; font-weight: 600; }

/* Figure snapshot banner — Step 4 when opened via openWithSnapshot */
.qb-snapshot-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    margin: 0 0 14px 0;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    font-size: 13px;
    color: #78350f;
}
.qb-btn-link {
    background: transparent;
    border: none;
    color: #2563eb;
    font-weight: 600;
    cursor: pointer;
    font-size: 12px;
    text-decoration: underline;
}
.qb-btn-link:hover { color: #1d4ed8; }

/* Share quote result block */
.qb-btn-share { background: linear-gradient(135deg, #059669, #047857) !important; color: #fff !important; }
.qb-share-loading { padding: 14px; text-align: center; color: #475569; }
.qb-share-result {
    padding: 14px;
    border-radius: 10px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}
.qb-share-title { font-weight: 700; color: #065f46; margin-bottom: 10px; }
.qb-share-url { display: flex; gap: 6px; margin-bottom: 10px; }
.qb-share-url input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
    font-family: ui-monospace, monospace;
    background: #fff;
}
.qb-share-actions { display: flex; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.qb-share-actions .qb-btn-link {
    padding: 6px 10px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #cbd5e1;
    text-decoration: none;
}
.qb-share-error { padding: 14px; background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; color: #991b1b; }

/* Lead Sources */
.qb-section-label {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.qb-source-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.qb-source-btn {
    padding: 16px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.qb-source-btn:hover {
    border-color: #c5a059;
    background: #fffbeb;
}

.qb-source-icon {
    font-size: 24px;
    display: block;
    margin-bottom: 8px;
}

.qb-source-name {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
}

/* Leads List */
.qb-leads-list {
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease;
}

.qb-leads-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.qb-demo-badge {
    background: #fef3c7;
    color: #92400e;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
}

.qb-leads-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.qb-lead-card {
    padding: 16px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.qb-lead-card:hover {
    border-color: #c5a059;
    transform: translateX(4px);
}

.qb-lead-card.hot { border-left: 4px solid #ef4444; }
.qb-lead-card.warm { border-left: 4px solid #f59e0b; }
.qb-lead-card.new { border-left: 4px solid #3b82f6; }

.qb-lead-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.qb-lead-name {
    font-weight: 700;
    color: #0f172a;
}

.qb-lead-status {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: uppercase;
}

.qb-lead-status.hot { background: #fef2f2; color: #dc2626; }
.qb-lead-status.warm { background: #fffbeb; color: #d97706; }
.qb-lead-status.new { background: #eff6ff; color: #2563eb; }

.qb-lead-details {
    font-size: 13px;
    color: #64748b;
}

.qb-lead-amount {
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 4px;
}

/* Divider */
.qb-or-divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.qb-or-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e2e8f0;
}

.qb-or-divider span {
    background: white;
    padding: 0 16px;
    font-size: 12px;
    color: #94a3b8;
    position: relative;
}

/* Buttons */
.qb-add-manual-btn {
    width: 100%;
    padding: 14px;
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}

.qb-add-manual-btn:hover {
    border-color: #c5a059;
    color: #c5a059;
}

.qb-btn-primary {
    background: linear-gradient(135deg, #c5a059 0%, #b08d4b 100%);
    color: #0f172a;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.qb-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(197, 160, 89, 0.3);
}

.qb-btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.qb-btn-secondary:hover {
    background: #e2e8f0;
}

/* Forms */
.qb-form-section {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.qb-form-section h5 {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: #0f172a;
}

.qb-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

@media (max-width: 500px) {
    .qb-form-row {
        grid-template-columns: 1fr;
    }
}

.qb-form-group {
    display: flex;
    flex-direction: column;
}

.qb-form-group label {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.qb-form-group input,
.qb-form-group select {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
}

.qb-form-group input:focus,
.qb-form-group select:focus {
    outline: none;
    border-color: #c5a059;
    box-shadow: 0 0 0 3px rgba(197, 160, 89, 0.1);
}

/* Purpose Options */
.qb-purpose-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.qb-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
}

.qb-radio input {
    margin: 0;
}

/* Broker Paste */
.qb-broker-paste,
.qb-rate-paste-area {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.qb-rate-instructions {
    background: white;
    border-left: 4px solid #3b82f6;
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: 0 8px 8px 0;
}

.qb-rate-instructions p {
    margin: 0 0 8px 0;
    font-size: 13px;
    font-weight: 600;
}

.qb-rate-instructions ol {
    margin: 0;
    padding-left: 16px;
    font-size: 12px;
}

.qb-rate-instructions li {
    margin-bottom: 4px;
}

.qb-rate-instructions kbd {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 11px;
}

.qb-broker-paste textarea,
.qb-rate-paste-area textarea {
    width: 100%;
    min-height: 150px;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    font-family: monospace;
    resize: vertical;
    margin-bottom: 12px;
}

/* Equity Preview */
.qb-equity-preview {
    margin-top: 16px;
}

.qb-equity-card {
    background: white;
    border-radius: 10px;
    padding: 16px;
}

.qb-equity-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
    font-size: 14px;
}

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

.qb-equity-row.highlight {
    background: #f0fdf4;
    margin: 0 -16px;
    padding: 8px 16px;
    color: #059669;
}

/* Rate Options */
.qb-rate-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.qb-rate-option {
    padding: 20px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.qb-rate-option:hover {
    border-color: #c5a059;
    background: #fffbeb;
}

.qb-rate-icon {
    font-size: 28px;
    display: block;
    margin-bottom: 8px;
}

.qb-rate-option h5 {
    margin: 0 0 4px 0;
    font-size: 14px;
}

.qb-rate-option p {
    margin: 0;
    font-size: 12px;
    color: #64748b;
}

/* Recommendation */
.qb-recommendation-card {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 2px solid #86efac;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    text-align: center;
}

.qb-rec-badge {
    display: inline-block;
    background: #22c55e;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 12px;
}

.qb-recommendation-card h5 {
    margin: 0 0 20px 0;
    font-size: 20px;
}

.qb-rec-numbers {
    display: flex;
    justify-content: center;
    gap: 40px;
}

.qb-rec-number {
    text-align: center;
}

.qb-rec-label {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 4px;
}

.qb-rec-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
}

/* Quote Summary */
.qb-quote-summary {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.qb-quote-summary h5 {
    margin: 0 0 16px 0;
    font-size: 18px;
}

.qb-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #e2e8f0;
}

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

/* Final Actions */
.qb-final-actions {
    margin-bottom: 20px;
}

.qb-btn-action {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #c5a059 0%, #b08d4b 100%);
    color: #0f172a;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Actions Bar */
.qb-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.qb-actions .qb-btn-secondary {
    flex: 1;
}

.qb-actions .qb-btn-primary {
    flex: 2;
}

/* Toast */
.qb-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #c5a059 0%, #b08d4b 100%);
    color: #0f172a;
    padding: 16px 32px;
    border-radius: 10px;
    font-weight: 700;
    z-index: 10001;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

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

/* Ezra Integration */
.qb-ezra-rates-ready {
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 2px solid #86efac;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.qb-check-icon {
    width: 40px;
    height: 40px;
    background: #22c55e;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
}

.qb-ezra-rates-ready div {
    flex: 1;
}

.qb-ezra-rates-ready strong {
    display: block;
    color: #166534;
    font-size: 15px;
    margin-bottom: 4px;
}

.qb-ezra-rates-ready p {
    margin: 0;
    color: #15803d;
    font-size: 13px;
}

.qb-ezra-instructions {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

.qb-ezra-instructions p {
    margin: 0 0 12px 0;
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
}

.qb-ezra-instructions ol {
    margin: 0;
    padding-left: 20px;
    font-size: 13px;
    color: #475569;
}

.qb-ezra-instructions li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.qb-ezra-instructions ul {
    margin: 8px 0;
    padding-left: 16px;
}

.qb-ezra-instructions ul li {
    margin-bottom: 4px;
    color: #64748b;
}

/* Loading */
.qb-loading {
    text-align: center;
    padding: 40px;
    color: #64748b;
}

.qb-no-leads {
    text-align: center;
    padding: 40px;
    color: #94a3b8;
}
