/* Lazy Data - 共用樣式 */

/* Material Design 3 Color Scheme */
:root {
    color-scheme: light;
    --m3-scheme-background: 253 248 253;
    --m3-scheme-on-background: 52 50 54;
    --m3-scheme-surface: 253 248 253;
    --m3-scheme-surface-container-lowest: 255 255 255;
    --m3-scheme-surface-container-low: 248 242 248;
    --m3-scheme-surface-container: 242 236 242;
    --m3-scheme-surface-container-high: 236 230 236;
    --m3-scheme-surface-container-highest: 230 225 231;
    --m3-scheme-on-surface: 52 50 54;
    --m3-scheme-on-surface-variant: 97 94 99;
    --m3-scheme-outline: 125 121 127;
    --m3-scheme-outline-variant: 181 176 182;
    --m3-scheme-primary: 102 85 145;
    --m3-scheme-on-primary: 253 247 255;
    --m3-scheme-primary-container: 208 188 255;
    --m3-scheme-on-primary-container: 71 54 111;
    --m3-scheme-secondary: 99 91 116;
    --m3-scheme-on-secondary: 253 247 255;
    --m3-scheme-secondary-container: 233 222 252;
    --m3-scheme-on-secondary-container: 85 78 103;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft JhengHei", sans-serif;
    background: rgb(241, 241, 241);
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* Logo Shimmer Effect */
.logo-shimmer {
    position: relative;
    overflow: visible;
}

.logo-shimmer::before {
    content: 'Lazy Data';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent 0%,
            transparent 40%,
            rgb(253, 253, 253) 50%,
            transparent 60%,
            transparent 100%);
    background-size: 210% 100%;
    background-position: 80% 0%;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    opacity: 0;
    animation: textShimmer 18s infinite linear 18s;
    animation-fill-mode: none;
}

@keyframes textShimmer {
    0% {
        opacity: 0;
        background-position: 80% 0%;
    }

    1% {
        opacity: 1;
        background-position: 80% 0%;
    }

    11% {
        opacity: 1;
        background-position: -80% 0%;
    }

    12% {
        opacity: 0;
        background-position: -80% 0%;
    }

    100% {
        opacity: 0;
        background-position: 80% 0%;
    }
}

/* Main Content */
.main-content {
    padding-top: 5rem;
    padding-bottom: 5rem;
}

.main-container {
    max-width: 1280px;
    margin: 0 auto 20px;
    padding: 0 20px;
}

