/* 기본 스타일 리셋 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 전체 폰트 설정 */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
}

/* 컨테이너 */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  animation: fadeIn 0.5s ease-in;
}

/* 헤더 스타일 */
.header-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.header-wrapper h1 {
  font-size: 2rem;
  font-weight: 700;
}

.header-wrapper h1 span {
  background: linear-gradient(135deg, #0891b2 0%, #8b5cf6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 헤더 컨트롤 */
.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.language-select, .theme-toggle {
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
}

.theme-toggle {
  font-size: 18px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* 메인 탭 스타일 */
.main-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.main-tab {
  padding: 10px 20px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  position: relative;
  overflow: hidden;
}

.main-tab::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, transparent, rgba(139, 92, 246, 0.1));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.main-tab:hover::before {
  opacity: 1;
}

.main-tab.active {
  font-weight: 600;
}

/* 탭 컨텐츠 */
.tab-content {
  display: none;
  animation: slideIn 0.3s ease-out;
}

.tab-content.active {
  display: block;
}

/* 대시보드 박스 */
.dashboard-box {
  padding: 24px;
  border-radius: 16px;
  margin-bottom: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
}

.dashboard-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 환율 및 시간 표시 */
.exchange-rate {
  font-size: 2.5rem;
  font-weight: 700;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.rate-value {
  background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.rate-unit {
  font-size: 1.2rem;
  opacity: 0.7;
}

.update-time {
  font-size: 1.2rem;
  opacity: 0.8;
  padding: 10px 0;
}

/* 자동 업데이트 섹션 */
.auto-update-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
}

.auto-update-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 1rem;
}

.auto-update-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

/* 버튼 스타일 */
.fetch-btn, .save-btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  font-size: 14px;
}

.fetch-btn {
  background: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%);
  color: white;
}

.fetch-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(8, 145, 178, 0.3);
}

.save-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  margin-top: 20px;
}

/* 코인 카드 그리드 */
.major-coins-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.coin-card {
  padding: 20px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.coin-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.coin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.coin-symbol {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.coin-name {
  font-size: 0.9rem;
  opacity: 0.7;
}

/* 가격 표시 */
.coin-prices {
  margin-bottom: 16px;
}

.price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 0.9rem;
}

.exchange-label {
  opacity: 0.8;
}

.price {
  font-weight: 600;
  font-family: 'Courier New', monospace;
}

/* 프리미엄 섹션 */
.premium-section {
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

.premium-label {
  font-size: 0.9rem;
  opacity: 0.7;
  margin-bottom: 8px;
}

.premium-value {
  font-size: 2rem;
  font-weight: 700;
}

.premium-percent {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.premium-percent.positive {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.premium-percent.negative {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 테이블 스타일 */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

thead {
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
  opacity: 0.9;
}

td {
  padding: 12px;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

tbody tr {
  transition: background-color 0.2s ease;
}

tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

/* 필터 섹션 */
.filter-section {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

#coin-search {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 14px;
}

#sort-by {
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  font-size: 14px;
}

/* 설정 섹션 */
.settings-section {
  margin-top: 20px;
}

.settings-section h3 {
  margin-bottom: 16px;
  font-size: 1.1rem;
  opacity: 0.9;
}

.setting-item {
  margin-bottom: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
}

.setting-item label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.setting-item input[type="number"] {
  width: 100px;
  padding: 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-left: 10px;
}

/* 애니메이션 */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* 로딩 상태 */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  border-top-color: #0891b2;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 반응형 디자인 */
@media (max-width: 768px) {
  .container {
    padding: 10px;
  }
  
  .header-wrapper {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }
  
  .main-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .major-coins-grid {
    grid-template-columns: 1fr;
  }
  
  table {
    font-size: 0.8rem;
  }
  
  th, td {
    padding: 8px;
  }
}

/* 컬럼 숨김 클래스 */
.hide-column {
  display: none !important;
}

/* 즐겨찾기 하트 스타일 */
.favorite-heart {
  cursor: pointer;
  font-size: 1.2em;
  display: inline-block;
  transition: transform 0.2s ease;
}

.favorite-heart:hover {
  transform: scale(1.2);
}

.favorite-heart:active {
  transform: scale(0.9);
}

/* 즐겨찾기 컬럼 가운데 정렬 */
table th:last-child,
table td:last-child {
  text-align: center;
}

/* 필터 섹션 스타일 동일하게 적용 */
#major-coin-search {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 14px;
}

#major-sort-by {
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  font-size: 14px;
}

/* 코인 상세 정보 섹션 */
.coin-detail-section {
  margin-bottom: 20px;
  padding: 15px 20px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.03) 0%, rgba(8, 145, 178, 0.03) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
}

.coin-select-dropdown {
  padding: 8px 12px;
  min-width: 200px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 15px;
}

.coin-select-dropdown:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(139, 92, 246, 0.3);
}

.coin-select-dropdown:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.1);
}

