/* CSS 변수 정의 */
:root {
    /* 색상 */
    --color-primary: #1a73e8;
    --color-primary-dark: #1557b0;    --color-text: #333;
    --color-text-primary: #333;
    --color-text-secondary: #666;
    --color-light-text: #666;
    --color-bg-main: #f8f9fa;
    --color-bg-card: #fff;
    --color-bg-secondary: #f5f5f5;
    --color-border: #ddd;
    --color-border-light: #eee;
    --color-hover: #e0e0e0;
    --color-active: #1a73e8;
    --color-btn-hover: #616161;
    
    /* 활성/비활성 요소 */
    --color-active-text: white;
    --color-active-border: #1557b0;
    --color-disabled-bg: #ccc;
    
    /* 상태 색상 */
    --color-success: #34a853;
    --color-warning: #fbbc04;
    --color-error: #ea4335;
    --color-up: #0066cc;
    --color-down: #cc0000;
    
    /* 레이아웃 */
    --spacing-xs: 0.2rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --border-radius: 4px;
    --element-height: 36px;
    
    /* 타이포그래피 */
    --font-size-small: 0.9rem;
    --font-size-normal: 1rem;
    --font-size-medium: 1.2rem;
    --font-size-large: 1.8rem;
    
    /* 난이도 색상 */
    --weight-vl-bg: #1A91E6;
    --weight-l-bg: #63C5DA;
    --weight-ml-bg: #7DCE13;
    --weight-m-bg: #E07B3C;
    --weight-h-bg: #D63333;
    --weight-vh-bg: #9C2C77;
    
    /* 연도 색상 */
    --year-current-bg: #81effd;
    --year-recent-3-bg: #E0FFFF;
    --year-recent-10-bg: #f5f7fa;
    --year-older-10-bg: #D3D3D3;
    --year-before-2000-bg: #696969;
      /* 순위 변동 색상 */
    --diff-up-bg: #e0f7ff;
    --diff-bigup-bg: #81effd;
    --diff-down-bg: #fff0e0;
    --diff-bigdown-bg: #ffb7b7;
}

/* 다크 모드 색상 변수 */
[data-theme="dark"] {
    /* 기본 색상 */
    --color-primary: #4a9eff;
    --color-primary-dark: #3d82cc;    --color-text: #e1e1e1;
    --color-text-primary: #e1e1e1;
    --color-text-secondary: #b3b3b3;
    --color-light-text: #b3b3b3;
    --color-bg-main: #1a1a1a;
    --color-bg-card: #2d2d2d;
    --color-bg-secondary: #242424;
    --color-border: #444;
    --color-border-light: #333;
    --color-hover: #404040;
    --color-active: #4a9eff;
    --color-btn-hover: #525252;
    
    /* 활성/비활성 요소 */
    --color-active-text: #000;
    --color-active-border: #3d82cc;
    --color-disabled-bg: #555;
    
    /* 상태 색상 */
    --color-success: #4caf50;
    --color-warning: #ff9800;
    --color-error: #f44336;
    --color-up: #4da6ff;
    --color-down: #ff6b6b;
    
    /* 난이도 색상 - 다크 모드용 */
    --weight-vl-bg: #2a5aa0;
    --weight-l-bg: #4a8fa0;
    --weight-ml-bg: #5a9a20;
    --weight-m-bg: #b05a2a;
    --weight-h-bg: #a04040;
    --weight-vh-bg: #804060;
    
    /* 연도 색상 - 다크 모드용 */
    --year-current-bg: #2a4d5a;
    --year-recent-3-bg: #1f3a3a;
    --year-recent-10-bg: #2a2a2a;
    --year-older-10-bg: #404040;
    --year-before-2000-bg: #1a1a1a;
    
    /* 순위 변동 색상 - 다크 모드용 */
    --diff-up-bg: #1a3d4d;
    --diff-bigup-bg: #2a4d5a;
    --diff-down-bg: #4d3d1a;
    --diff-bigdown-bg: #5a2a2a;
}

/* 기본 스타일 리셋 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    line-height: 1.6;
    color: var(--color-text);
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 10px;
    background-color: var(--color-bg-main);
}

header {
    margin: 1rem 0;
    text-align: center;
}

main {
    margin-bottom: 1rem;
}

h1, h2 {
    margin-bottom: 0rem;
}

h2 img {
    height: 1em;
    vertical-align: middle;
    margin-right: 8px;
}

hr {
    margin: 10px 0;
    border: 1px dashed var(--color-border);
}
section {
    margin-bottom: 1rem;
}

/* 기본 입력 요소 스타일 */
select, input, button {
    height: var(--element-height);
    box-sizing: border-box;
    vertical-align: middle;
}

/* 기본 입력 필드 스타일 */
select, input {
    padding: var(--spacing-xs) var(--spacing-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    margin-top: 0;
    font-size: var(--font-size-normal);
    background-color: var(--color-bg-card);
}

/* 기본 버튼 스타일 */
button {
    cursor: pointer;
    background-color: #f0f0f0;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-small);
    transition: background-color 0.2s;
    height: var(--element-height);
}

button:hover {
    background-color: var(--color-hover);
}

/* 링크 스타일 */
a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* 이미지 기본 스타일 */
img {
    max-width: 100%;
    height: auto;
}

/* 레이블 스타일 */
label {
    line-height: 1.1rem;
}

/* 빈 간격 셀 */
.blank-td {
    width: 2px;
    font-size: 0;
    max-width: 2px;
    padding: 0;
}

/* 반응형 기본 설정 */
@media (max-width: 768px) {
    body {
        padding: 0px 0px;
    }
    
    h1, h2 {
        font-size: var(--font-size-medium);
    }
    
    select, input, button {
        font-size: 0.9rem;
    }
}

/* 날짜 표시 스타일 */
.current-date-display {
    text-align: center;
    color: var(--color-text);
    font-size: var(--font-size-small);
    margin-top: 0.3rem;
    margin-bottom: 0.5rem;
}

.current-date-display span {    
    font-style: italic;
}

/* 헤더 컨트롤 레이아웃 */
.header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 600px;
    margin: 0 auto;
    gap: 1rem;
}

/* 테마 토글 스위치 */
.theme-toggle-container {
    display: flex;
    align-items: center;
}

.theme-toggle {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
    cursor: pointer;
}

.theme-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--color-border);
    border-radius: 30px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px;
    border: 1px solid var(--color-border-light);
}

.toggle-slider:before {
    content: "";
    position: absolute;
    height: 24px;
    width: 24px;
    background-color: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    left: 3px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .toggle-slider {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

input:checked + .toggle-slider:before {
    transform: translateX(30px);
}

.toggle-icon {
    font-size: 14px;
    z-index: 1;
    pointer-events: none;
}

.toggle-icon.sun {
    margin-left: 2px;
}

.toggle-icon.moon {
    margin-right: 2px;
}

/* 반응형 디자인을 위한 추가 스타일 */
@media (max-width: 768px) {
    .current-date-display {
        font-size: 0.8rem;
    }
    
    .header-controls {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .theme-toggle {
        width: 50px;
        height: 25px;
    }
    
    .toggle-slider:before {
        height: 19px;
        width: 19px;
    }
    
    input:checked + .toggle-slider:before {
        transform: translateX(25px);
    }
    
    .toggle-icon {
        font-size: 12px;
    }
}

