﻿:root {
    --bg-color: #f4f6f9;
    --card-bg: #ffffff;
    --text-color: #2c3e50;
    --text-muted: #7f8c8d;
    --up-color: #2ecc71;
    --down-color: #e74c3c;
    --unset-color: #e9ecef; /* Lightened fallback background for clearer text contrast */
    --primary-accent: #3498db;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
}

.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 15px;
    margin-bottom: 25px;
}

h1, h2, h3 {
    margin: 0;
}

.meta-info {
    text-align: right;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Dashboard Grid Layout */
.grid-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
}

/* Hide the Systems Network Status card by default on small screens */
.grid-layout > .card:first-child {
    display: none;
}

@media (min-width: 768px) {
    .grid-layout {
        grid-template-columns: 350px 1fr;
    }
    
    /* Bring back the Systems Network Status card on desktop screens */
    .grid-layout > .card:first-child {
        display: block;
    }
}

/* Card Elements */
.card {
    background-color: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    padding: 20px;
    border: 1px solid #e2e8f0;
}

.card h2 {
    font-size: 1.2rem;
    border-bottom: 1px solid #edf2f7;
    padding-bottom: 10px;
    margin-bottom: 15px;
    color: var(--primary-accent);
}

/* Services System list */
.service-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px dashed #edf2f7;
}
.service-item:last-child { border-bottom: none; }

.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}
.indicator.up { background-color: var(--up-color); box-shadow: 0 0 8px var(--up-color); }
.indicator.down { background-color: var(--down-color); box-shadow: 0 0 8px var(--down-color); }

/* Progress Ratio Bars Styles */
.ratio-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-bottom: 6px;
}

/* Shared base bar styles */
.bar-track {
    width: 100%;
    height: 16px; /* Slightly taller for child shop layouts */
    background-color: var(--unset-color);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

/* Specific styling modifier for the Master top bar */
.master-track {
    height: 22px; /* Extra thickness for central header callout display */
    border-radius: 11px;
}

.bar-fill {
    height: 100%;
    background-color: var(--up-color);
    width: 0%;
    transition: width 0.6s cubic-bezier(0.1, 0.8, 0.3, 1);
    
    /* Configured layout engine rules to push dynamic shop strings inside bar fills automatically */
    display: flex;
    align-items: center;
    justify-content: flex-end;
    box-sizing: border-box;
}

/* Centered static text container rules (For Master Total Row Overlay) */
.bar-text-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    color: #1a252f;
    font-weight: bold;
    pointer-events: none; /* Allows cursor selection to fall straight through element background */
}

.total-counter {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 5px;
}

/* Shops Grid Container */
.shops-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.shop-card {
    background-color: #fafbfc;
    border: 1px solid #edf2f7;
    border-radius: 6px;
    padding: 12px;
}
.shop-title {
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 8px;
    color: #34495e;
}

/* Enable Flex layout on the bar track container to lay segments side-by-side */
.split-track {
    display: flex;
    background-color: transparent; /* No longer need a background fallback color */
}

/* Base style rules for every individual color block inside a bar */
.bar-fill-segment {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center; /* Centers text inside its own colored block */
    font-size: 10px;
    font-weight: bold;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden; /* Safeguard clip boundary */
    transition: width 0.6s cubic-bezier(0.1, 0.8, 0.3, 1);
    box-sizing: border-box;
}

/* Master-specific adjustments for larger text readability */
.master-segment-set {
    background-color: var(--up-color);
    font-size: 0.8rem;
}

.master-segment-unset {
    background-color: #7f8c8d; /* Solid prominent grey for Master Unset metric */
    font-size: 0.8rem;
}

/* Default look for the dynamic shops Unset portion */
.segment-unset {
    background-color: #bdc3c7; /* Soft gray for secondary sub-metrics */
    color: #2c3e50; /* Dark text on light grey background for high contrast visibility */
}

/* --- Cleaner Header Layout --- */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.meta-info {
    text-align: right;
    min-width: 180px;
}

.status-active {
    color: var(--up-color, #2ecc71); 
    font-weight: bold;
}

#api-timestamp {
    font-size: 0.85rem; 
    margin-top: 5px; 
    color: var(--text-muted, #888);
}

/* --- Scrollable Sync Table Styles (Stacked Mode) --- */
.sync-table-wrapper {
    margin-top: 15px; 
    max-height: 680px; 
    overflow-y: auto; 
    /* Modernized: Subtle, semi-transparent border with a softer shadow */
    border: 1px solid rgba(255, 255, 255, 0.08); 
    border-radius: 12px; /* Smoother, modern rounded corners */
    
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    scroll-behavior: smooth;
}

.sync-data-table {
    width: 100%; 
    border-collapse: separate; /* Required for modern border-radius on tables */
    border-spacing: 0;
    font-size: 1.1rem; /* Cleaned up typography scaling */
    letter-spacing: -0.01em;
    text-align: left;
	
}

.sync-data-table th {
    font-weight: 600;
    color: var(--text-heading, #333);
    background: rgba(255, 255, 255, 0.03); 
    border: 1px solid rgba(5, 0, 0, 1); 
    padding: 12px 16px; /* Generous padding for breathing room */
    position: sticky;
    top: 0; 
    z-index: 10;
    /* Modern Touch: Frosted glass effect for sticky headers */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.sync-data-table td {
    padding: 14px 16px;
    color: var(--text-body, #333);
    border: 1px solid rgba(5, 0, 0, 1); 
    transition: background-color 0.2s ease; /* Smooth hover transition */
}

/* Modern Hover State for Rows */
.sync-data-table tbody tr:hover td {
    background: rgba(60, 60, 60, 0.82);
    color: #fff;
}

/* Removes the bottom border from the last row to clean up the edges */
.sync-data-table tbody tr:last-child td {
    border-bottom: none;
}

.table-placeholder {
    padding: 30px; /* Enhanced padding for a cleaner layout */
    text-align: center; 
    color: var(--text-muted, #666);
    font-size: 0.9rem;
}

/* --- Layout Column Alignment --- */
.analytics-column {
    display: flex; 
    flex-direction: column; 
    gap: 24px;
}

/* Modern Minimalist Scrollbar Styles */
.sync-table-wrapper::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.sync-table-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.sync-table-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.sync-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}