/* static/css/theme_modal.css */

/* ── Theme Modal ── */
.theme-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.theme-modal.hidden {
    display: none;
}

/* Overlay */
.theme-modal .modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 0;
}

/* Card */
.theme-modal .modal-card {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header & Close (reuse stock-modal styles) */
.theme-modal .modal-header { /* same as stock-modal */
}

.theme-modal .modal-close { /* same as stock-modal */
}

/* ── 통계 영역 ── */
.theme-modal .modal-stats {
    display: flex;
    gap: 16px;
    padding: 16px 24px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
}

.theme-modal .modal-stats .stat-item {
    flex: 1;
    background: #fff;
    padding: 12px;
    border-radius: 6px;
    text-align: center;
}

.theme-modal .modal-stats .stat-label {
    font-size: 0.85rem;
    color: #777;
    margin-bottom: 4px;
}

.theme-modal .modal-stats .stat-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333d4b;
}

.theme-modal .modal-stats .stat-value.positive {
    color: #e71909;
}

.theme-modal .modal-stats .stat-value.negative {
    color: #115bcb;
}

/* ── Tabs ── */
.theme-modal .modal-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin: 0 24px;
    flex-shrink: 0;
}

.theme-modal .tab-btn {
    flex: 1;
    padding: 12px 0;
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    border-bottom: 3px solid transparent;
}

.theme-modal .tab-btn.active {
    color: #333d4b;
    border-bottom-color: rgba(51, 61, 75, 0.7);
    font-weight: 600;
}

/* ── Tab Panels ── */
.theme-modal .tab-panel {
    flex: 1;
    padding: 16px 24px;
    overflow-y: auto;
}

.theme-modal .tab-panel.hidden {
    display: none;
}

.theme-modal .issue-card {
    position: relative;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    padding: 12px;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
}

.theme-modal .issue-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.theme-modal .hc-date {
    font-size: 0.8rem;
    color: #999;
    margin-bottom: 8px;
}

.theme-modal .hc-comment {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 12px;
}

.theme-modal .hc-stocks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.theme-modal .hc-stock-btn {
    background: #f5f5f5;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.2s;
}

.theme-modal .hc-stock-btn:hover {
    background: #e0e0e0;
}

.theme-modal .hc-stock-btn .stock-name {
    color: #333;
}

.theme-modal .hc-stock-btn .hc-change {
    font-weight: 700;
}

.theme-modal .hc-stock-btn .hc-change.positive {
    color: #e71909;
}

.theme-modal .hc-stock-btn .hc-change.negative {
    color: #115bcb;
}


.theme-modal .stock-card {
    position: relative;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    padding: 12px;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
}

.theme-modal .stock-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

/* 첫 줄: 종목명과 등락률 */
.theme-modal .stock-card .sc-line1 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.theme-modal .stock-card .sc-name {
    font-size: 1rem;
    font-weight: 600;
    color: #333d4b;
}

.theme-modal .stock-card .sc-change {
    font-size: 1.1rem;
    font-weight: 700;
}

.theme-modal .stock-card .sc-change.positive {
    color: #e71909;
}

.theme-modal .stock-card .sc-change.negative {
    color: #115bcb;
}

/* 둘째 줄: 코드와 거래대금 */
.theme-modal .stock-card .sc-line2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #777;
}

.theme-modal .stock-card .sc-code {
}

.theme-modal .stock-card .sc-value {
}

/* ── Related Stocks: 2줄 레이아웃 수정 ── */
.theme-modal .stock-card .sc-line1,
.theme-modal .stock-card .sc-line2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

/* 혹시 버튼이나 부모가 text-align:center 여서 중앙 정렬되면 해제 */
.theme-modal .stock-card {
    text-align: left;
}

.theme-modal .sort-btn {
    flex: none;
    padding: 4px 12px;
    border: none;
    background: #f5f5f5;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s, color 0.2s;
}

.theme-modal .sort-btn.active {
    background: #333d4b;
    color: #fff;
}

/* 카드에 테두리 추가 */
.theme-modal .issue-card,
.theme-modal .stock-card {
    border: 1px solid #ddd;
}

/* hover 시 강조색으로 변경 */
.theme-modal .issue-card:hover,
.theme-modal .stock-card:hover {
    border-color: #ccc;
}

@media (min-width: 1023px) {
    /* ── Issue Cards ── */
    .theme-modal .issue-cards {
        display: flex;
        flex-direction: column;
        gap: 16px;
        padding: 0 24px;
    }

    /* ── Related Stocks ── */
    .theme-modal .stock-cards {
        display: flex;
        flex-direction: column;
        gap: 16px;
        padding: 0 24px;
    }

  .theme-modal .stock-sort-toggle {
      display: flex;
      gap: 8px;
      padding: 0 24px 8px;
  }

}

@media (max-width: 1023px) {
    /* ── Issue Cards ── */
    .theme-modal .issue-cards {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    /* ── Related Stocks ── */
    .theme-modal .stock-cards {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

  .theme-modal .stock-sort-toggle {
      display: flex;
      gap: 8px;
      padding-bottom: 8px;
  }
  .theme-modal .modal-stats .stat-value {
    font-size: 1rem;
  }
  .theme-modal .tab-btn {
    font-size: 0.85rem;
  }
}