/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: #1e293b;
    background-color: #ffffff;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header Styles */
.header {
    margin-bottom: 3rem;
}

.header-banner {
    margin-bottom: 1rem;
}

.banner-text {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
    font-weight: 500;
}

.title-section {
    margin-bottom: 2rem;
}

.main-title {
    font-family: 'Courier New', Courier, monospace;
    font-size: 5.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 1.25rem;
    color: #475569;
    margin-bottom: 0.5rem;
    font-weight: 400;
}

.date {
    font-size: 1rem;
    color: #64748b;
}

/* Tab Navigation */
.tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 2rem;
    padding-bottom: 0;
}

.tab-button {
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    color: #64748b;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.tab-button:hover {
    color: #334155;
    background-color: #f8fafc;
}

.tab-button.active {
    color: #334155;
    border-bottom-color: #334155;
    font-weight: 600;
}

/* Tab Content */
.tab-content {
    min-height: 500px;
}

.tab-panel {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.tab-panel.active {
    display: block;
}

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

/* Content Sections */
.content-section {
    margin-bottom: 3rem;
}

.content-section h2 {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 1rem;
    margin-top: 0;
}

.content-section h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 1rem;
    margin-top: 2rem;
}

.content-section p {
    margin-bottom: 1rem;
    color: #475569;
    line-height: 1.8;
}

.content-section ul {
    margin-left: 1.5rem;
    margin-bottom: 1.5rem;
    color: #475569;
}

.content-section li {
    margin-bottom: 0.5rem;
    line-height: 1.8;
}

.storefront-comparison {
    display: flex;
    gap: 2rem;
    margin: 2rem 0;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
}

.storefront-comparison.annotated {
    overflow: visible; /* Allow labels to extend outside container */
    padding: 0 10%; /* Add padding to accommodate side labels */
}

.storefront-image {
    flex: 1;
    min-width: 300px;
    max-width: 500px;
}

.storefront-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: block;
}

.storefront-image-annotated {
    flex: 1;
    min-width: 300px;
    max-width: 500px;
}

.storefront-image-annotated .image-wrapper {
    position: relative;
    width: 100%;
    overflow: visible; /* Allow labels to extend outside image bounds */
}

.storefront-image-annotated img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: block;
}

.image-text-column {
    margin-top: 1.5rem;
    flex: 1;
    min-width: 300px;
    max-width: 500px;
    text-align: center;
}

.image-text-column .large-text {
    font-size: 1.5rem;
    line-height: 1.6;
    font-weight: 400;
    margin: 0 0 1rem 0;
}

.old-school-quotes .large-text {
    color: #8B6F47;
}

.new-school-quotes .large-text {
    color: #E91E63;
}

.annotations {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.annotation {
    position: absolute;
    pointer-events: auto;
    z-index: 10;
}

.annotation-left {
    /* Labels on the left side */
}

.annotation-right {
    /* Labels on the right side */
}

.annotation-label {
    background-color: white;
    color: black;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: inline-block;
    border: 1px solid #e2e8f0;
}

.annotation-arrow {
    position: absolute;
    stroke: #1e293b;
    stroke-width: 2;
    fill: none;
    z-index: 5;
}

.objectives-list {
    list-style: none;
    margin-left: 0;
}

.objectives-list li {
    position: relative;
    padding-left: 1.5rem;
}

.objectives-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #334155;
    font-weight: bold;
    font-size: 1.2rem;
}

/* Figure Captions */
.figure-caption {
    font-size: 0.875rem;
    color: #64748b;
    font-style: italic;
    margin-bottom: 0.5rem;
}

