/* ==========================================================================
   data-overview.css
   Styles specific to moni1000/data-overview.html
   ========================================================================== */

/* --------------------------------------------------------------------------
   P1: Main width - match moni1000.css (900px)
   -------------------------------------------------------------------------- */
main {
    max-width: 900px;
}

/* --------------------------------------------------------------------------
   P2: Hero Section - match moni1000.css values
   -------------------------------------------------------------------------- */
.hero-section {
    background: linear-gradient(135deg, rgba(26, 54, 93, 0.75), rgba(43, 108, 176, 0.6)), 
                url("../images/bg-data-overview.webp");
    background-size: cover;
    background-position: center 30%;
    padding: 2.5rem 2rem;
    border-radius: 12px;
    margin-bottom: 2.5rem;
}

.hero-main {
    text-align: center;
    margin-bottom: 2rem;
}

.hero-tagline {
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.hero-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    max-width: 900px;
    margin: 0 auto;
}

.hero-stat-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1.25rem 1rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.hero-stat-card .number {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 2rem;
    font-weight: 600;
    color: white;
    line-height: 1.2;
}

.hero-stat-card .label {
    display: block;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 0.25rem;
}

@media (max-width: 768px) {
    .hero-section {
        background: linear-gradient(135deg, rgba(26, 54, 93, 0.8), rgba(43, 108, 176, 0.7)), 
                    url("../images/bg-data-overview-mobile.webp");
        background-size: cover;
        background-position: center;
        padding: 2rem 1rem;
    }
    
    .hero-tagline {
        font-size: 1.2rem;
    }
    
    .hero-stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .hero-stat-card .number {
        font-size: 1.2rem;
    }
    
    .hero-stat-card .label {
        font-size: 0.7rem;
    }
}

/* --------------------------------------------------------------------------
   Summary Box (section intro)
   -------------------------------------------------------------------------- */
