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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    background: white;
    border-radius: 12px;
    padding: 20px 30px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

header h1 {
    font-size: 28px;
    margin: 0;
    color: #2d3748;
}

.header-logo {
    display: flex;
    align-items: center;
}

.logo-image {
    height: 50px;
    width: auto;
    background: transparent;
}

.main-nav {
    display: flex;
    gap: 10px;
}

.nav-btn, .sub-nav-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    background: #e2e8f0;
    color: #4a5568;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.nav-btn:hover, .sub-nav-btn:hover {
    background: #cbd5e0;
    transform: translateY(-2px);
}

.nav-btn.active, .sub-nav-btn.active {
    background: #667eea;
    color: white;
}

.content-section {
    display: none;
}

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

.sub-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* 날짜 필터 스타일 */
.date-filter {
    display: none; /* 기본적으로 숨김 */
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.date-filter.show {
    display: flex; /* show 클래스가 있을 때만 표시 */
}

.date-filter-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-management-buttons {
    display: flex;
    gap: 10px;
}

.date-filter label {
    font-weight: 600;
    color: #4a5568;
    font-size: 14px;
}

.date-filter #date-input,
.date-filter #start-date-input,
.date-filter #end-date-input,
.date-filter #fibonacci-date-input {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    color: #2d3748;
    background: white;
    cursor: pointer;
}

.date-filter #theme-date-range {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-filter #theme-date-range label {
    font-weight: 600;
    color: #4a5568;
    font-size: 14px;
}

.date-filter #date-input:focus,
.date-filter #fibonacci-date-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.date-apply-btn, .date-reset-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.date-apply-btn {
    background: #667eea;
    color: white;
}

.date-apply-btn:hover {
    background: #5568d3;
    transform: translateY(-1px);
}

.date-reset-btn {
    background: #e2e8f0;
    color: #4a5568;
}

.date-reset-btn:hover {
    background: #cbd5e0;
}

.file-management-buttons .btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.file-management-buttons .btn-primary {
    background: #3182ce;
    color: white;
}

.file-management-buttons .btn-primary:hover {
    background: #2c5aa0;
}

.file-management-buttons .btn-secondary {
    background: #718096;
    color: white;
}

.file-management-buttons .btn-secondary:hover {
    background: #4a5568;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.card h2 {
    font-size: 22px;
    margin-bottom: 20px;
    color: #2d3748;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #718096;
    font-size: 20px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* 시장 지표 스타일 */
.market-indicators {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.indicator-item {
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    transition: background-color 0.2s, transform 0.1s;
}

.indicator-item:hover {
    background: #edf2f7;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.indicator-name {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 8px;
}

.indicator-value {
    font-size: 24px;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 5px;
    line-height: 1.4;
}

.indicator-value .indicator-change {
    font-size: 16px;
    font-weight: 500;
    margin-left: 8px;
}

.indicator-change.positive {
    color: #e53e3e;
}

.indicator-change.negative {
    color: #3182ce;
}

.indicator-date {
    font-size: 12px;
    color: #718096;
    margin-top: 5px;
}

/* 미국주식 카드 스타일 */
.us-stock-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.us-stock-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border-left: 4px solid #667eea;
}

.us-stock-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.us-stock-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
}

.us-stock-card-ticker {
    font-size: 18px;
    font-weight: 700;
    color: #2d3748;
    letter-spacing: 0.5px;
}

.us-stock-card-name {
    font-size: 16px;
    font-weight: 600;
    color: #3182ce;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s;
}

.us-stock-card-name:hover {
    color: #2c5282;
    text-decoration: underline;
}

.us-stock-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.us-stock-card-item {
    display: flex;
    flex-direction: column;
}

.us-stock-card-label {
    font-size: 12px;
    color: #718096;
    margin-bottom: 4px;
    font-weight: 500;
}

.us-stock-card-value {
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
}

.us-stock-card-value.positive {
    color: #e53e3e;
}

.us-stock-card-value.negative {
    color: #3182ce;
}