/* Chart Container */
.chart-container {
    background-color: #f8fafc;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
    border: 1px solid #e2e8f0;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.metric-card {
    background-color: #f8fafc;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.metric-label {
    font-size: 0.875rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.metric-change {
    font-size: 0.875rem;
    color: #64748b;
}

/* Map Styles */
.map-container {
    margin: 2rem 0;
}

.map-stats {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-size: 0.875rem;
    color: #475569;
}

.map-stats p {
    margin-bottom: 0.25rem;
}

.map-visualization {
    width: 100%;
    height: 600px;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

/* Leaflet map container */
#map-visualization.leaflet-container {
    border-radius: 8px;
    z-index: 1;
}

.map-legend {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
    padding: 1rem;
    background-color: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

.legend-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.legend-section-title {
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #475569;
    font-size: 0.875rem;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-block;
}

.legend-color.old-school {
    background-color: #8B6F47;
}

.legend-color.new-school {
    background-color: #E91E63;
}

.legend-marker {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.legend-marker.old-school {
    background-color: #8B6F47;
}

.legend-marker.new-school {
    background-color: #E91E63;
}

.legend-marker.closed.old-school {
    border: 2px solid #8B6F47; /* Same as background (no visible border) */
}

.legend-marker.closed.new-school {
    border: 2px solid #E91E63; /* Same as background (no visible border) */
}

.legend-marker.new.old-school {
    border: 2px solid #5A4A2F; /* Darker brown border */
}

.legend-marker.new.new-school {
    border: 2px solid #B71C1C; /* Darker pink border */
}

.legend-marker.operating.old-school {
    border: 2px solid white; /* White border for operating */
}

.legend-marker.operating.new-school {
    border: 2px solid white; /* White border for operating */
}

/* Leaflet popup styles */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    font-family: inherit;
}

.leaflet-popup-content {
    margin: 1rem;
    min-width: 200px;
}

.popup-content h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.125rem;
    line-height: 1.0;
}

.popup-content p {
    margin-bottom: 0.125rem;
    font-size: 0.875rem;
    color: #475569;
    line-height: 1.0;
}

.popup-content .address {
    font-weight: 500;
    color: #334155;
}

.popup-image-container {
    margin: 0.5rem 0;
    text-align: center;
}

.popup-thumbnail {
    max-width: 200px;
    max-height: 150px;
    width: auto;
    height: auto;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    object-fit: cover;
}

.popup-businesses-horizontal {
    display: flex;
    flex-direction: row;
    gap: 0;
    margin-top: 0.75rem;
    overflow-x: auto;
}

.popup-business-item {
    flex: 0 0 auto;
    min-width: 200px;
    max-width: 250px;
}

.popup-business-item .popup-image-container {
    margin: 0.5rem 0;
}

.popup-business-item .popup-thumbnail {
    max-width: 180px;
    max-height: 120px;
}

.legend-color.dark-slate {
    background-color: #334155;
}

.legend-color.light-slate {
    background-color: #94a3b8;
}

.map-description {
    margin-top: 1.5rem;
    color: #475569;
}

/* Timeline Styles */
.timeline-container {
    margin: 2rem 0;
}

.timeline-visualization {
    width: 100%;
    max-height: 800px;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 2rem;
    position: relative;
}

.timeline-plot-wrapper {
    position: relative;
    overflow-y: auto;
    overflow-x: auto;
    max-height: 800px;
}

/* Make Observable Plot x-axis sticky */
.timeline-visualization svg g[aria-label*="x-axis"],
.timeline-visualization svg g[transform*="translate(0"] {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: #f8fafc;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Tooltip for timeline dots */
.timeline-dot-tooltip {
    position: absolute;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 1000;
    max-width: 300px;
    pointer-events: none;
    font-size: 14px;
    line-height: 1.5;
}

.timeline-dot-tooltip img {
    max-width: 250px;
    max-height: 150px;
    margin-top: 8px;
    border-radius: 4px;
    display: block;
}

.timeline-year-labels {
    position: sticky;
    top: 0;
    background-color: #f8fafc;
    z-index: 10;
    padding: 1rem 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Case Study Section */
.case-study-section {
    margin-bottom: 2.5rem;
}

/* Footer */
.footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.footer p {
    color: #64748b;
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .main-title {
        font-size: 3.5rem;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .tab-button {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .map-visualization {
        height: 400px;
    }
}

/* Map Pin Styles */
.map-pin {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease, width 0.2s ease, height 0.2s ease;
}

.map-pin:hover {
    transform: scale(1.5);
    z-index: 10;
}

.map-pin.traditional {
    background-color: #334155;
}

.map-pin.modern {
    background-color: #94a3b8;
}

/* Timeline Item Styles */
.timeline-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.timeline-item:hover {
    background-color: #f1f5f9;
}

.timeline-store-name {
    min-width: 150px;
    font-size: 0.875rem;
    color: #475569;
    margin-right: 1rem;
}

.timeline-line-container {
    flex: 1;
    position: relative;
    height: 40px;
    margin-right: 1rem;
}

.timeline-line {
    position: absolute;
    height: 2px;
    top: 50%;
    transform: translateY(-50%);
}

.timeline-line.old-school {
    background-color: #8B6F47;
}

.timeline-line.new-school {
    background-color: #E91E63;
}

.timeline-dot {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid white;
}

.timeline-dot.start {
    left: 0;
}

.timeline-dot.end {
    right: 0;
}

.timeline-dot.open {
    background-color: #10b981;
}

.timeline-dot.closed {
    background-color: #ef4444;
}

/* Override dot colors based on typography class when set inline */
.timeline-dot[style*="background-color"] {
    border-color: white;
}


/* Regression Analysis Styles */
.regression-loading {
    padding: 2rem;
    text-align: center;
    color: #64748b;
}

.regression-content {
    margin-top: 2rem;
}

.regression-content h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #1e293b;
}

.regression-content h4 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 1rem;
    color: #334155;
}

.regression-table-container {
    overflow-x: auto;
    margin: 1.5rem 0;
}

.regression-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.regression-table th,
.regression-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.regression-table th {
    background-color: #f8fafc;
    font-weight: 600;
    color: #1e293b;
}

.regression-table tbody tr:last-child td {
    border-bottom: none;
    font-weight: 600;
    background-color: #f8fafc;
}

.regression-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-card {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-left: 4px solid #3b82f6;
}

.stat-card h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.875rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0.5rem 0;
}

.stat-explanation {
    font-size: 0.875rem;
    color: #475569;
    margin: 0.5rem 0 0 0;
    line-height: 1.5;
}

.regression-error {
    padding: 2rem;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #991b1b;
}

.visualization-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.viz-container {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
}

.viz-container h4 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    color: #334155;
    font-weight: 600;
}

.viz-container canvas {
    max-height: 300px;
}

#flowDiagram {
    width: 100%;
    min-height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#flowDiagram svg {
    max-width: 100%;
    height: auto;
}