.summary-box {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-left: 4px solid var(--primary, #1a365d);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0 2rem;
    font-size: 0.95rem;
    color: var(--text-secondary, #4a5568);
    border-radius: 0 8px 8px 0;
}

/* --------------------------------------------------------------------------
   Data Tree Text (pre-formatted)
   -------------------------------------------------------------------------- */
.data-tree-text {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1.5rem 2rem;
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.8;
    overflow-x: auto;
    white-space: pre;
    margin: 1.5rem 0;
}

@media (max-width: 768px) {
    .data-tree-text {
        font-size: 0.75rem;
        padding: 1rem;
    }
}

/* --------------------------------------------------------------------------
   Data Tables
   -------------------------------------------------------------------------- */
.table-responsive {
    overflow-x: auto;
    margin: 1.5rem 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

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

.data-table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-primary, #1a202c);
    white-space: nowrap;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.data-table code {
    background: #e2e8f0;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.data-table .total-row {
    background: #f1f5f9;
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   Tech Notes
   -------------------------------------------------------------------------- */
.tech-notes {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.tech-notes li {
    padding: 0.5rem 0 0.5rem 1.5rem;
    position: relative;
    color: var(--text-secondary, #4a5568);
    font-size: 0.9rem;
}

.tech-notes li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--primary, #1a365d);
}

.tech-notes code {
    background: #e2e8f0;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* --------------------------------------------------------------------------
   Map Container
   -------------------------------------------------------------------------- */
.map-container {
    height: 450px;
    border-radius: 12px;
    margin: 1.5rem 0;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    background: #f1f5f9;
}

.map-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary, #64748b);
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    .map-container {
        height: 350px;
    }
}

/* --------------------------------------------------------------------------
   Figure Caption
   -------------------------------------------------------------------------- */
.figure-caption {
    font-size: 0.85rem;
    color: var(--text-secondary, #64748b);
    text-align: center;
    margin-top: 0.75rem;
    font-style: italic;
}

/* --------------------------------------------------------------------------
   Data Structure Visual (SVG container)
   -------------------------------------------------------------------------- */
.data-tree-visual {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 2rem;
    border-radius: 12px;
    margin: 1.5rem 0;
    text-align: center;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.data-tree-visual svg {
    max-width: 100%;
    height: auto;
}

/* --------------------------------------------------------------------------
   Coverage Heatmap
   -------------------------------------------------------------------------- */
.coverage-heatmap-container {
    background: #f8fafc;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    min-height: 200px;
}

.placeholder-text {
    text-align: center;
    color: var(--text-secondary, #64748b);
    font-size: 0.9rem;
}

.coverage-legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary, #64748b);
}

.legend-box {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.legend-box.has-data {
    background: #2563eb;
}

.legend-box.no-data {
    background: #e2e8f0;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-dot.logger {
    background: #f59e0b;
}

/* --------------------------------------------------------------------------
   Note Box
   -------------------------------------------------------------------------- */
.note-box {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
}

.note-box h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #92400e;
    margin: 0 0 0.5rem 0;
}

.note-box ul {
    margin: 0;
    padding-left: 1.25rem;
}

.note-box li {
    font-size: 0.85rem;
    color: #78350f;
    margin-bottom: 0.25rem;
}

/* --------------------------------------------------------------------------
   Limitations List
   -------------------------------------------------------------------------- */
.limitations-list {
    padding-left: 1.5rem;
    margin: 1rem 0;
}

.limitations-list li {
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary, #4a5568);
}

.limitations-list strong {
    color: var(--text-primary, #1a202c);
}

/* --------------------------------------------------------------------------
   Analysis Flow
   -------------------------------------------------------------------------- */
.analysis-flow {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 2rem 0;
}

.flow-step {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    width: 100%;
    max-width: 500px;
    transition: all 0.2s ease;
}

.flow-step:hover {
    border-color: var(--primary, #1a365d);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.flow-step.completed {
    background: linear-gradient(135deg, #1a365d 0%, #2b6cb0 100%);
    border-color: transparent;
}

.flow-step.completed .step-number,
.flow-step.completed .step-text {
    color: white;
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--primary, #1a365d);
    color: white;
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.flow-step.completed .step-number {
    background: rgba(255,255,255,0.2);
}

.step-text {
    font-size: 0.95rem;
    color: var(--text-primary, #1a202c);
}

.flow-arrow {
    font-size: 1.2rem;
    color: #94a3b8;
    padding: 0.25rem 0;
}

@media (max-width: 768px) {
    .flow-step {
        padding: 0.75rem 1rem;
    }
    
    .step-text {
        font-size: 0.85rem;
    }
}

/* --------------------------------------------------------------------------
   Related Links
   -------------------------------------------------------------------------- */
.related-links {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-top: 2rem;
}

.related-links h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary, #1a202c);
    margin: 0 0 0.75rem 0;
}

.related-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.related-links li {
    margin-bottom: 0.5rem;
}

.related-links a {
    color: var(--primary, #1a365d);
    text-decoration: none;
    font-size: 0.9rem;
}

.related-links a:hover {
    text-decoration: underline;
}

.related-links .coming-soon {
    color: var(--text-secondary, #64748b);
    font-size: 0.9rem;
}

/* --------------------------------------------------------------------------
   Acknowledgment Box
   -------------------------------------------------------------------------- */
.acknowledgment-box {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
}

.acknowledgment-box h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #166534;
    margin: 0 0 0.5rem 0;
}

.acknowledgment-box p {
    font-size: 0.9rem;
    color: #15803d;
    margin: 0;
    line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Terms & Resource Lists
   -------------------------------------------------------------------------- */
.terms-list,
.resource-links {
    padding-left: 1.5rem;
    margin: 1rem 0;
}

.terms-list li,
.resource-links li {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary, #4a5568);
}

.resource-links a {
    color: var(--primary, #1a365d);
    text-decoration: none;
}

.resource-links a:hover {
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Page Navigation (footer)
   -------------------------------------------------------------------------- */
.page-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid #e2e8f0;
    gap: 1rem;
}

.page-nav a {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-radius: 8px;
    transition: all 0.2s ease;
    flex: 1;
    max-width: 45%;
}

.page-nav a:hover {
    background: #f1f5f9;
    transform: translateY(-2px);
}

.nav-prev {
    align-items: flex-start;
}

.nav-next {
    align-items: flex-end;
    text-align: right;
}

.nav-label {
    font-size: 0.75rem;
    color: var(--text-secondary, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.nav-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary, #1a365d);
}

@media (max-width: 768px) {
    .page-nav {
        flex-direction: column;
    }
    
    .page-nav a {
        max-width: 100%;
    }
    
    .nav-next {
        align-items: flex-start;
        text-align: left;
    }
}

/* --------------------------------------------------------------------------
   Content Section Spacing
   -------------------------------------------------------------------------- */

.content-section h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary, #1a202c);
    margin: 0 0 1rem 0;
}

.content-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary, #1a202c);
    margin: 2rem 0 1rem 0;
}

@media (max-width: 768px) {
    .content-section h2 {
        font-size: 1.1rem;
    }
    
    .content-section h3 {
        font-size: 1rem;
    }
}

/* --------------------------------------------------------------------------
   Map Legend (Leaflet custom)
   -------------------------------------------------------------------------- */
.map-legend {
    font-family: var(--font-sans, 'DM Sans', sans-serif);
}

.map-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #dc2626;
    font-size: 0.9rem;
}

/* --------------------------------------------------------------------------
   Data Structure Tree (SVG)
   -------------------------------------------------------------------------- */
.data-tree-visual {
    background: #f8fafc;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    text-align: center;
}

.tree-img {
    max-width: 100%;
    height: auto;
}

/* Language toggle for images */
img[data-lang="ja"] {
    display: none;
}
img[data-lang="en"] {
    display: inline-block;
}
body.ja img[data-lang="en"] {
    display: none;
}
body.ja img[data-lang="ja"] {
    display: inline-block;
}

.figure-caption {
    font-size: 0.9rem;
    color: var(--text-secondary, #4a5568);
    text-align: center;
    margin-top: 1rem;
    font-style: italic;
}

@media (max-width: 768px) {
    .data-tree-visual {
        padding: 0.75rem;
        overflow-x: auto;
    }
    
    .tree-img {
        min-width: 600px;
    }
}

/* --------------------------------------------------------------------------
   Temporal Coverage Heatmap (CSS Grid)
   -------------------------------------------------------------------------- */
.coverage-heatmap-wrapper {
    background: #f8fafc;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    overflow-x: auto;
}

.coverage-heatmap {
    display: grid;
    grid-template-columns: minmax(120px, 140px) repeat(5, minmax(50px, 70px));
    gap: 3px;
    font-size: 0.85rem;
    min-width: 450px;
}

.heatmap-header {
    background: #1e293b;
    color: white;
    padding: 10px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
}

.heatmap-header.heatmap-site-header {
    text-align: left;
    padding-left: 12px;
}

.heatmap-site {
    background: #f1f5f9;
    padding: 8px 12px;
    font-weight: 500;
    font-size: 0.8rem;
    color: var(--text-primary, #1a202c);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.heatmap-site.has-logger {
    background: linear-gradient(90deg, #fef3c7 0%, #f1f5f9 30%);
    border-left: 3px solid #f59e0b;
}

.heatmap-site .site-no {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: #64748b;
}

.heatmap-cell {
    padding: 8px;
    text-align: center;
    border-radius: 4px;
    font-weight: 500;
    transition: transform 0.1s ease;
}

.heatmap-cell:hover {
    transform: scale(1.05);
}

.heatmap-cell.has-data {
    background: #2563eb;
    color: white;
}

.heatmap-cell.no-data {
    background: #e2e8f0;
    color: #94a3b8;
}

.coverage-summary {
    margin-top: 1.5rem;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.coverage-summary p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary, #4a5568);
    line-height: 1.6;
}

@media (max-width: 768px) {
    .coverage-heatmap-wrapper {
        padding: 1rem;
    }
    
    .coverage-heatmap {
        font-size: 0.75rem;
        grid-template-columns: minmax(100px, 120px) repeat(5, minmax(40px, 55px));
    }
    
    .heatmap-header {
        padding: 8px 4px;
        font-size: 0.7rem;
    }
    
    .heatmap-site {
        padding: 6px 8px;
        font-size: 0.7rem;
    }
    
    .heatmap-cell {
        padding: 6px 4px;
        font-size: 0.75rem;
    }
    
    .coverage-legend {
        gap: 1rem;
    }
    
    .legend-item {
        font-size: 0.75rem;
    }
}


/* --------------------------------------------------------------------------
   Fix: Map z-index lower than header
   -------------------------------------------------------------------------- */
.map-container {
    position: relative;
    z-index: 0 !important;
    isolation: isolate;
}

#site-map {
    z-index: 0 !important;
}

.map-container .leaflet-pane,
.map-container .leaflet-top,
.map-container .leaflet-bottom {
    z-index: auto !important;
}
