@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&family=Pretendard:wght@400;600;700&display=swap');

:root {
    --bg-color: #05070a;
    --card-bg: rgba(16, 20, 28, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --accent-primary: #00f2ff;
    --accent-secondary: #7000ff;
    --accent-gradient: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    --surface-glass: blur(12px) saturate(180%);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --font-main: 'Pretendard', sans-serif;
    --font-heading: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Background Decoration */
.bg-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.bg-glow::before {
    content: '';
    position: absolute;
    top: -10%;
    right: -10%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(112, 0, 255, 0.15) 0%, transparent 70%);
    filter: blur(80px);
}

.bg-glow::after {
    content: '';
    position: absolute;
    bottom: -10%;
    left: -10%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(0, 242, 255, 0.1) 0%, transparent 70%);
    filter: blur(80px);
}

/* View Tabs System */
.view-tabs {
    grid-column: span 12;
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.5rem;
    border-radius: 1rem;
    width: fit-content;
    border: 1px solid var(--border-color);
}

.view-tab-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.3s ease;
}

.view-tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.view-tab-btn.active {
    background: var(--accent-gradient);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 242, 255, 0.2);
}

.tab-content {
    display: none;
    grid-column: span 12;
}

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

.main-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.full-chart-card {
    grid-column: span 12;
}

/* Apartment Table Styles */
.total-units-badge {
    background: var(--accent-gradient);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 242, 255, 0.2);
}

.table-container {
    overflow-x: auto;
    margin-top: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.875rem;
}

.data-table th {
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem 1.5rem;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.status-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.completed { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.status-badge.planned { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }

header {
    padding: 4rem 0 2rem 0;
    max-width: 1200px;
    margin: 0 auto;
    width: 90%; /* Align with container width */
}

.brand-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.brand-label {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
    padding-left: 2px;
}

.brand-container h1 {
    font-size: clamp(1.5rem, 6vw, 2.8rem);
    font-weight: 900;
    letter-spacing: -0.04em;
    line-height: 1.25;
    background: linear-gradient(135deg, #00f2ff 0%, #7000ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    max-width: 95%;
    word-break: keep-all;
}

.brand {
    display: flex;
    flex-direction: column;
}

.brand h1 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 400;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem 4rem;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
}

/* KPI Cards */
.kpi-container {
    grid-column: span 12;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--card-bg);
    backdrop-filter: var(--surface-glass);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.15);
}

.kpi-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.kpi-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.kpi-value {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.kpi-delta {
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    width: fit-content;
}

.kpi-delta.up { color: #10b981; background: rgba(16, 185, 129, 0.1); }
.kpi-delta.down { color: #ef4444; background: rgba(239, 68, 68, 0.1); }

.kpi-delta-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.delta-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Main Chart Sections */
.chart-main {
    grid-column: span 8;
}

.chart-side {
    grid-column: span 4;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
}

/* Controls */
.controls {
    grid-column: span 12;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    background: var(--card-bg);
    backdrop-filter: var(--surface-glass);
    padding: 1.25rem 2rem;
    border-radius: 1.5rem;
    border: 1px solid var(--border-color);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: fit-content;
}

.filter-pair {
    display: flex;
    gap: 0.5rem;
    flex: 1;
}

.button-group {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.35rem;
    border-radius: 1rem;
    gap: 0.25rem;
    width: 100%;
}

.button-group button {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.6rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    white-space: nowrap;
    box-shadow: none;
    color: var(--text-secondary); /* Ensure text is visible */
}

.button-group button:hover {
    background: rgba(255, 255, 255, 0.05);
}

.button-group button.active {
    background: var(--accent-gradient);
    color: white;
    font-weight: 700;
}

select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem 1.25rem;
    border-radius: 0.75rem;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.25s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
    flex: 1;
}

select:focus {
    border-color: var(--accent-primary);
    outline: none;
    background-color: rgba(255, 255, 255, 0.08);
}

/* Ensure options are visible on all browsers */
select option {
    background-color: #1a1f2e;
    color: #ffffff;
    padding: 10px;
}

select option:disabled {
    color: rgba(255, 255, 255, 0.3);
    background-color: #0f172a;
}

/* Footer */
footer {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.75rem;
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .chart-main, .chart-side {
        grid-column: span 12;
    }
}

@media (max-width: 768px) {
    header {
        padding: 2.5rem 0 1.5rem 0;
    }
    .brand-label {
        font-size: 0.75rem;
        letter-spacing: 1px;
    }
    .container {
        padding: 0 1rem 2rem;
        gap: 1rem;
    }
    .view-tabs {
        width: 100%;
        overflow-x: auto;
        justify-content: flex-start;
        padding: 0.25rem;
        margin-bottom: 1.5rem;
    }
    .view-tab-btn {
        padding: 0.6rem 1rem;
        font-size: 0.875rem;
        white-space: nowrap;
    }
    .kpi-container {
        grid-template-columns: 1fr;
    }
    .kpi-card {
        padding: 1.25rem;
    }
    .kpi-value {
        font-size: 1.75rem;
    }
    .controls {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 1.25rem;
    }
    .filter-group {
        width: 100%;
    }
    .filter-pair {
        width: 100%;
    }
    .button-group {
        width: 100%;
    }
    .button-group button {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    header {
        padding: 2rem 0 1rem 0;
    }
    .brand-container h1 {
        font-size: 1.35rem; /* 터치 기기에서 너무 큰 폰트 방지 */
    }
    .container {
        padding: 0 0.75rem 2rem;
    }
    .card {
        padding: 1.25rem 1rem;
        border-radius: 1.25rem;
    }
    .total-units-badge {
        font-size: 0.75rem;
        padding: 0.35rem 0.75rem;
    }
}

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

.card {
    animation: fadeIn 0.6s ease out backwards;
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }
