/* ========================================
   Shipping Heat Map — Tool Styles
   ======================================== */

/* ---- Header ---- */
.tool-header-section {
    padding: 80px 0 8px;
}

.tool-header-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
}

.tool-header-left {
    flex-shrink: 0;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 6px;
    transition: color var(--transition);
}

.back-link:hover {
    color: var(--text-primary);
}

.back-link svg {
    width: 14px;
    height: 14px;
}

.tool-header-left h1 {
    font-family: 'Spectral', serif;
    font-size: 1.6rem;
    font-weight: 500;
    line-height: 1.15;
}

.tool-header-right {
    text-align: right;
}

.tool-description {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ---- Layout ---- */
.heatmap-section {
    padding: 8px 0 32px;
}

.heatmap-layout {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

/* ---- Input Panel ---- */
.input-panel {
    width: 260px;
    flex-shrink: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.input-panel-header h3 {
    font-size: 0.85rem;
    font-weight: 600;
}

.zip-count {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

.zip-input {
    width: 100%;
    height: 280px;
    padding: 10px 12px;
    border: 1px solid var(--border-subtle);
    background: var(--input-bg);
    color: var(--text-primary);
    font-family: 'Inter', monospace;
    font-size: 0.78rem;
    line-height: 1.6;
    border-radius: 8px;
    resize: vertical;
    outline: none;
}

.zip-input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.zip-input:focus {
    border-color: var(--form-focus);
}

.input-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.input-actions .btn-clear {
    padding: 6px 12px;
    border: none;
    background: none;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
}

.input-actions .btn-clear:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.max-warning {
    background: rgba(220, 60, 60, 0.08);
    border: 1px solid rgba(220, 60, 60, 0.2);
    border-radius: 6px;
    padding: 8px 10px;
}

.max-warning p {
    font-size: 0.7rem;
    color: #c0392b;
    line-height: 1.5;
    margin: 0;
}

[data-theme="dark"] .max-warning {
    background: rgba(220, 80, 80, 0.1);
    border-color: rgba(220, 80, 80, 0.25);
}

[data-theme="dark"] .max-warning p {
    color: #e87070;
}

.max-warning a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.max-warning a:hover {
    text-decoration: underline;
}

.sample-data {
    text-align: center;
}

.sample-link {
    border: none;
    background: none;
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    color: var(--accent);
    cursor: pointer;
    text-decoration: underline;
    opacity: 0.8;
}

.sample-link:hover {
    opacity: 1;
}

/* ---- Map Panel ---- */
.map-panel {
    flex: 1;
}

.map-container {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    overflow: visible;
    padding: 0 6px;
}

.map-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 80px 20px;
    color: var(--text-muted);
    text-align: center;
}

.map-placeholder p {
    font-size: 0.85rem;
    max-width: 300px;
    line-height: 1.5;
}

.heat-map {
    width: 100%;
    height: auto;
    display: block;
}

.heat-map .state-region {
    stroke: rgba(0, 0, 0, 0.15);
    stroke-width: 0.5;
    fill: var(--bg-section);
    transition: fill 0.15s ease;
}

[data-theme="dark"] .heat-map .state-region {
    stroke: rgba(255, 255, 255, 0.1);
}

.heat-map .state-region.has-data:hover {
    stroke: var(--text-primary);
    stroke-width: 1.5;
    filter: brightness(0.9);
    cursor: pointer;
}

.heat-map .state-region.hottest {
    filter: drop-shadow(0 0 4px rgba(8, 48, 107, 0.6));
}

[data-theme="dark"] .heat-map .state-region.hottest {
    filter: drop-shadow(0 0 4px rgba(158, 202, 225, 0.5));
}

.heat-map .state-line {
    fill: none;
    stroke: rgba(0, 0, 0, 0.2);
    stroke-width: 0.8;
    pointer-events: none;
}

[data-theme="dark"] .heat-map .state-line {
    stroke: rgba(255, 255, 255, 0.12);
}

/* ---- Heat Legend ---- */
.heat-legend {
    position: absolute;
    bottom: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.legend-gradient {
    width: 120px;
    height: 10px;
    border-radius: 5px;
    background: linear-gradient(to right, #e8eef4, #6baed6, #2171b5, #08306b);
}

[data-theme="dark"] .legend-gradient {
    background: linear-gradient(to right, #1a2535, #2171b5, #4292c6, #9ecae1);
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.6rem;
    color: var(--text-muted);
}

/* ---- Stats Panel ---- */
.stats-panel {
    margin-top: 12px;
}

.stat-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    font-family: 'Spectral', serif;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 2px;
}

.top-regions {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 14px;
}

.top-regions h4 {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.region-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.region-label {
    font-size: 0.78rem;
    font-weight: 500;
    width: 45px;
    flex-shrink: 0;
}

.region-bar-fill {
    flex: 1;
    height: 18px;
    border-radius: 4px;
    background: var(--accent);
    opacity: 0.7;
    position: relative;
}

.region-bar-value {
    font-size: 0.68rem;
    color: var(--text-muted);
    width: 50px;
    text-align: right;
    flex-shrink: 0;
}

/* ---- Tooltip ---- */
.heat-tooltip {
    position: absolute;
    padding: 8px 12px;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.15s;
    font-size: 0.78rem;
    white-space: nowrap;
}

.heat-tooltip.visible {
    opacity: 1;
}

.heat-tooltip strong {
    font-weight: 600;
}

/* ---- CTA ---- */
.tool-cta {
    padding: 48px 0 64px;
    text-align: center;
}

.tool-cta h2 {
    font-family: 'Spectral', serif;
    font-size: 1.75rem;
    font-weight: 500;
    margin-bottom: 12px;
}

.tool-cta p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* ---- CTA Popup ---- */
.cta-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    backdrop-filter: blur(2px);
    display: none;
    pointer-events: none;
}

.cta-popup-overlay.visible {
    display: block;
    pointer-events: auto;
}

.cta-popup {
    position: fixed;
    display: none;
    pointer-events: none;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    padding: 40px 44px;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    width: 90%;
    z-index: 100;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.cta-popup.visible {
    display: block;
    pointer-events: auto;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.cta-popup-close {
    position: absolute;
    top: 12px;
    right: 16px;
    border: none;
    background: none;
    font-size: 1.4rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.cta-popup-close:hover {
    color: var(--text-primary);
}

[data-theme="dark"] .cta-popup {
    background: #1e2840;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.cta-popup h3 {
    font-family: 'Spectral', serif;
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 10px;
    line-height: 1.3;
}

.cta-popup p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 18px;
}

.cta-popup .btn {
    margin-bottom: 10px;
}

.cta-popup-note {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .tool-header-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .tool-header-right {
        text-align: left;
    }

    .heatmap-layout {
        flex-direction: column;
    }

    .input-panel {
        width: 100%;
    }

    .zip-input {
        height: 150px;
    }

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