:root {
    /* Color System */
    --color-bg: #0F172A;          /* 다크 네이비 (Hero 배경) */
    --color-surface: #FFFFFF;     /* 화이트 (결과 영역) */
    --color-text: #1E293B;        /* 다크 슬레이트 (본문) */
    --color-text-light: #FFFFFF;  /* Hero 라이트 텍스트 */
    --color-accent: #10B981;      /* 에메랄드 민트 (액센트, CTA) */
    --color-muted: #94A3B8;       /* 슬레이트 뮤트 */
    --color-border: #E2E8F0;      /* 라이트 보더 */
    --color-error: #EF4444;       /* 레드 */
    --color-success: #10B981;     /* 그린 */
    --color-warning: #F59E0B;     /* 앰버 */
    
    /* Spacing Scale */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    
    /* Typography */
    --font-family: 'Pretendard Variable', 'Pretendard', 'Noto Sans KR', sans-serif;
    --font-size-sm: 0.875rem;    /* 14px */
    --font-size-base: 1rem;      /* 16px */
    --font-size-lg: 1.25rem;     /* 20px */
    --font-size-xl: 2rem;        /* 32px */
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
}

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

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    color: var(--color-text);
    line-height: 1.5;
    background-color: var(--color-surface);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-xl);
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--color-surface);
    padding: var(--spacing-md) 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.logo-text {
    font-weight: var(--font-weight-bold);
    color: var(--color-accent);
}

.title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
}

.lang-toggle {
    background: none;
    border: 1px solid var(--color-border);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 4px;
    cursor: pointer;
    font-size: var(--font-size-sm);
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    background-color: var(--color-bg);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    padding-top: 80px;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    opacity: 0.15;
    z-index: -1;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(15, 23, 42, 0.7) 100%);
    z-index: -1;
}

.hero-content {
    max-width: 800px;
}

.hero-headline {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-light);
    margin-bottom: var(--spacing-lg);
    line-height: 1.2;
}

.hero-subtitle {
    font-size: var(--font-size-lg);
    color: var(--color-text-light);
    opacity: 0.9;
    margin-bottom: var(--spacing-2xl);
}

.input-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    max-width: 800px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.form-group label {
    font-weight: var(--font-weight-medium);
    color: var(--color-text-light);
}

.select-input, .input-field {
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: var(--font-size-base);
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--color-text-light);
    font-family: var(--font-family);
    min-height: 44px;
}

.select-input option {
    background-color: var(--color-bg);
    color: var(--color-text);
}

.cta-button {
    background-color: var(--color-accent);
    color: white;
    border: none;
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: 8px;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: var(--spacing-lg);
    width: 100%;
}

.cta-button:hover {
    background-color: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Results Section */
.results-section {
    padding: var(--spacing-2xl) 0;
    background-color: var(--color-surface);
}

.results-header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
}

.section-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
    margin-bottom: var(--spacing-sm);
}

/* section-subtitle moved to accessibility section for WCAG fix */

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-2xl);
}

.cost-card {
    background: linear-gradient(135deg, var(--color-surface) 0%, #f8fafc 100%);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: var(--spacing-lg);
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.cost-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.card-icon {
    font-size: 2rem;
    margin-bottom: var(--spacing-sm);
}

.card-value {
    font-size: 2.5rem;
    font-weight: var(--font-weight-bold);
    color: var(--color-accent);
    margin-bottom: var(--spacing-sm);
}

.card-label {
    font-size: var(--font-size-base);
    color: #5A6A7B;
}

.card-percentage {
    font-size: var(--font-size-sm);
    color: var(--color-success);
    font-weight: var(--font-weight-semibold);
}

/* Team Analysis */
.team-analysis {
    margin-bottom: var(--spacing-2xl);
}

.section-controls {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
}

.select-input.small {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-sm);
}

.data-table {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: var(--spacing-lg);
}

.data-table table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background-color: var(--color-bg);
    color: white;
    padding: var(--spacing-md);
    text-align: left;
    font-weight: var(--font-weight-semibold);
}

.data-table td {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--color-border);
}

.data-table tr:hover {
    background-color: #f8fafc;
}

