/* ==========================================================
   followup.css - 연계 출현 (후속수) 분석 전용 스타일시트
   ========================================================== */

.followup-title-area {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ==========================================================
   좌/우 2분할 레이아웃 (좌측: 번호선택, 우측: 요약 및 분석결과)
   ========================================================== */
.followup-split-layout {
  display: grid;
  grid-template-columns: 560px 1fr;
  gap: 24px;
  align-items: start; /* 우측 목록이 길어져도 좌측 영역이 늘어나지 않음 */
  width: 100%;
}

@media (max-width: 1350px) {
  .followup-split-layout {
    grid-template-columns: 500px 1fr;
    gap: 20px;
  }
}

@media (max-width: 1150px) {
  .followup-split-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

/* [좌측 독립 카드] 우측 목록 길이에 영향받지 않고 자체 높이 유지 */
.followup-left-card {
  align-self: start;
  height: fit-content;
  position: sticky;
  top: 80px;
  background: rgba(22, 29, 47, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 24px 26px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (max-width: 1150px) {
  .followup-left-card {
    position: static;
    top: auto;
  }
}

.followup-left-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
}

.followup-control-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* [우측 독립 카드] */
.followup-right-card {
  background: rgba(22, 29, 47, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.followup-right-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
}

.followup-right-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  width: 100%;
}

.followup-tab-content {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.followup-tab-content .table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  display: block;
}

.followup-control-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.followup-guide-title {
  font-size: 15px;
  font-weight: 700;
  color: #F1F5F9;
}

.followup-selected-status {
  display: flex;
  align-items: center;
}

.followup-badge {
  font-size: 12px;
  font-weight: 700;
  color: #60A5FA;
  background: rgba(59, 130, 246, 0.18);
  border: 1px solid rgba(59, 130, 246, 0.35);
  padding: 4px 10px;
  border-radius: 20px;
  width: 100%;
  text-align: center;
  box-sizing: border-box;
}

.btn-outline-clean {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94A3B8;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-outline-clean:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #FCA5A5;
}

.followup-action-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.btn-followup-reset {
  flex: 0 0 100px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94A3B8;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  white-space: nowrap;
}

.btn-followup-reset:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.45);
  color: #FCA5A5;
}

.btn-followup-search {
  flex: 1;
  background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
  color: #FFFFFF;
  border: none;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.btn-followup-search:hover {
  background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
  transform: translateY(-1px);
}

.followup-tips-box {
  background: rgba(10, 15, 30, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 12px;
}

.tips-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #F59E0B;
  margin-bottom: 3px;
}

.tips-desc {
  font-size: 11px;
  line-height: 1.5;
  color: #94A3B8;
  margin: 0;
}

/* 1~45 원형 볼 선택 그리드 (9열 5행) */
.followup-ball-picker {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 11px;
  user-select: none;
  padding: 4px 0;
}

.followup-ball-item {
  aspect-ratio: 1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  font-family: 'JetBrains Mono', 'Pretendard', sans-serif;
  cursor: pointer;
  transition: transform 0.1s ease;
  border: 2px solid transparent;
  background: #1E293B;
  color: #94A3B8;
  position: relative;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.followup-ball-item:hover {
  transform: translateY(-2px);
  background: #27354A;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

/* 당첨번호 / 보너스번호 선택 범례 */
.followup-legend-box {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px 12px;
  gap: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
}

.legend-ball {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.legend-ball.sample-win {
  background: #10B981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
  border: 1.5px solid #34D399;
}

.legend-ball.sample-bonus {
  background: #F59E0B;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.8);
  border: 1.5px solid #FCD34D;
}

.legend-label {
  font-size: 12px;
  color: #CBD5E1;
}

.legend-label strong {
  color: #F8FAFC;
}

.followup-ball-item.b-zone-1 { color: #FCD34D; }
.followup-ball-item.b-zone-2 { color: #60A5FA; }
.followup-ball-item.b-zone-3 { color: #F87171; }
.followup-ball-item.b-zone-4 { color: #CBD5E1; }
.followup-ball-item.b-zone-5 { color: #4ADE80; }

/* 1번 클릭: 당첨번호 선택 (초록색 테두리, 체크 뱃지) */
.followup-ball-item.selected,
.followup-ball-item.selected-win {
  background: rgba(16, 185, 129, 0.25) !important;
  border-color: #10B981 !important;
  color: #34D399 !important;
  box-shadow: none !important;
  transform: scale(1.05);
}

.followup-ball-item.selected::after,
.followup-ball-item.selected-win::after {
  content: '✓';
  position: absolute;
  top: -3px;
  right: -2px;
  font-size: 10px;
  background: #10B981;
  color: #042F2E;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* 2번 클릭: 보너스번호 선택 (주황/골드 테두리, + 뱃지) */
.followup-ball-item.selected-bonus {
  background: rgba(245, 158, 11, 0.25) !important;
  border-color: #F59E0B !important;
  color: #FCD34D !important;
  box-shadow: none !important;
  transform: scale(1.05);
}

.followup-ball-item.selected-bonus::after {
  content: '+';
  position: absolute;
  top: -3px;
  right: -2px;
  font-size: 12px;
  line-height: 1;
  background: #F59E0B;
  color: #451A03;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* 직접 텍스트 입력 행 */
.followup-input-direct-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.direct-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0B1120;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 4px 10px;
}

.direct-icon {
  font-size: 14px;
  opacity: 0.8;
}

.followup-text-input {
  background: transparent;
  border: none;
  color: #FFFFFF;
  font-size: 13.5px;
  min-width: 260px;
  outline: none;
}

.btn-apply-direct {
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #93C5FD;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-apply-direct:hover {
  background: rgba(59, 130, 246, 0.35);
  color: #FFFFFF;
}

.followup-tips {
  font-size: 12.5px;
  color: #94A3B8;
}

/* 2. 요약 배너 (카드 전체 너비 균등 5분할 & 동일 여백) */
.followup-summary-banner {
  background: linear-gradient(135deg, rgba(22, 34, 62, 0.85) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: 1.25fr repeat(4, 1fr);
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 960px) {
  .followup-summary-banner {
    grid-template-columns: repeat(2, 1fr);
  }
}

.summary-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 5px;
}

.summary-col.col-stat {
  align-items: center;
  text-align: center;
}

.sum-label {
  font-size: 12px;
  font-weight: 700;
  color: #94A3B8;
  letter-spacing: -0.2px;
}

.sum-balls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 26px;
}

.sum-empty-desc {
  font-size: 13px;
  color: #CBD5E1;
  font-weight: 600;
}

.sum-val {
  font-size: 17px;
  font-weight: 800;
  font-family: 'JetBrains Mono', sans-serif;
  color: #FFFFFF;
}

.highlight-val {
  color: #60A5FA;
}

.sum-top-ball {
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* 3. 뷰 전환 탭 */
.followup-view-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
}

.view-tab-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94A3B8;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-tab-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
}

.view-tab-btn.active {
  background: #2563EB;
  border-color: #3B82F6;
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.tab-count-badge {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
}

/* 4. 골든 후속수 추천 박스 */
.golden-followup-card {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.golden-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 800;
  color: #FCD34D;
}

.golden-icon {
  font-size: 16px;
}

.golden-balls-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 게이지 바 */
.rate-progress-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 180px;
}

.rate-progress-bar {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.rate-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3B82F6 0%, #10B981 100%);
  border-radius: 4px;
}

/* 테이블 열 정렬 및 너비 */
.followup-rank-table,
.followup-history-table {
  width: 100%;
}

.followup-history-table {
  min-width: 580px;
}

.followup-history-table th,
.followup-history-table td {
  white-space: nowrap;
}

.followup-history-table .draw-balls-row {
  flex-wrap: nowrap !important;
}

.followup-rank-table th, .followup-rank-table td {
  text-align: center;
  vertical-align: middle;
  padding: 10px 12px;
}

.col-rank { width: 15%; min-width: 65px; }
.col-ball { width: 25%; min-width: 90px; }
.col-freq { width: 25%; min-width: 90px; font-weight: 800; }
.col-last { width: 35%; min-width: 140px; }

.followup-history-table th, .followup-history-table td {
  text-align: center;
  vertical-align: middle;
  padding: 9px 8px;
}

.col-base-round { width: 18%; font-weight: 700; color: #60A5FA; }
.col-base-balls { width: 30%; }
.col-arrow { width: 4%; color: #94A3B8; font-size: 15px; }
.col-next-round { width: 18%; font-weight: 700; color: #34D399; }
.col-next-balls { width: 30%; }

.followup-target-highlight {
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.9) !important;
  border: 2px solid #10B981 !important;
  transform: scale(1.1);
}

.followup-target-bonus-highlight {
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.95) !important;
  border: 2px solid #F59E0B !important;
  transform: scale(1.12);
}

/* 후속수 순위 뱃지 (1, 2, 3위 프리미엄 둥근 메달 배지) */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 26px;
  padding: 0 10px;
  border-radius: 13px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.2px;
  font-family: 'JetBrains Mono', 'Pretendard', sans-serif;
  box-sizing: border-box;
}

.rank-badge.rank-1 {
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.45);
  border: 1px solid rgba(254, 243, 199, 0.4);
}

.rank-badge.rank-2 {
  background: linear-gradient(135deg, #94A3B8 0%, #64748B 100%);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(148, 163, 184, 0.35);
  border: 1px solid rgba(241, 245, 249, 0.4);
}

.rank-badge.rank-3 {
  background: linear-gradient(135deg, #B45309 0%, #78350F 100%);
  color: #FDE68A;
  box-shadow: 0 2px 8px rgba(180, 83, 9, 0.35);
  border: 1px solid rgba(253, 230, 138, 0.35);
}

.rank-badge.rank-other {
  background: rgba(255, 255, 255, 0.05);
  color: #94A3B8;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ==========================================================
   기준 끝수 선택 영역 (1~9끝, 0끝) 및 연계 끝수 순위표
   ========================================================== */
.followup-picker-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.followup-ending-section {
  padding-top: 14px;
  border-top: 1px dashed rgba(255, 255, 255, 0.12);
}

.followup-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.followup-section-title {
  font-size: 13px;
  font-weight: 800;
  color: #93C5FD;
  letter-spacing: -0.2px;
}

.legend-ball.sample-end-single {
  background: #38BDF8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.8);
  border: 1.5px solid #7DD3FC;
}

.legend-ball.sample-end-double {
  background: #EC4899;
  box-shadow: 0 0 8px rgba(236, 72, 153, 0.8);
  border: 1.5px solid #F9A8D4;
}

.followup-ending-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  user-select: none;
}

.followup-ending-item {
  height: 40px;
  border-radius: 10px;
  background: #1E293B;
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  color: #CBD5E1;
  font-size: 13.5px;
  font-weight: 800;
  font-family: 'JetBrains Mono', 'Pretendard', sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.15s ease;
}

.followup-ending-item:hover {
  background: #27354A;
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.22);
}

/* 1회 클릭: 개별 끝수 선택 (하늘색 강조) */
.followup-ending-item.selected-single {
  background: rgba(56, 189, 248, 0.22) !important;
  border-color: #38BDF8 !important;
  color: #7DD3FC !important;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4) !important;
}

.followup-ending-item.selected-single::after {
  content: '1↑';
  position: absolute;
  top: -5px;
  right: -4px;
  font-size: 9.5px;
  background: #0284C7;
  color: #FFFFFF;
  padding: 1px 4px;
  border-radius: 6px;
  font-weight: 900;
  line-height: 1.1;
}

/* 2회 클릭: 동끝(2개 이상) 선택 (핑크/마젠타 강조) */
.followup-ending-item.selected-double {
  background: rgba(236, 72, 153, 0.24) !important;
  border-color: #EC4899 !important;
  color: #F9A8D4 !important;
  box-shadow: 0 0 14px rgba(236, 72, 153, 0.5) !important;
}

.followup-ending-item.selected-double::after {
  content: '동끝';
  position: absolute;
  top: -6px;
  right: -5px;
  font-size: 9.5px;
  background: #DB2777;
  color: #FFFFFF;
  padding: 1px 5px;
  border-radius: 6px;
  font-weight: 900;
  line-height: 1.1;
}

/* 요약 배너 내 끝수 조건 칩 */
.sum-balls-row {
  flex-wrap: wrap;
}

.sum-ending-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 800;
  font-family: 'JetBrains Mono', 'Pretendard', sans-serif;
}

.sum-ending-chip.chip-single {
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid #38BDF8;
  color: #7DD3FC;
}

.sum-ending-chip.chip-double {
  background: rgba(236, 72, 153, 0.22);
  border: 1px solid #EC4899;
  color: #F9A8D4;
}

/* 연계 끝수 순위표 테이블 */
.followup-ending-rank-table {
  width: 100%;
  min-width: 640px;
}

.followup-ending-rank-table th,
.followup-ending-rank-table td {
  text-align: center;
  vertical-align: middle;
  padding: 10px 10px;
  white-space: nowrap;
}

.ending-ball-dist-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: nowrap;
}

@media (max-width: 768px) {
  .followup-left-card,
  .followup-right-card {
    padding: 16px 14px;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
  }

  .followup-view-tabs {
    flex-wrap: wrap;
    gap: 6px;
  }

  .view-tab-btn {
    flex: 1 1 auto;
    justify-content: center;
    padding: 9px 10px;
    font-size: 12.5px;
    white-space: nowrap;
  }
}

.col-e-rank { width: 10%; min-width: 60px; }
.col-e-digit { width: 13%; min-width: 75px; }
.col-e-freq { width: 20%; min-width: 120px; }
.col-e-detail { width: 39%; min-width: 240px; }
.col-e-last { width: 18%; min-width: 120px; }

.ending-digit-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #38BDF8;
  font-size: 13px;
  font-weight: 800;
  font-family: 'JetBrains Mono', 'Pretendard', sans-serif;
}

.ending-ball-dist-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ending-ball-stat-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 3px 7px 3px 4px;
  border-radius: 16px;
}

.ending-ball-stat-item .mini-ball {
  width: 22px;
  height: 22px;
  font-size: 10.5px;
}

.ending-ball-stat-cnt {
  font-size: 11.5px;
  font-weight: 700;
  color: #E2E8F0;
  font-family: 'JetBrains Mono', 'Pretendard', sans-serif;
}

.followup-target-ending-highlight {
  border: 2px solid #EC4899 !important;
  transform: scale(1.05);
}