.detail-content {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* 요약 라인 */
.detail-summary-line {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-bottom: 10px;
  position: relative;
}

/* 토글 버튼 */
.detail-toggle-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 5px 10px;
  font-size: 12px;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.detail-toggle-btn:hover {
  opacity: 1;
}

/* 확장 영역 */
.detail-expanded {
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 10px;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 김프 계산 행 */
.premium-calc-row {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  margin-bottom: 10px;
}

.exchange-price-box {
  display: flex;
  flex-direction: column;
  min-width: 150px;
}

.exchange-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.85rem;
  opacity: 0.7;
  margin-bottom: 5px;
}

.price-main {
  font-size: 1.1rem;
  font-weight: 600;
}

.price-sub {
  font-size: 0.85rem;
  opacity: 0.6;
  margin-top: 2px;
}

.calc-operator {
  font-size: 1.2rem;
  opacity: 0.5;
  padding: 0 10px;
}

.premium-result-box {
  display: flex;
  flex-direction: column;
  min-width: 150px;
  padding-left: 20px;
  border-left: 2px solid rgba(255, 255, 255, 0.1);
}

.premium-label {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-bottom: 5px;
}

.premium-percent {
  font-size: 1.3rem;
  font-weight: 700;
}

.premium-percent.positive {
  color: #10b981;
}

.premium-percent.negative {
  color: #ef4444;
}

.premium-percent.neutral {
  color: #6b7280;
}

.premium-diff {
  font-size: 0.9rem;
  opacity: 0.7;
  margin-top: 3px;
}

/* 거래소 아이콘 크기 조정 */
.exchange-icon-small {
  width: 12px !important;
  height: 12px !important;
  vertical-align: middle;
  margin-right: 3px;
}

/* 코인 기본 정보 섹션 */
.coin-basic-info {
  display: flex;
  align-items: center;
  font-size: 1rem;
  min-width: 150px;
}

/* 컴팩트 통계 아이템 */
.stat-item-compact {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-label-compact {
  font-size: 0.9rem;
  opacity: 0.7;
}

.stat-value-compact {
  font-size: 1rem;
  font-weight: 600;
}

.stat-value-compact.positive {
  color: #10b981;
}

.stat-value-compact.negative {
  color: #ef4444;
}

.stat-value-compact.neutral {
  color: #6b7280;
}

.stat-divider {
  color: rgba(255, 255, 255, 0.2);
  padding: 0 10px;
}

/* 중간 정보 섹션 */
.coin-stats-info {
  display: flex;
  gap: 30px;
  flex: 1;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.85rem;
  opacity: 0.6;
  margin-bottom: 5px;
}

.stat-value {
  font-size: 1.3rem;
  font-weight: 600;
}

.stat-value.positive {
  color: #10b981;
}

.stat-value.negative {
  color: #ef4444;
}

.stat-value.neutral {
  color: #6b7280;
}

/* 김프 상세 섹션 */
.premium-detail-section {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.exchange-price-item {
  display: flex;
  flex-direction: column;
}

.exchange-name {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.exchange-price {
  font-size: 1.1rem;
  font-weight: 600;
}

.exchange-price-usd {
  font-size: 0.85rem;
  opacity: 0.6;
  margin-top: 2px;
}

.premium-separator {
  font-size: 1.5rem;
  opacity: 0.5;
  padding: 0 10px;
}

.premium-result {
  display: flex;
  flex-direction: column;
  padding-left: 20px;
  border-left: 2px solid rgba(255, 255, 255, 0.1);
}

.premium-result-label {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-bottom: 5px;
}

.premium-result-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.premium-result-value.positive {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.premium-result-value.negative {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.premium-result-diff {
  font-size: 0.9rem;
  opacity: 0.7;
  margin-top: 3px;
}

/* 비어있는 상태 */
.detail-empty-state {
  text-align: center;
  padding: 30px;
  opacity: 0.5;
  font-size: 0.95rem;
}

/* SelectBox 스타일 - 심플하게 */
select optgroup {
  font-weight: 700 !important;
  font-style: normal !important;
}

select option {
  font-weight: normal !important;
}