/* CSS Variables - Premium Palette & Design System */
:root {
    --bg-primary: #090d16;
    --bg-secondary: #111827;
    --bg-card: #1f2937;
    --bg-card-hover: #374151;
    --bg-input: #1f2937;
    
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --color-brand: #6366f1; /* Indigo */
    --color-brand-light: #818cf8;
    --color-success: #10b981; /* Emerald */
    --color-warning: #f59e0b; /* Amber */
    --color-danger: #ef4444; /* Rose Red */
    
    --color-sndc: #0284c7; /* Sky Blue for Seongnam City */
    --color-banks: #f59e0b; /* Amber for Banks */
    --color-hcdy: #d946ef; /* Magenta for Hwacheon Dae-yu */
    
    --glass-bg: rgba(31, 41, 55, 0.45);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: rgba(0, 0, 0, 0.4);
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 18px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Basic Setup */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', 'Noto Sans KR', sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar (Left Column) */
.app-sidebar {
    width: 380px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--glass-border);
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    margin-bottom: 2.5rem;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1px;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
}

.badge-primary {
    background-color: rgba(99, 102, 241, 0.15);
    color: var(--color-brand-light);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.sidebar-header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.25;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.sidebar-header .highlight {
    color: var(--color-brand-light);
    background: linear-gradient(120deg, #818cf8 0%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-header .subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 400;
}

/* Timeline Stepper */
.timeline-stepper {
    position: relative;
    flex-grow: 1;
    margin-top: 1rem;
}

.timeline-line {
    position: absolute;
    left: 20px;
    top: 15px;
    bottom: 15px;
    width: 2px;
    background-color: #374151;
    z-index: 1;
}

.timeline-stepper ul {
    list-style: none;
    position: relative;
    z-index: 2;
}

.step-node {
    display: flex;
    align-items: flex-start;
    padding: 0.75rem 0;
    margin-bottom: 0.5rem;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: var(--transition);
    padding-left: 0.5rem;
}

.step-node:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.step-node.active {
    background-color: rgba(99, 102, 241, 0.1);
    border-left: 3px solid var(--color-brand);
    padding-left: calc(0.5rem - 3px);
}

.node-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: #4b5563;
    border: 3px solid var(--bg-secondary);
    margin-left: 10px;
    margin-right: 15px;
    margin-top: 5px;
    transition: var(--transition);
    flex-shrink: 0;
}

.step-node.active .node-dot {
    background-color: var(--color-brand-light);
    box-shadow: 0 0 10px var(--color-brand-light);
}

.node-content {
    display: flex;
    flex-direction: column;
}

.node-step-num {
    font-family: 'Outfit', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.step-node.active .node-step-num {
    color: var(--color-brand-light);
}

.node-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
}

.step-node.active .node-title {
    color: var(--text-primary);
}

.node-era {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sidebar-footer {
    border-top: 1px solid var(--glass-border);
    padding-top: 1.5rem;
    margin-top: 2rem;
}

.sidebar-footer p {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.sidebar-footer .version {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* Main Content Area (Right Column) */
.app-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
}

/* Tab Navigation */
.main-header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--glass-border);
    padding: 1.5rem 3rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.view-tabs {
    display: flex;
    gap: 1rem;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    border: 1px solid transparent;
}

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

.tab-btn.active {
    color: var(--text-primary);
    background-color: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
}

.tab-btn .icon {
    width: 18px;
    height: 18px;
}

.main-content {
    padding: 3rem;
    flex-grow: 1;
    max-width: 1300px;
    width: 100%;
    margin: 0 auto;
}

/* Tab Panel Switch */
.tab-panel {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Core Card Component */
.card {
    background-color: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 30px var(--glass-shadow);
    padding: 2.5rem;
    backdrop-filter: blur(10px);
}

.panel-card {
    margin-bottom: 2rem;
}

.card-header {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1.5rem;
}

.card-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* 3대 핵심 변곡점 배너 */
.inflection-points-container {
    margin-bottom: 2.5rem;
}

.inflection-points-container h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.inflection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.inflection-card {
    background-color: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.inflection-card:hover {
    border-color: rgba(99, 102, 241, 0.4);
    background-color: rgba(99, 102, 241, 0.05);
    transform: translateY(-3px);
}

.inflection-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0.75rem;
}

.inflection-num {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--color-brand-light);
}

.inflection-card h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.inflection-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.action-text {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-brand-light);
    display: block;
}

/* Dynamic Step Card Viewport */
.detail-card-viewport {
    min-height: 400px;
}

/* Detailed Information Layout inside Step Card */
.step-detail-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    padding: 3rem;
}

.step-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.step-tag-row {
    display: flex;
    gap: 10px;
    margin-bottom: 0.5rem;
}

.step-era-badge {
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.step-card-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
}

.step-actors-block {
    margin-bottom: 1.5rem;
}

.step-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    display: block;
}

.actors-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.actor-tag {
    background-color: rgba(99, 102, 241, 0.12);
    color: var(--color-brand-light);
    border: 1px solid rgba(99, 102, 241, 0.25);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Visual Micro-Data Dashboard in Step Card */
.step-metrics-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    background-color: rgba(255,255,255,0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
}

.metric-block {
    display: flex;
    flex-direction: column;
}

.metric-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 800;
}

.metric-value.profit { color: var(--color-success); }
.metric-value.loan { color: var(--color-warning); }
.metric-value.status { color: var(--color-brand-light); }

.metric-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 700;
    margin-top: 2px;
    text-transform: uppercase;
}

