/* Minimal modern theme overrides */
:root{
  --brand:#0d6efd;
  --bg:#f8f9fa;
}
/* 모바일 전역 최적화 */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body{
  background:var(--bg);
  font-family:Inter, 'Noto Sans KR', Arial, sans-serif;
  color:#222;
  margin:0;
  padding:0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* iOS safe area 지원 */
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
#app_name{font-weight:700;padding:16px 24px;color:var(--brand);}
.navbar-brand{font-weight:700}
.card-modern{border-radius:12px;box-shadow:0 6px 18px rgba(13,110,253,0.08)}
/* 터치 타겟 최소 44px 보장 */
.nav-link, button, .btn, a {
  min-height: 44px;
}
.nav-tabs .nav-link, .nav-pills .nav-link {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* 네비게이션바 안전 영역 */
.navbar {
  padding-top: max(8px, env(safe-area-inset-top));
}


/* Custom Tab Style */
.nav-tabs {
    border-bottom: 2px solid #dee2e6;
}
.nav-tabs .nav-link {
    border: none;
    color: #666;
    font-weight: 500;
    padding: 10px 20px;
    margin-bottom: -2px;
}
.nav-tabs .nav-link:hover {
    border: none;
    color: var(--brand);
}
.nav-tabs .nav-link.active {
    border: none;
    border-bottom: 3px solid var(--brand) !important;
    color: var(--brand) !important;
    font-weight: 700;
    background-color: transparent !important;
}
.grid-menu .nav-link{padding:12px 16px}
footer.site-footer{padding:24px 0;text-align:center;color:#666}

.table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}

/* Modern Table Styles */
.modern-table-container {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
}
.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.modern-table thead th {
    background: #f8f9fa;
    color: #495057;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 12px 15px;
    border-bottom: 2px solid #dee2e6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
/* Bootstrap reset override for HTML align attribute */
th[align="right"], td[align="right"] { text-align: right !important; }
th[align="center"], td[align="center"] { text-align: center !important; }
th[align="left"], td[align="left"] { text-align: left !important; }

.modern-table tbody td {
    padding: 12px 15px;
    border-bottom: 1px solid #f1f3f5;
    font-size: 0.9rem;
    color: #343a40;
    vertical-align: middle;
}
.modern-table tbody tr:last-child td {
    border-bottom: none;
}
.modern-table tbody tr:hover {
    background-color: #f8f9fa;
}
.modern-table .nav-col {
    width: 40px;
    text-align: center;
    background: #fdfdfd;
    cursor: pointer;
    transition: background 0.2s;
}
.modern-table .nav-col:hover {
    background: #f1f3f5;
}
.modern-table .nav-col img {
    opacity: 0.6;
    width: 16px;
}
.modern-table .positive-val { color: #d63301; font-weight: 600; }
.modern-table .negative-val { color: #0d6efd; font-weight: 600; }
.modern-table .neutral-val { color: #6c757d; }

.modern-table-title {
    padding: 15px 20px;
    font-weight: 700;
    font-size: 1.1rem;
    color: #212529;
    border-bottom: 1px solid #eee;
    background: #fff;
}

@media (max-width:576px){
  #app_name{font-size:1.1rem;padding:12px}
  .modern-table tbody td, .modern-table thead th {
    padding: 8px 6px;
    font-size: 0.78rem;
  }
  /* 모바일에서 컨테이너 패딩 최소화 */
  .container {
    padding-left: 8px;
    padding-right: 8px;
  }
  /* main padding 줄이기 */
  main.container {
    margin-top: 0.75rem !important;
    margin-bottom: 0.75rem !important;
  }
  /* 탭 폰트 크기 줄이기 */
  .nav-tabs .nav-link {
    padding: 8px 10px;
    font-size: 0.85rem;
  }
  /* 테이블 컨테이너 border-radius 줄이기 */
  .modern-table-container {
    border-radius: 8px;
    margin-bottom: 12px;
  }
  /* 테이블 제목 패딩 */
  .modern-table-title {
    padding: 10px 12px;
    font-size: 0.95rem;
  }
  /* 네비게이션바 브랜드 폰트 */
  .navbar-brand {
    font-size: 1.1rem;
  }
  /* 카드 패딩 줄이기 */
  .card {
    border-radius: 8px !important;
  }
  /* 누적수익률 display-4 크기 줄이기 */
  .display-4 {
    font-size: 2rem !important;
  }
  /* 아코디언 패딩 줄이기 */
  .modern-accordion-header {
    padding: 14px 14px;
  }
  .modern-accordion-content {
    padding: 14px;
  }
  /* QnA 리스트 패딩 */
  .modern-list-item {
    padding: 14px 14px !important;
  }
  /* 소개 그리드 */
  div.intro_grid, div.subscribe_grid {
    grid-template-columns: 70px 1fr;
  }
}

/* Modern Accordion (Notice, FAQ) */
.modern-accordion {
    border: none;
    background: transparent;
}
.modern-accordion-item {
    background: #fff;
    border-radius: 12px !important;
    border: 1px solid #f1f3f5;
    margin-bottom: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
    overflow: hidden;
    transition: all 0.2s;
}
.modern-accordion-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.modern-accordion-header {
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: #fff;
}
.modern-accordion-title {
    font-weight: 600;
    color: #333;
    font-size: 1rem;
    flex-grow: 1;
}
.modern-accordion-date {
    font-size: 0.8rem;
    color: #adb5bd;
    margin-left: 15px;
    white-space: nowrap;
}
.modern-accordion-icon {
    width: 20px;
    height: 20px;
    margin-left: 15px;
    transition: transform 0.3s;
    opacity: 0.4;
}
.modern-accordion-item.open .modern-accordion-icon {
    transform: rotate(180deg);
}
.modern-accordion-content {
    display: none;
    padding: 20px;
    background: #fdfdfd;
    border-top: 1px solid #f8f9fa;
    color: #555;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Modern List Group (Q&A) */
.modern-list-group {
    background: transparent;
}
.modern-list-item {
    background: #fff;
    border-radius: 12px !important;
    border: 1px solid #f1f3f5 !important;
    margin-bottom: 12px;
    padding: 18px 20px !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
    transition: all 0.2s;
}
.modern-list-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    background-color: #fff !important;
}
.modern-list-item h5 {
    color: #333;
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 8px;
}
.modern-list-meta {
    font-size: 0.85rem;
    color: #868e96;
}
.modern-list-reply-count {
    display: inline-block;
    background: #e9ecef;
    color: #495057;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.8rem;
    margin-right: 8px;
}

/* ── 변동점 뱃지 & 툴팁 ─────────────────────────── */
.change-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 4px;
    border-radius: 50%;
    background-color: #fd7e14;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    flex-shrink: 0;
    user-select: none;
    -webkit-user-select: none;
    transition: background-color 0.15s;
}
.change-badge:hover {
    background-color: #e76000;
}

/* 툴팁 말풍선 */
.change-tooltip {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    background: #212529;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.5;
    padding: 6px 10px;
    border-radius: 8px;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    pointer-events: none;
    animation: tooltipFadeIn 0.15s ease;
}
/* 말풍선 꼭지 */
.change-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom-color: #212529;
}
/* 테이블 끝부분에서 왼쪽으로 넘어가지 않도록 보정 */
.change-tooltip.tip-left {
    left: 0;
    transform: translateX(-80%);
}
.change-tooltip.tip-left::before {
    left: 80%;
}

@keyframes tooltipFadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-4px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