.us-stock-card-full-width {
    grid-column: 1 / -1;
}

/* 52주 범위 슬라이더 스타일 */
.us-stock-range-container {
    margin-top: 8px;
}

.us-stock-range-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 11px;
    color: #718096;
}

.us-stock-range-label {
    font-weight: 500;
}

.us-stock-range-slider {
    position: relative;
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: visible;
}

.us-stock-range-track {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, #3182ce 0%, #38a169 100%);
    border-radius: 4px;
    opacity: 0.3;
}

.us-stock-range-indicator {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: #2d3748;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.us-stock-range-indicator::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
}

/* 엔벨로프 지시자 스타일 */
.envelope-indicator {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    z-index: 5;
    pointer-events: none;
}

.envelope-indicator-line {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    opacity: 0.9;
}

.envelope-indicator-label {
    position: absolute;
    top: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    font-weight: 700;
    color: #2d3748;
    white-space: nowrap;
    background: white;
    padding: 1px 4px;
    border-radius: 3px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* 테이블 스타일 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    table-layout: fixed;
}

.data-table th {
    background: #f7fafc;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table th.text-right {
    text-align: right;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 주가변동 테이블의 가격 막대바 셀 */
.price-change-table td.price-bar-cell {
    overflow: visible;
    vertical-align: middle;
}

/* L일봉H 형태의 가격 막대바 - 수평 캔들 차트 */
.price-bar-candle {
    position: relative;
    height: 50px;
    margin: 0 15px;
    display: flex;
    align-items: center;
}

.price-bar-candle-container {
    position: relative;
    width: 100%;
    height: 30px;
    display: flex;
    align-items: center;
}

/* 0% 기준선 (가운데 세로선) */
.price-bar-zero-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #718096;
    z-index: 1;
}

/* 캔들 몸통 (시가-종가) */
.price-bar-candle-body {
    position: absolute;
    height: 20px;
    border-radius: 2px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.price-bar-candle-body.rising {
    background: #e53e3e;
}

.price-bar-candle-body.falling {
    background: #3182ce;
}

.price-bar-candle-body.unchanged {
    background: #718096;
}

/* 캔들 꼬리 (저가-고가) - 수평선 */
.price-bar-candle-shadow {
    position: absolute;
    height: 1px;
    background: #718096;
    z-index: 1;
    top: 50%;
    transform: translateY(-50%);
}

.price-bar-candle-shadow.rising {
    background: #e53e3e;
}

.price-bar-candle-shadow.falling {
    background: #3182ce;
}

/* L, H 마커 (세로선) */
.price-bar-marker {
    position: absolute;
    width: 1px;
    background: #718096;
    z-index: 2;
    top: 0;
    bottom: 0;
}

.price-bar-marker.low-marker {
    background: #3182ce;
}

.price-bar-marker.high-marker {
    background: #e53e3e;
}

/* L, H 라벨 */
.price-bar-label {
    position: absolute;
    font-size: 9px;
    font-weight: 600;
    white-space: nowrap;
    z-index: 3;
}

.price-bar-label.low-label {
    color: #3182ce;
    left: 0;
    top: -18px;
}

.price-bar-label.high-label {
    color: #e53e3e;
    right: 0;
    top: -18px;
}

.price-bar-label.low-value {
    color: #4a5568;
    font-size: 8px;
    font-weight: 500;
    left: 0;
    top: 32px;
}

.price-bar-label.high-value {
    color: #4a5568;
    font-size: 8px;
    font-weight: 500;
    right: 0;
    top: 32px;
}

.data-table td.text-right {
    text-align: right;
}

.data-table td.positive {
    color: #e53e3e;
    font-weight: 500;
}

.data-table td.negative {
    color: #3182ce;
    font-weight: 500;
}

/* 크립토 페이지 스타일 */
.market-change.positive {
    color: #e53e3e; /* 상승: 빨간색 */
}

.market-change.negative {
    color: #3182ce; /* 하락: 파란색 */
}

.kimchi-premium.positive {
    color: #e53e3e; /* 상승: 빨간색 */
}

.kimchi-premium.negative {
    color: #3182ce; /* 하락: 파란색 */
}

.stock-name-link {
    color: #667eea;
    text-decoration: none;
    cursor: pointer;
    font-weight: 500;
}

.stock-name-link:hover {
    color: #5568d3;
    text-decoration: underline;
}

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

/* 섹션 헤더 */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #2d3748;
}