/* Description & Result */
.step-description-section {
    font-size: 1.05rem;
    line-height: 1.75;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.step-result-block {
    background-color: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 2.5rem;
}

.step-result-block.success-mode {
    background-color: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.result-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-danger);
    margin-bottom: 0.5rem;
}

.step-result-block.success-mode .result-header {
    color: var(--color-success);
}

.result-content {
    font-size: 0.95rem;
    color: var(--text-primary);
}

/* Playfair Quote Block */
.step-quote-block {
    position: relative;
    padding-left: 2rem;
    border-left: 3px solid var(--color-brand-light);
    margin-top: 2.5rem;
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 1.15rem;
    color: #e2e8f0;
}

.step-quote-block::before {
    content: '“';
    position: absolute;
    left: 0.5rem;
    top: -0.75rem;
    font-size: 3.5rem;
    color: rgba(99, 102, 241, 0.15);
    line-height: 1;
}

.quote-author {
    font-family: 'Inter', sans-serif;
    font-style: normal;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-top: 0.5rem;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* SPC Tab Dashboard styling */
.spc-dashboard-grid {
    display: grid;
    grid-template-columns: 1.2fr 1.8fr;
    gap: 3rem;
    align-items: start;
}

.spc-visualizer-card {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chart-container {
    position: relative;
    width: 250px;
    height: 250px;
    margin-bottom: 2rem;
}

.donut-chart {
    transform: rotate(-90deg);
}

.chart-segment {
    fill: none;
    stroke-width: 14;
    transition: stroke-width 0.25s ease;
    cursor: pointer;
}

.chart-segment:hover {
    stroke-width: 18;
}

.segment-sndc { stroke: var(--color-sndc); }
.segment-banks { stroke: var(--color-banks); }
.segment-hcdy { stroke: var(--color-hcdy); }

.chart-center {
    fill: var(--bg-secondary);
}

.chart-label-title {
    fill: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    text-anchor: middle;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.chart-label-value {
    fill: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 800;
    text-anchor: middle;
    font-family: 'Outfit', sans-serif;
}

.chart-legend {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.legend-item:hover, .legend-item.active {
    background-color: rgba(255,255,255,0.04);
    border-color: var(--glass-border);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.color-sndc { background-color: var(--color-sndc); }
.color-banks { background-color: var(--color-banks); }
.color-hcdy { background-color: var(--color-hcdy); }

.legend-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.legend-item:hover .legend-name, .legend-item.active .legend-name {
    color: var(--text-primary);
}

/* SPC Detail Box */
.spc-details-card {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.spc-info-box {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 2.5rem;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.info-box-placeholder {
    text-align: center;
    color: var(--text-muted);
}

.info-box-placeholder h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.spc-data-content h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.spc-data-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.spc-data-row {
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.75rem;
}

.spc-data-row:last-child {
    border-bottom: none;
}

.spc-data-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.spc-data-val {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 2px;
}

.spc-data-desc {
    grid-column: span 2;
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-top: 0.5rem;
}

/* Warnings / Tip box */
.warning-box {
    background-color: rgba(245, 158, 11, 0.05);
    border: 1px solid rgba(245, 158, 11, 0.15);
    border-radius: var(--radius-md);
    padding: 1.5rem;
}

.warning-box h4 {
    color: var(--color-warning);
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.warning-box p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Land Block Grid layout */
.land-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.land-card {
    background-color: rgba(255,255,255,0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.land-card:hover {
    border-color: rgba(99, 102, 241, 0.35);
    transform: translateY(-4px);
    background-color: rgba(255, 255, 255, 0.04);
}

.land-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}

.land-block-id {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--color-brand-light);
}

.land-status-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.status-sold {
    background-color: rgba(16, 185, 129, 0.12);
    color: var(--color-success);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.status-self {
    background-color: rgba(99, 102, 241, 0.12);
    color: var(--color-brand-light);
    border: 1px solid rgba(99, 102, 241, 0.25);
}

.land-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.land-info-row {
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 4px;
}

.land-info-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
}

.land-info-value {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.land-profit-row {
    background-color: rgba(16, 185, 129, 0.05);
    border-radius: 4px;
    padding: 8px 12px;
}

.land-profit-row .land-info-label {
    color: var(--color-success);
}

.land-profit-row .land-info-value {
    font-size: 1.1rem;
    color: var(--color-success);
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
}

.land-card-footer {
    border-top: 1px solid var(--glass-border);
    padding-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Actors & Glossary Profiles Tab */
.glossary-dashboard {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.actors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.actor-profile-card {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.75rem;
    transition: var(--transition);
}

.actor-profile-card:hover {
    border-color: rgba(99,102,241,0.25);
    background-color: rgba(255, 255, 255, 0.04);
}

.actor-p-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1rem;
}

.actor-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-brand) 0%, #a855f7 100%);
    color: white;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.actor-meta h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.actor-role-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.actor-bio {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Glossary Terms */
.glossary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.term-card {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
}

.term-card h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-brand-light);
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 6px;
}

.term-def {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Responsive Web Layout */
@media (max-width: 1150px) {
    .spc-dashboard-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
    }
    
    .app-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
        padding: 2rem;
    }
    
    .app-main {
        height: auto;
        overflow-y: visible;
    }
    
    .main-header {
        padding: 1rem 2rem;
    }
    
    .main-content {
        padding: 2rem;
    }
}

@media (max-width: 640px) {
    .view-tabs {
        overflow-x: auto;
        padding-bottom: 6px;
    }
    
    .tab-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
        flex-shrink: 0;
    }
    
    .step-detail-card {
        padding: 1.5rem;
    }
    
    .step-card-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .step-metrics-bar {
        grid-template-columns: 1fr;
    }
}