/* Comparison Visualization Styles */
.comparison-visualization {
    margin: 2rem 0;
}

.comparison-loading,
.comparison-error {
    padding: 2rem;
    text-align: center;
    color: #64748b;
}

.comparison-container {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.comparison-column {
    flex: 1;
    min-width: 0;
}

.comparison-column h3 {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
}

.comparison-images {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.confidence-level-header {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 2px solid #e2e8f0;
}

.confidence-level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.comparison-image-item {
    position: relative;
    width: 100%;
    padding: 0.25rem;
    border-radius: 4px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
}

/* Progressive sizing: every 100 items get smaller */
.comparison-image-item.size-normal {
    min-height: 80px;
}

.comparison-image-item.size-small {
    min-height: 60px;
    padding: 0.2rem;
}

.comparison-image-item.size-smaller {
    min-height: 45px;
    padding: 0.15rem;
}

.comparison-image-item.size-smallest {
    min-height: 35px;
    padding: 0.1rem;
}

/* Adjust grid for smaller sizes */
.confidence-level-grid:has(.size-small) {
    grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
    gap: 0.4rem;
}

.confidence-level-grid:has(.size-smaller) {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 0.3rem;
}

.confidence-level-grid:has(.size-smallest) {
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 0.25rem;
}

.comparison-image-item.empty {
    min-height: 120px;
    background: transparent;
}

.comparison-image-item img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    object-fit: contain;
}

.comparison-image-item .image-error {
    color: #64748b;
    font-size: 0.875rem;
    text-align: center;
    padding: 1rem;
}

/* Tooltip Styles */
.comparison-image-item {
    cursor: pointer;
}

.comparison-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 0.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;
    z-index: 100;
}

.comparison-image-item:hover .comparison-tooltip {
    opacity: 1;
}

.tooltip-content {
    background-color: rgba(30, 41, 59, 0.95);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    white-space: normal;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    min-width: 200px;
    max-width: 320px;
}

.tooltip-image {
    margin-bottom: 0.75rem;
    text-align: center;
}

.tooltip-image img {
    max-width: 300px;
    max-height: 300px;
    width: auto;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: block;
    margin: 0 auto;
}

.tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(30, 41, 59, 0.95);
}

.tooltip-row {
    margin: 0.25rem 0;
    line-height: 1.4;
}

.tooltip-row:first-child {
    margin-top: 0;
}

.tooltip-row:last-child {
    margin-bottom: 0;
}

.tooltip-row strong {
    display: inline-block;
    min-width: 70px;
    margin-right: 0.5rem;
}