.section-count {
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 14px;
}

/* 요약 정보 */
.summary-box {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.summary-item {
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
    text-align: center;
}

.summary-item.summary-upper-limit {
    background: #fed7d7;
    border-left: 4px solid #e53e3e;
}

.summary-item.summary-upper-rate {
    background: #feebc8;
    border-left: 4px solid #dd6b20;
}

.summary-item.summary-lower-limit {
    background: #bee3f8;
    border-left: 4px solid #3182ce;
}

.summary-item.summary-lower-rate {
    background: #c6f6d5;
    border-left: 4px solid #38a169;
}

.summary-label {
    font-size: 12px;
    color: #718096;
    margin-bottom: 5px;
}

.summary-value {
    font-size: 24px;
    font-weight: 700;
    color: #2d3748;
}

/* 에러 메시지 */
.error-message {
    padding: 20px;
    background: #fed7d7;
    border-left: 4px solid #e53e3e;
    border-radius: 6px;
    color: #742a2a;
}

/* 차트 모달 */
.chart-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
}

.chart-modal-content {
    background-color: white;
    margin: 1% auto;
    padding: 30px;
    border: 1px solid #888;
    border-radius: 12px;
    width: 98%;
    max-width: 1800px;
    height: 96vh;
    position: relative;
    display: flex;
    flex-direction: column;
}

.chart-modal-content h3 {
    margin: 0 0 20px 0;
    font-size: 24px;
    color: #2d3748;
    padding-right: 40px;
    flex-shrink: 0;
}

.chart-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chart-modal-close {
    color: #aaa;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 20px;
    line-height: 1;
    z-index: 1001;
}

.chart-modal-close:hover,
.chart-modal-close:focus {
    color: #000;
    text-decoration: none;
}

.file-list-modal-close {
    color: #aaa;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 20px;
    line-height: 1;
    z-index: 1001;
}

.file-list-modal-close:hover,
.file-list-modal-close:focus {
    color: #000;
    text-decoration: none;
}

#stock-chart-container {
    flex: 3;
    width: 100%;
    min-height: 0;
    position: relative;
    border-bottom: 2px solid #e2e8f0;
}

#volume-chart-container {
    flex: 1;
    width: 100%;
    min-height: 0;
    position: relative;
    margin-top: 10px;
}

/* 반응형 */
@media (max-width: 768px) {
    .market-indicators {
        grid-template-columns: 1fr;
    }
    
    .sub-nav {
        flex-direction: column;
    }
    
    .sub-nav-btn {
        width: 100%;
    }
    
    .chart-modal-content {
        width: 95%;
        margin: 10% auto;
    }
}

/* Footer 스타일 */
footer {
    background: white;
    border-radius: 12px;
    padding: 20px 30px;
    margin-top: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
}

footer p {
    margin: 0;
    color: #718096;
    font-size: 14px;
}

/* 드래그 앤 드롭 영역 스타일 */
.drag-drop-area {
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    background: #ffffff;
    transition: all 0.3s ease;
    cursor: pointer;
}

.drag-drop-area:hover {
    border-color: #667eea;
    background: #f7fafc;
}

.drag-drop-area.drag-over {
    border-color: #667eea;
    background: #edf2f7;
    border-style: solid;
    transform: scale(1.02);
}

.drag-drop-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.drag-drop-icon {
    font-size: 48px;
    opacity: 0.7;
}

.drag-drop-text {
    color: #4a5568;
    font-size: 14px;
}

.drag-drop-text strong {
    color: #2d3748;
    font-size: 16px;
}

