/* 기본 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f0f4ff 0%, #f5f0ff 25%, #fff0f5 50%, #fff5f0 75%, #f0fff5 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: #333;
}

/* 모든 애니메이션과 트랜지션 제거 */
*, *::before, *::after {
    animation: none !important;
    transition: none !important;
}

/* 상단 네비게이션 */
.top-nav {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 60px;
}

.nav-brand {
    display: flex;
    align-items: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

.nav-brand i {
    margin-right: 8px;
    color: #666;
}

.nav-menu {
    display: flex;
    gap: 0;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 16px;
    text-decoration: none;
    color: #666;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    min-width: 80px;
}

.nav-item:hover {
    color: #333;
    background: rgba(0, 0, 0, 0.05);
}

.nav-item.active {
    color: #333;
    border-bottom-color: #333;
    background: rgba(0, 0, 0, 0.05);
}

.nav-item i {
    font-size: 1.1rem;
    margin-bottom: 2px;
}

.nav-item span {
    font-size: 0.8rem;
    font-weight: 500;
}

@media (max-width: 768px) {
    .nav-container {
        padding: 0 10px;
    }
    
    .nav-item {
        padding: 6px 8px;
        min-width: 60px;
    }
    
    .nav-item span {
        font-size: 0.7rem;
    }
    
    .nav-item i {
        font-size: 1rem;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 헤더 스타일 */
header {
    text-align: center;
    margin-bottom: 15px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header h1 i {
    margin-right: 15px;
    color: #ffd700;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 데모 알림 */
.demo-notice {
    background: rgba(255, 193, 7, 0.2);
    border: 2px solid #ffc107;
    color: #856404;
    padding: 12px 20px;
    border-radius: 10px;
    margin-top: 15px;
    display: inline-flex;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 500;
    animation: pulse 2s infinite;
}

.demo-notice i {
    margin-right: 10px;
    font-size: 1.1rem;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

@keyframes pulse-dot {
    0% { 
        opacity: 1; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.5; 
        transform: scale(1.2);
    }
    100% { 
        opacity: 1; 
        transform: scale(1);
    }
}

/* 자동 갱신 상태 표시 */
.auto-update-status {
    transition: all 0.3s ease;
}

.auto-update-status .pulse-dot {
    animation: pulse-dot 1.5s infinite;
}

/* 섹터 카드 기본 스타일 - 애니메이션 제거됨 */

/* 데이터 변경 하이라이트 */
.stock-change.positive.changed {
    background: #c8e6c9;
    animation: highlight-positive 0.5s ease;
}

.stock-change.negative.changed {
    background: #ffcdd2;
    animation: highlight-negative 0.5s ease;
}

@keyframes highlight-positive {
    0% { background: #4caf50; color: white; }
    100% { background: #c8e6c9; color: #2e7d32; }
}

@keyframes highlight-negative {
    0% { background: #f44336; color: white; }
    100% { background: #ffcdd2; color: #c62828; }
}

/* 섹터 그리드 */
.sector-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

/* 섹터 카드 */
.sector-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    border: 2px solid transparent;
}

.sector-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    border-color: #ddd;
}

/* 섹터 헤더 */
.sector-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.sector-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: linear-gradient(135deg, #ff7043 0%, #ff5722 100%);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #e64a19;
    box-shadow: 0 2px 4px rgba(255, 112, 67, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.sector-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sector-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.sector-title h3 {
    font-size: 1.1rem;
    color: #ffffff;
    font-weight: 600;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.sector-stats {
    text-align: right;
}

.sector-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
    background: #f8f8f8;
    padding: 4px 10px;
    border-radius: 6px;
}

.sector-value.positive {
    color: #e74c3c;
    background: #f8f8f8;
}

.sector-value.negative {
    color: #1976d2;
    background: #f8f8f8;
}

/* 섹터 뉴스 */
.sector-news {
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #999;
}

.sector-news p {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
    line-height: 1.4;
}

/* 섹터 내 주식 목록 */
.sector-stocks {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sector-stock-item {
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    gap: 4px;
}

.sector-stock-item:hover {
    background: #e9ecef;
    border-color: #ccc;
    transform: translateX(5px);
}

.stock-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.stock-name {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
    display: flex;
    align-items: center;
    gap: 5px;
}

.stock-trading-value-row {
    width: 100%;
    font-size: 0.7rem;
    color: #999;
    font-weight: 400;
    text-align: right;
}

.stock-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.1);
    color: #666;
    font-size: 0.75rem;
    font-weight: 500;
    margin-right: 8px;
    flex-shrink: 0;
}

.stock-name-text {
    flex: 1;
}

.stock-change-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stock-trading-value {
    font-size: 0.7rem;
    color: #999;
    font-weight: 400;
}

.stock-trading-value-inline {
    font-size: 0.7rem;
    color: #999;
    font-weight: 400;
    margin-left: 8px;
}

.stock-change-bar-container {
    width: 100%;
    height: 8px;
    background-color: #f0f0f0;
    border-radius: 4px;
    position: relative;
    margin: 4px 0;
    overflow: hidden;
}

.stock-change-bar-center {
    position: absolute;
    left: 50%;
    top: 0;
    width: 1px;
    height: 100%;
    background-color: #ddd;
    transform: translateX(-50%);
}

.stock-change-bar {
    height: 100%;
    position: absolute;
    top: 0;
    border-radius: 2px;
}

.stock-change-bar.positive {
    background-color: #e74c3c;
}

.stock-change-bar.negative {
    background-color: #1976d2;
}

.highlight {
    background: #ffc107;
    color: #333;
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

.stock-change {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    min-width: 60px;
    text-align: center;
}

.stock-change.positive {
    color: #e74c3c;
    background: #fdf2f2;
}

.stock-change.negative {
    color: #1976d2;
    background: #e3f2fd;
}

.stock-price {
    font-size: 0.8rem;
    color: #666;
    min-width: 80px;
    text-align: right;
}

.stock-volume {
    font-size: 0.8rem;
    color: #666;
    min-width: 60px;
    text-align: right;
}

/* 빈 섹터 */
.empty-sector {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

/* 주식 그리드 (기존 스타일 유지) */
.stock-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

/* 주식 카드 */
.stock-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
}

.stock-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    border-color: #ddd;
}

.stock-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.stock-header h3 {
    font-size: 1.2rem;
    color: #333;
    font-weight: 600;
}

.stock-code {
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #666;
    font-weight: 500;
}

.stock-price {
    margin-bottom: 15px;
}

.current-price {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.price-change {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
}

.price-change.positive {
    color: #e74c3c;
    background: #fdf2f2;
}

.price-change.negative {
    color: #27ae60;
    background: #f0f9f0;
}

.stock-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.info-item {
    text-align: center;
    flex: 1;
}

.info-item .label {
    display: block;
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 4px;
}

.info-item .value {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
}

.stock-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #666;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.market {
    background: #e3f2fd;
    padding: 2px 6px;
    border-radius: 4px;
    color: #1976d2;
}

/* 새로고침 섹션 */
.refresh-section {
    text-align: center;
    color: white;
}

.refresh-btn {
    background: rgba(255,255,255,0.2);
    border: 2px solid white;
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    margin-bottom: 10px;
}

.refresh-btn:hover {
    background: white;
    color: #333;
    transform: scale(1.05);
}

.refresh-btn i {
    margin-right: 8px;
}

.last-update {
    font-size: 0.9rem;
    opacity: 0.8;
}

.refresh-status {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 5px;
}

/* 에러 메시지 */
.error-message {
    grid-column: 1 / -1;
    text-align: center;
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.error-message i {
    font-size: 3rem;
    color: #e74c3c;
    margin-bottom: 20px;
}

.error-message p {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 10px;
}

/* 모달 스타일 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    background: linear-gradient(135deg, #666 0%, #555 100%);
    color: white;
    padding: 20px;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.close:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 30px;
}

/* 상세 정보 스타일 */
.detail-section {
    margin-bottom: 25px;
}

.detail-section h3 {
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #999;
    font-size: 1.2rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.detail-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #999;
}

.detail-item .label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
}

.detail-item .value {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

/* 차트 영역 */
.chart-container {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
    text-align: center;
}

.chart-placeholder {
    height: 200px;
    background: linear-gradient(45deg, #e3f2fd, #f3e5f5);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 1.1rem;
}

/* 반응형 디자인 */
@media (max-width: 1024px) {
    .sector-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .sector-card {
        padding: 16px;
    }

    .sector-title h3 {
        font-size: 1rem;
    }

    .sector-value {
        font-size: 1.1rem;
    }

    .sector-news p {
        font-size: 0.85rem;
    }

    .stock-name {
        font-size: 0.85rem;
    }

    .stock-change {
        font-size: 0.75rem;
        min-width: 55px;
    }

    .stock-price, .stock-volume {
        font-size: 0.75rem;
        min-width: 70px;
    }

    .sector-stock-item {
        padding: 7px 10px;
    }
    
    .stock-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .sector-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .sector-card {
        padding: 12px;
    }

    .sector-title h3 {
        font-size: 0.9rem;
    }

    .sector-value {
        font-size: 1rem;
    }

    .sector-news p {
        font-size: 0.8rem;
    }

    .stock-name {
        font-size: 0.8rem;
    }

    .stock-change {
        font-size: 0.7rem;
        min-width: 50px;
    }

    .stock-price, .stock-volume {
        font-size: 0.7rem;
        min-width: 50px;
    }

    .sector-stock-item {
        padding: 6px 8px;
    }
    
    .stock-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .stock-card {
        padding: 15px;
    }
    
    .stock-header h3 {
        font-size: 1rem;
    }
    
    .current-price {
        font-size: 1.3rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .sector-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .sector-card {
        padding: 10px;
    }

    .sector-title h3 {
        font-size: 0.8rem;
    }

    .sector-value {
        font-size: 0.9rem;
    }

    .sector-news p {
        font-size: 0.7rem;
    }

    .stock-name {
        font-size: 0.7rem;
    }

    .stock-change {
        font-size: 0.6rem;
        min-width: 45px;
    }

    .stock-price, .stock-volume {
        font-size: 0.6rem;
        min-width: 45px;
    }

    .sector-stock-item {
        padding: 4px 6px;
    }
    
    .stock-grid {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .stock-card {
        padding: 12px;
    }
    
    .stock-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .info-item {
        text-align: left;
    }
}

/* 로딩 애니메이션 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #666;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 스크롤바 스타일 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #999;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #777;
}


.top100-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    margin-top: 24px;
}

.top100-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 16px 18px;
    border: 1px solid #e5e5e5;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.top100-header h2 {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 600;
}

.top100-subtitle {
    margin: 0;
    font-size: 13px;
    color: #666;
}

.top100-table-wrap {
    margin-top: 10px;
    max-height: 480px;   /* 필요시 카드 내부 스크롤 */
    overflow-y: auto;
}

.top100-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.top100-table thead {
    position: sticky;
    top: 0;
    background-color: #f5f5f7;
    z-index: 1;
}

.top100-table th,
.top100-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #e5e5e5;
    text-align: right;
}

.top100-table th:nth-child(2),
.top100-table td:nth-child(2),
.top100-table th:nth-child(3),
.top100-table td:nth-child(3),
.top100-table th:nth-child(4),
.top100-table td:nth-child(4) {
    text-align: left;
}

.top100-table tbody tr:hover {
    background-color: #f9fafb;
}

.top100-table td.tv-cell {
    font-weight: 600;
}
