:root[data-theme='dark'] {
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-row: rgba(30, 41, 59, 0.4);
    --bg-header: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.2);
    --border: rgba(255, 255, 255, 0.05);
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

:root[data-theme='light'] {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-row: rgba(241, 245, 249, 0.5);
    --bg-header: #f1f5f9;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --accent: #2563eb;
    --accent-glow: rgba(37, 99, 235, 0.1);
    --border: rgba(0, 0, 0, 0.05);
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}

body { background: var(--bg-main); color: var(--text-main); font-family: 'Pretendard', sans-serif; margin: 0; min-height: 100vh; transition: 0.3s; }
.container { max-width: 1000px; margin: 0 auto; padding: 3rem 1.5rem; transition: padding 0.3s; }

.clay-card { 
    background: var(--bg-card); 
    border-radius: 1.25rem; 
    padding: 1.5rem; 
    box-shadow: var(--shadow); 
    border: 1px solid var(--border);
}

.search-box { 
    width: 100%; padding: 1rem 1.5rem; border-radius: 1rem; 
    background: var(--bg-main); border: 2px solid var(--accent); 
    color: var(--text-main); font-size: 1.1rem; font-weight: 600; 
    box-shadow: 0 0 15px var(--accent-glow); transition: 0.3s;
    box-sizing: border-box;
}

.btn-group { display: flex; gap: 1rem; justify-content: center; margin-top: 1.5rem; flex-wrap: wrap; }
.btn-blue, .btn-dark { 
    padding: 0.75rem 1.5rem; border-radius: 0.8rem; font-weight: 800; cursor: pointer; 
    display: flex; align-items: center; gap: 0.5rem; transition: 0.2s; border: none; font-size: 1rem;
    white-space: nowrap;
}
.btn-blue { background: var(--accent); color: white; box-shadow: 0 5px 15px var(--accent-glow); }
.btn-dark { background: var(--bg-header); color: var(--text-main); border: 1px solid var(--border); }
.btn-icon { padding: 0.75rem; justify-content: center; min-width: 44px; min-height: 44px; }
.lang-icon-ko { font-size: 1rem; font-weight: 900; line-height: 1; letter-spacing: -0.02em; }

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 2rem;
    flex-wrap: nowrap;
}
.results-header h2 {
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    font-size: clamp(1rem, 4vw, 1.5rem);
    font-weight: 800;
}
.result-count { color: #60a5fa; }
.results-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}
.results-limit {
    height: 44px;
    width: auto;
    padding: 0 1rem;
    border-radius: 0.8rem;
    outline: none;
    background: var(--bg-card);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: 0.3s;
    flex-shrink: 0;
}
.results-limit:hover { transform: translateY(-2px); }
.btn-blue:hover, .btn-dark:hover { transform: translateY(-2px); filter: brightness(1.1); }
.btn-blue:disabled, .btn-dark:disabled, .badge:disabled, .results-limit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    filter: none;
}