.content-card {
    background: rgb(253, 253, 253);
    border-radius: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* Header */
.header {
    background: rgb(253, 253, 253);
    color: #212529;
    padding: 30px;
    text-align: center;
    border-bottom: 1px solid #dee2e6;
}

.header h1 {
    font-size: 28px;
    margin-bottom: 10px;
    color: #212529;
}

.header p {
    font-size: 14px;
    color: #6c757d;
}

/* Summary Section */
.summary-section {
    max-width: 1280px;
    margin: 0 auto 20px;
    padding: 0 20px;
}

.summary-card-container {
    background: rgb(253, 253, 253);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.summary-grid {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 transparent;
}

.summary-grid::-webkit-scrollbar {
    height: 6px;
}

.summary-grid::-webkit-scrollbar-track {
    background: transparent;
}

.summary-grid::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.summary-card {
    background: transparent;
    padding: 0 20px;
    border-radius: 0;
    border: none;
    min-width: 280px;
    flex-shrink: 0;
    scroll-snap-align: start;
    position: relative;
}

.summary-card::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    height: 68%;
    width: 1px;
    background-color: #e9ecef;
}

.summary-card:last-child::after {
    display: none;
}

.summary-card-title {
    font-size: 13px;
    color: #6c757d;
    margin-bottom: 10px;
    font-weight: 600;
}

.summary-card-value {
    font-size: 32px;
    font-weight: 700;
    color: rgb(var(--m3-scheme-primary));
    margin-bottom: 14px;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

.summary-card-details {
    font-size: 13px;
    color: #495057;
    line-height: 1.7;
}

.summary-card-details div {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
}

.summary-card-details .label {
    color: #6c757d;
}

.summary-card-details .value {
    font-weight: 600;
    color: #495057;
}

/* Table */
.table-container {
    padding: 30px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    min-width: 1040px;
    border-collapse: collapse;
}

thead {
    background: transparent;
    position: sticky;
    top: 0;
    z-index: 10;
}

th {
    padding: 15px 12px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
}

td {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
    font-size: 14px;
    color: #212529;
}

tbody tr {
    transition: background 0.2s;
}

tbody tr:hover {
    background: #f8f9fa;
}

/* Filters */
.filters {
    padding: 30px;
    background: rgb(253, 253, 253);
    border-bottom: 1px solid #dee2e6;
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.filter-actions {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}

.info-text {
    font-size: 14px;
    line-height: 1.5;
    color: #6c757d;
    max-width: 800px;
    flex: 1;
}

.info-text p {
    margin: 3px 0;
}

.button-group {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

/* Material Design 3 Button Styles */
md-filled-button {
    --md-filled-button-container-color: rgb(var(--m3-scheme-primary));
    --md-filled-button-label-text-color: rgb(var(--m3-scheme-on-primary));
    --md-filled-button-container-elevation: 0;
    --md-filled-button-hover-container-elevation: 0;
    --md-filled-button-pressed-container-elevation: 0;
    --md-filled-button-focus-container-elevation: 0;
    padding: 0 24px;
}

md-filled-tonal-button {
    --md-filled-tonal-button-container-color: rgb(var(--m3-scheme-secondary-container));
    --md-filled-tonal-button-label-text-color: rgb(var(--m3-scheme-on-secondary-container));
    --md-filled-tonal-button-container-elevation: 0;
    --md-filled-tonal-button-hover-container-elevation: 0;
    --md-filled-tonal-button-pressed-container-elevation: 0;
    --md-filled-tonal-button-focus-container-elevation: 0;
    padding: 0 24px;
}

/* Stats */
.stats {
    padding: 20px 30px;
    background: rgb(253, 253, 253);
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stats-info {
    font-size: 14px;
    color: #495057;
}

.stats-info strong {
    font-size: 18px;
    color: #212529;
}

/* Loading & Empty State */
.loading,
.no-data {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid rgb(var(--m3-scheme-primary));
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* 早療資料集欄位寬度與對齊 */
th:nth-child(1),
td:nth-child(1) {
    width: 50px;
    text-align: center;
}

th:nth-child(2),
td:nth-child(2) {
    width: 70px;
    text-align: center;
}

th:nth-child(3),
td:nth-child(3) {
    width: 85px;
    text-align: center;
}

th:nth-child(4),
td:nth-child(4) {
    width: 100px;
    text-align: center;
}

th:nth-child(5),
td:nth-child(5) {
    width: 100px;
    text-align: center;
}

th:nth-child(6),
td:nth-child(6) {
    width: 285px;
    max-width: 285px;
    white-space: pre-line;
    word-wrap: break-word;
    line-height: 1.8;
}

th:nth-child(7),
td:nth-child(7) {
    width: 350px;
    max-width: 350px;
    white-space: pre-line;
    word-wrap: break-word;
    line-height: 1.8;
}

/* Badge Styles */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-social {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-health {
    background: #d4edda;
    color: #155724;
}

.badge-education {
    background: #fff3cd;
    color: #856404;
}

.badge-service {
    background: #e7e7e7;
    color: #383838;
    font-size: 11px;
    margin: 2px;
}

/* Responsive */
@media (max-width: 820px) {

    .summary-section,
    .main-container {
        padding: 0 15px;
    }

    .summary-card-container,
    .content-card {
        border-radius: 16px;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 22px;
    }

    .filter-row {
        grid-template-columns: 1fr;
    }

    .summary-card-container {
        padding: 20px;
    }

    .summary-card-value {
        font-size: 28px;
    }

    .table-container {
        padding: 15px;
    }

    .filter-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .info-text {
        max-width: 100%;
        margin-top: 15px;
    }

    .button-group {
        width: 100%;
        justify-content: flex-end;
    }

    .stats {
        flex-direction: column;
        gap: 10px;
    }

    .stats-info {
        text-align: center;
    }
}