.chart-container {
    height: 300px;
    margin-top: var(--spacing-lg);
}

/* Savings Simulation */
.savings-simulation {
    margin-bottom: var(--spacing-2xl);
}

.simulation-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.simulation-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--color-accent);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.simulation-value {
    font-weight: var(--font-weight-semibold);
    color: var(--color-accent);
}

.slider-control {
    margin-top: var(--spacing-lg);
}

.slider-control label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-weight: var(--font-weight-medium);
}

#savings-slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e5e7eb;
    -webkit-appearance: none;
}

#savings-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-accent);
    cursor: pointer;
}

#savings-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-accent);
    cursor: pointer;
    border: none;
}

/* GPU Comparison */
.gpu-comparison {
    margin-bottom: var(--spacing-2xl);
}

/* FIX F5: Scrollable wrapper for mobile */
.comparison-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.comparison-table {
    background: white;
    border-radius: 12px;
    overflow: auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    min-width: 600px;
}

.comparison-table table {
    width: 100%;
    border-collapse: collapse;
}

.comparison-table th {
    background-color: var(--color-bg);
    color: white;
    padding: var(--spacing-md);
    text-align: left;
    font-weight: var(--font-weight-semibold);
}

.comparison-table td {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--color-border);
    text-align: center;
}

.comparison-table tr:nth-child(even) {
    background-color: #f8fafc;
}

.comparison-table tr:hover {
    background-color: #f1f5f9;
}

.comparison-table .best-price {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--color-accent);
    font-weight: var(--font-weight-semibold);
}

.comparison-table .not-supported {
    color: var(--color-muted);
    font-style: italic;
}

/* Notification */
.notification {
    position: fixed;
    top: 80px;
    right: var(--spacing-xl);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: 8px;
    color: white;
    font-weight: var(--font-weight-medium);
    z-index: 200;
    animation: slideIn 0.3s ease-out;
}

.notification.error {
    background-color: var(--color-error);
}

.notification.info {
    background-color: var(--color-accent);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Footer */
.footer {
    background-color: var(--color-bg);
    color: var(--color-text-light);
    padding: var(--spacing-xl) 0;
    margin-top: var(--spacing-2xl);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-lg);
}

.footer-links a {
    color: var(--color-text-light);
    text-decoration: none;
    margin-right: var(--spacing-md);
    transition: color 0.3s ease;
    padding: var(--spacing-sm) 0;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.footer-links a:hover {
    color: var(--color-accent);
}

.footer-text {
    font-size: var(--font-size-sm);
    opacity: 0.8;
}

/* Animations */
.animate-fade-in {
    animation: fadeIn 1s ease-out;
}

.animate-fade-in-delay {
    animation: fadeIn 1s ease-out 0.5s both;
}

.animate-slide-up {
    animation: slideUp 1s ease-out 1s both;
}

.animate-stagger {
    animation: stagger 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

/* Responsive Design */
@media (max-width: 768px) {
    /* FIX F12: Header wraps on small screens */
    .header-content {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }
    .title {
        font-size: var(--font-size-base);
        width: 100%;
        text-align: center;
        order: 3;
    }

    .hero-headline {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1.25rem;
    }
    
    .input-form {
        grid-template-columns: 1fr;
    }
    
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .section-controls {
        flex-direction: column;
    }
    
    .simulation-controls {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-links {
        margin-bottom: var(--spacing-md);
    }
    
    .footer-links a {
        margin-right: var(--spacing-sm);
    }
}

/* FIX F18: Skip link (visible on focus) */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--color-accent);
    color: white;
    padding: var(--spacing-md) var(--spacing-lg);
    z-index: 1000;
    font-weight: var(--font-weight-semibold);
    text-decoration: none;
    border-radius: 0 0 4px 0;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.skip-link:focus {
    top: 0;
}

/* FIX F7: Scroll margin for fixed header */
.results-section {
    scroll-margin-top: 96px;
}

/* FIX F6: Darker muted text for WCAG AA contrast */
.section-subtitle {
    font-size: var(--font-size-lg);
    color: #64748B;
}

/* Accessibility */
:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}