.mobile-sort-bar { display: none; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.sort-chip.active { background: var(--accent); color: white; border-color: var(--accent); }

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.85rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 700;
    font-size: 0.9rem;
    z-index: 10001;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    max-width: calc(100vw - 2rem);
    text-align: center;
}
.toast-info { background: var(--bg-card); color: var(--text-main); border: 1px solid var(--border); }
.toast-success { background: #166534; color: #f0fdf4; border: 1px solid #22c55e; }
.toast-warning { background: #92400e; color: #fffbeb; border: 1px solid #f59e0b; }
.toast-error { background: #991b1b; color: #fef2f2; border: 1px solid #ef4444; }

th.sortable {
    cursor: pointer;
    user-select: none;
    transition: 0.2s;
}
th.sortable:hover { color: var(--accent); }
th.sortable .sortable-label { display: inline-flex; align-items: center; gap: 0.35rem; }
th.sortable .sort-icon { flex-shrink: 0; color: var(--accent); }

table { width: 100%; border-collapse: separate; border-spacing: 0 0.15rem; margin-top: 1.25rem; }
th { 
    padding: 0.85rem; color: var(--text-main); font-size: 0.85rem; font-weight: 800; 
    text-align: center; background: var(--bg-card); border-bottom: 2px solid var(--accent);
}
th:first-child { border-radius: 0.75rem 0 0 0.75rem; }
th:last-child { border-radius: 0 0.75rem 0.75rem 0; }

tr td { 
    padding: 1rem 1.25rem; background: var(--bg-row); 
    border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
    transition: 0.2s;
    word-break: break-all;
}
tr:hover td { background: var(--accent-glow); }
tr td:first-child { border-left: 1px solid var(--border); border-radius: 0.75rem 0 0 0.75rem; }
tr td:last-child { border-right: 1px solid var(--border); border-radius: 0 0.75rem 0.75rem 0; }

.zip-code { color: var(--accent); font-weight: 900; font-size: 1.1rem; text-align: center; }
.badge { 
    background: var(--bg-main); padding: 0.4rem 1rem; border-radius: 0.6rem; 
    font-size: 0.8rem; font-weight: 700; color: var(--text-main); 
    border: 1px solid var(--border); cursor: pointer; transition: 0.2s;
}
.badge.active { background: var(--accent); color: white; border-color: var(--accent); }

.copy-btn { 
    background: var(--accent); color: white; border: none; padding: 0.6rem; 
    border-radius: 0.6rem; cursor: pointer; transition: 0.2s; display: flex; align-items: center;
    flex-shrink: 0;
}
.copy-btn:hover { transform: scale(1.1); }

.results-table-wrap {
    position: relative;
    width: 100%;
    overflow-x: visible;
}
.results-table-wrap.is-loading table {
    opacity: 0.45;
    pointer-events: none;
}
.table-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    pointer-events: none;
}
.table-spinner {
    width: 36px;
    height: 36px;
    border: 4px solid var(--accent-glow);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* 로딩 오버레이 & 스피너 (프리미엄 버전) */
.loading-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.8);
    display: flex; justify-content: center; align-items: center;
    z-index: 10000; backdrop-filter: blur(8px);
}
:root[data-theme='light'] .loading-overlay {
    background: rgba(248, 250, 252, 0.88);
}
.spinner { 
    width: 60px; height: 60px; 
    border: 6px solid var(--accent-glow); 
    border-top-color: var(--accent); 
    border-radius: 50%; 
    margin: 0 auto;
    animation: spin 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite; 
}
@keyframes spin { to { transform: rotate(360deg); } }
[x-cloak] { display: none !important; }

/* 모바일 반응형 추가 */
@media screen and (max-width: 768px) {
    .container { padding: 1.5rem 1rem; }
    header { flex-direction: column; text-align: center; gap: 1.5rem; margin-bottom: 2rem !important; }
    header h1 { font-size: 1.8rem !important; }
    
    .btn-group { gap: 0.5rem; }
    .btn-blue, .btn-dark { padding: 0.6rem 1rem; font-size: 0.9rem; }
    
    .clay-card { padding: 1rem; }
    .search-box { font-size: 1rem; padding: 0.8rem 1rem; }

    .mobile-sort-bar { display: flex; }
    table thead { display: none; }
    table, tbody, tr, td { display: block; width: 100%; box-sizing: border-box; }
    tr { margin-bottom: 1rem; border-radius: 1rem; overflow: hidden; border: 1px solid var(--border); }
    tr td { 
        text-align: left !important; 
        border: none; 
        border-bottom: 1px solid var(--border); 
        padding: 0.8rem 1rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    tr td:last-child { border-bottom: none; }
    tr td::before {
        content: attr(data-label);
        font-weight: 800;
        color: var(--text-muted);
        font-size: 0.75rem;
        text-transform: uppercase;
    }
    
    .zip-code { font-size: 1.2rem; }
}

