/* Main Styles */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --header-height: 64px;
    --sidebar-width: 280px;
}

body {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    height: var(--header-height);
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    height: 100%;
    max-width: 1920px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

.nav {
    display: flex;
    gap: 32px;
}

.nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.2s;
    position: relative;
    padding: 8px 0;
}

.nav-link:hover {
    color: var(--text-primary);
}

.nav-link.active {
    color: var(--primary-color);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -21px;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--primary-color);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: 32px;
}

.sidebar-section h3 {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}

/* Content Area */
.content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.view h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-primary);
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.metric-card {
    background-color: var(--bg-primary);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.metric-header h4 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.metric-change {
    font-size: 14px;
    font-weight: 600;
}

.metric-change.positive {
    color: var(--success-color);
}

.metric-change.negative {
    color: var(--danger-color);
}

.metric-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.metric-chart {
    height: 60px;
    background-color: var(--bg-tertiary);
    border-radius: 8px;
}

/* Chart Container */
.chart-container {
    background-color: var(--bg-primary);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.chart-container h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 24px;
}

#mainChart {
    max-height: 400px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 1000;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay p {
    color: #ffffff;
    font-size: 16px;
}

/* Report Preview */
.report-preview {
    background-color: var(--bg-primary);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.preview-content {
    min-height: 400px;
    padding: 24px;
    background-color: var(--bg-secondary);
    border-radius: 8px;
}

/* History List */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Update Info */
.update-info {
    /* 기존 스타일 제거 */
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        top: var(--header-height);
        bottom: 0;
        transition: left 0.3s;
        z-index: 50;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .content {
        padding: 16px;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
}