/* Base Variables */
:root {
    --primary-color: #1e3a8a;
    --secondary-color: #3b82f6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    --light-color: #f8fafc;
    --dark-color: #1f2937;
    --text-color: #374151;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
}

/* Global Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #f8fafc;
}

/* 광고 영역 스타일 */
.ad-placeholder {
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 8px;
    background: linear-gradient(45deg, #f8f9fa 25%, transparent 25%),
                linear-gradient(-45deg, #f8f9fa 25%, transparent 25%),
                linear-gradient(45deg, transparent 75%, #f8f9fa 75%),
                linear-gradient(-45deg, transparent 75%, #f8f9fa 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.ad-placeholder:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.top-ad-banner {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sidebar-ad, .right-sidebar-ad {
    position: sticky;
    top: 100px;
}

.content-top-ad, .content-bottom-ad {
    margin: 2rem 0;
}

.inline-ad-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.detail-ad-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.sidebar-detail-ad {
    background: #fff;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Header Styles */
.page-header,
.dashboard-header,
.etf-list-header,
.calendar-header,
.admin-header,
.service-header,
.guide-header,
.detail-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #3b82f6 100%);
    color: white;
    padding: 2rem 0;
    padding-top: calc(2rem + 80px);
}

.service-header {
    padding: 3rem 0;
    padding-top: calc(3rem + 80px);
}

/* 404 Page Styles */
.error-container {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-icon {
    font-size: 120px;
    color: #6c757d;
    margin-bottom: 30px;
}

/* About Page Styles */
.feature-card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    height: 100%;
}

.feature-card:hover {
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.feature-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2rem;
    color: white;
}

.content-section {
    padding: 2rem 0;
}

.highlight-box {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-left: 4px solid #3b82f6;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
}

/* Dashboard Styles */
.dashboard-card {
    transition: transform 0.3s ease;
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.dashboard-card:hover {
    transform: translateY(-2px);
}

.metric-card {
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.metric-card:hover {
    transform: translateY(-2px);
}

.metric-card h3 {
    font-size: 2.5rem !important;
    font-weight: bold !important;
    color: #007bff !important;
    margin-bottom: 0.5rem !important;
    display: block !important;
    visibility: visible !important;
}

/* Summary Cards 개별 색상 및 크기 설정 - 배경색과 하얀 글자 */
.metric-card-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
    color: white !important;
}

.metric-card-success .card-body,
.metric-card-success p,
.metric-card-success .fas {
    color: white !important;
}

.metric-card-primary {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%) !important;
    color: white !important;
}

.metric-card-primary .card-body,
.metric-card-primary p,
.metric-card-primary .fas {
    color: white !important;
}

.metric-card-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%) !important;
    color: white !important;
}

.metric-card-danger .card-body,
.metric-card-danger p,
.metric-card-danger .fas {
    color: white !important;
}

.metric-card-warning {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%) !important;
    color: white !important;
}

.metric-card-warning .card-body,
.metric-card-warning p,
.metric-card-warning .fas {
    color: white !important;
}

#total-etfs,
#avg-stock-yield,
#avg-dividend-yield,
#recent-distributions {
    font-size: 2.8rem !important;
    font-weight: 900 !important;
    color: white !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* 총 ETF 수 카드 - 초록색 배경 */
.metric-card:has(#total-etfs) {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
    color: white !important;
}

.metric-card:has(#total-etfs) .card-body,
.metric-card:has(#total-etfs) p {
    color: white !important;
}

#avg-stock-yield {
    font-size: 2.8rem !important;
    font-weight: 900 !important;
    color: white !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* 평균 주가 수익률 카드 - 파란색 배경 */
.metric-card:has(#avg-stock-yield) {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%) !important;
    color: white !important;
}

.metric-card:has(#avg-stock-yield) .card-body,
.metric-card:has(#avg-stock-yield) p {
    color: white !important;
}

#avg-dividend-yield {
    font-size: 2.8rem !important;
    font-weight: 900 !important;
    color: white !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* 평균 연 분배 수익률 카드 - 빨간색 배경 */
.metric-card:has(#avg-dividend-yield) {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%) !important;
    color: white !important;
}

.metric-card:has(#avg-dividend-yield) .card-body,
.metric-card:has(#avg-dividend-yield) p {
    color: white !important;
}

#recent-distributions {
    font-size: 2.8rem !important;
    font-weight: 900 !important;
    color: white !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* 최근 분배 카드 - 노란색 배경 */
.metric-card:has(#recent-distributions) {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%) !important;
    color: white !important;
}

.metric-card:has(#recent-distributions) .card-body,
.metric-card:has(#recent-distributions) p {
    color: white !important;
}

/* 아이콘도 하얀색으로 변경 */
.metric-card .fas {
    color: white !important;
}

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

/* ETF List Styles */
.modern-card {
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.modern-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.filter-card {
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* sortable 테이블 헤더에 화살표 표시 */
.sortable th {
    cursor: pointer;
}
.sortable th.asc::after {
    content: ' ▲';
}
.sortable th.desc::after {
    content: ' ▼';
}

.view-toggle {
    transition: all 0.3s ease;
}

.view-toggle.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border-color: transparent !important;
}

/* ETF Detail Styles */
.metric-card {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    height: 100%;
    border: none;
}

.metric-card:hover {
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.metric-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 1.5rem;
    color: white;
}

.metric-content h3 {
    color: #2563eb;
    font-weight: 700;
    margin-bottom: 5px;
    font-size: 1.25rem;
}

.metric-content p {
    color: #6b7280;
    margin: 0;
    font-size: 0.875rem;
}

.info-card {
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border-radius: 15px;
}

.info-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e5e7eb;
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
}

.timeline-marker {
    position: absolute;
    left: -25px;
    top: 5px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 0 2px;
}

.timeline-content h6 {
    font-weight: 600;
    margin-bottom: 5px;
    color: #374151;
}

.timeline-content p {
    margin-bottom: 5px;
    color: #6b7280;
}

.adsense-box {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    color: #6c757d;
}

.yield-positive {
    color: #dc3545;
    font-weight: bold;
}

.yield-negative {
    color: #198754;
    font-weight: bold;
}

/* Calendar Styles */
.calendar-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 2rem;
    color: white;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.nav-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.calendar-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    overflow: hidden;
}

.calendar-day-header {
    background: rgba(255,255,255,0.2);
    padding: 0.75rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.calendar-day {
    background: rgba(255,255,255,0.1);
    min-height: 80px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
}

.calendar-day:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

.calendar-day.today {
    background: rgba(255,255,255,0.3);
    box-shadow: inset 0 0 0 2px #ffd700;
}

.calendar-day.has-events {
    background: rgba(46, 204, 113, 0.3);
}

.calendar-day.other-month {
    opacity: 0.3;
}

.day-number {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.event-indicator {
    width: 6px;
    height: 6px;
    background: #e74c3c;
    border-radius: 50%;
    margin: 1px;
    animation: pulse 2s infinite;
}

.event-details {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    color: #333;
    padding: 0.5rem;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    z-index: 1000;
    display: none;
    max-height: 200px;
    overflow-y: auto;
}

.calendar-day:hover .event-details {
    display: block;
}

.event-item {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    margin: 0.125rem 0;
    border-radius: 4px;
    background: rgba(0,0,0,0.1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-container {
    max-height: 500px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.timeline-item {
    background: white;
    border-radius: 15px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.timeline-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transform: translateY(-2px);
}

/* Admin Styles */
.admin-log-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    max-height: 400px;
    overflow-y: auto;
}

/* Compare Styles */
.compare-table th,
.compare-table td {
    vertical-align: middle;
    text-align: center;
}

.compare-table th:first-child,
.compare-table td:first-child {
    text-align: left;
    font-weight: 600;
}

/* Horizontal Timeline Styles */
.timeline-horizontal {
    position: relative;
    display: flex;
    overflow-x: auto;
    padding: 2rem 0;
    gap: 2rem;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 #f7fafc;
}

.timeline-horizontal::-webkit-scrollbar {
    height: 8px;
}

.timeline-horizontal::-webkit-scrollbar-track {
    background: #f7fafc;
    border-radius: 4px;
}

.timeline-horizontal::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

.timeline-horizontal::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.timeline-horizontal::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(to right, #e5e7eb 0%, #3b82f6 50%, #e5e7eb 100%);
    transform: translateY(-50%);
    z-index: 1;
}

.timeline-item-horizontal {
    position: relative;
    min-width: 200px;
    flex-shrink: 0;
    text-align: center;
    z-index: 2;
}

.timeline-marker-horizontal {
    position: relative;
    width: 20px;
    height: 20px;
    background: #3b82f6;
    border: 3px solid white;
    border-radius: 50%;
    margin: 0 auto 1rem;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    z-index: 3;
}

.timeline-content-horizontal {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.timeline-content-horizontal:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.timeline-content-horizontal h6 {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.timeline-content-horizontal p {
    margin-bottom: 0.25rem;
    color: #6b7280;
    font-size: 0.85rem;
}

.timeline-content-horizontal .amount {
    color: #10b981;
    font-weight: 600;
}

.timeline-content-horizontal .yield {
    color: #3b82f6;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .page-header,
    .dashboard-header,
    .etf-list-header,
    .calendar-header,
    .admin-header,
    .service-header,
    .guide-header,
    .detail-header {
        padding: 1.5rem 0;
        padding-top: calc(1.5rem + 80px);
    }
    
    .feature-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .calendar-container {
        padding: 1rem;
    }
    
    .calendar-grid {
        grid-template-columns: repeat(7, 1fr);
        gap: 0.5px;
    }
    
    .calendar-day {
        min-height: 60px;
        padding: 0.25rem;
    }

    .timeline-item-horizontal {
        min-width: 160px;
    }

    .timeline-content-horizontal {
        padding: 0.75rem;
    }

    .timeline-content-horizontal h6 {
        font-size: 0.8rem;
    }

    .timeline-content-horizontal p {
        font-size: 0.75rem;
    }
}

/* Animations */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* Utility Classes */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shadow-sm {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.shadow {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.shadow-lg {
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.border-radius-lg {
    border-radius: 12px;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.bg-gradient-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.bg-gradient-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.bg-gradient-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

/* Index.html 스타일 추가 */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, #3b82f6 100%) !important;
    color: white !important;
    padding: 80px 0 !important;
    padding-top: 160px !important;
    min-height: 400px;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, #3b82f6 100%);
    z-index: -1;
}

.feature-card {
    transition: transform 0.3s ease;
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.feature-card:hover {
    transform: translateY(-5px);
}

.etf-card {
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
}

.etf-card:hover {
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.stats-section {
    background-color: #f8f9fa;
    padding: 60px 0;
}

/* 추가 index 페이지 스타일 */
.hero-section .display-4 {
    font-size: 3.5rem;
    line-height: 1.2;
}

.hero-section .lead {
    font-size: 1.25rem;
    font-weight: 300;
}

.hero-section .btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
    border-radius: 50px;
}

.hero-section .fas {
    opacity: 0.3;
}

.feature-card .fas {
    color: #667eea;
}

.etf-card .badge {
    font-size: 0.75rem;
}

.etf-card .card-footer {
    background-color: transparent;
    border-top: 1px solid rgba(0,0,0,0.125);
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .hero-section {
        padding: 60px 0;
        padding-top: 120px;
    }

    .hero-section .display-4 {
        font-size: 2.5rem;
    }

    .hero-section .fas {
        font-size: 120px !important;
    }

    .hero-section .d-flex {
        flex-direction: column;
        gap: 1rem;
    }

    .hero-section .btn-lg {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .sidebar-ad, .right-sidebar-ad {
        display: none !important;
    }

    .ad-placeholder {
        height: auto !important;
        min-height: 120px;
        writing-mode: initial !important;
        text-orientation: initial !important;
    }

    .top-ad-banner .ad-placeholder {
        height: 60px !important;
        font-size: 0.8rem;
    }
}