/* ==========================================================================
   Settings Modal Styles (F12 Key Popup)
   세부 설정 팝업창 및 커스터마이징 컨트롤 UI
   ========================================================================== */

.settings-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(3, 7, 18, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
  padding: 1.5rem;
}

.settings-modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.settings-modal {
  width: 100%;
  max-width: 820px;
  height: 85vh;
  max-height: 720px;
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 1.5rem;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-modal-backdrop.open .settings-modal {
  transform: scale(1) translateY(0);
}

/* 1. 모달 헤더 */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(15, 23, 42, 0.5);
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.modal-icon-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, #0284c7 0%, #06b6d4 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}

.modal-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.3px;
}

.modal-subtitle {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 0.15rem;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-close-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

/* 2. 모달 본문 (네비 + 패널) */
.modal-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* 사이드바 네비게이션 */
.settings-nav {
  width: 210px;
  padding: 1.25rem 0.85rem;
  background: rgba(10, 15, 29, 0.6);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow-y: auto;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 0.75rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.tab-btn svg {
  width: 18px;
  height: 18px;
  opacity: 0.8;
}

.tab-btn:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.06);
}

.tab-btn.active {
  color: #ffffff;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  font-weight: 600;
}

.tab-btn.active svg {
  color: #38bdf8;
  opacity: 1;
}

/* 설정 콘텐츠 영역 */
.settings-content-area {
  flex: 1;
  padding: 1.5rem 2rem;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 1.25rem;
  animation: fadeIn 0.2s ease-out;
}

.tab-panel.active {
  display: flex;
}

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

/* 3. 폼 컨트롤 및 공통 UI 요소 */
.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.5px;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 0.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #cbd5e1;
}

.form-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.form-row .form-group {
  flex: 1;
}

/* 세그먼트 컨트롤 */
.segmented-control {
  display: flex;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.65rem;
  padding: 3px;
  gap: 3px;
}

.seg-btn {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.seg-btn:hover {
  color: #ffffff;
}

.seg-btn.active {
  background: rgba(56, 189, 248, 0.25);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* 셀렉트 & 인풋 */
.styled-select, .styled-input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.65rem;
  color: #ffffff;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.styled-select:focus, .styled-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.styled-select option {
  background: #0f172a;
  color: #ffffff;
}

/* 컬러 인풋 */
.color-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 0.5rem;
  cursor: pointer;
  background: transparent;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.5rem;
}

.hex-input {
  width: 110px;
  text-transform: uppercase;
  font-family: 'Share Tech Mono', monospace;
}

/* 슬라이더 (Range) */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.15);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #38bdf8;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
  transition: transform 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* 토글 스위치 */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.2);
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 34px;
}

.toggle-switch .slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
}

.toggle-switch input:checked + .slider {
  background-color: #0284c7;
}

.toggle-switch input:checked + .slider:before {
  transform: translateX(22px);
}

/* 테마 카드 그리드 */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

.theme-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.theme-card:hover {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(255, 255, 255, 0.25);
}

.theme-card.active {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.2);
}

.theme-preview {
  width: 36px;
  height: 36px;
  border-radius: 0.5rem;
  flex-shrink: 0;
}

.theme-preview.nordic {
  background: linear-gradient(135deg, #0f172a, #0d9488, #0284c7);
}
.theme-preview.cosmic {
  background: linear-gradient(135deg, #090a1a, #6366f1, #d946ef);
}
.theme-preview.emerald {
  background: linear-gradient(135deg, #022c22, #059669, #10b981);
}
.theme-preview.sunset {
  background: linear-gradient(135deg, #1e1b4b, #e11d48, #f59e0b);
}
.theme-preview.monochrome {
  background: linear-gradient(135deg, #000000, #1f2937, #4b5563);
}

.theme-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: #e2e8f0;
}

/* 이미지 배경 계절 필터 및 프리셋 그리드 */
.img-season-filter {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.img-season-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 0.5rem;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s;
}

.img-season-btn:hover {
  background: rgba(30, 41, 59, 0.9);
  color: #f1f5f9;
}

.img-season-btn.active {
  background: linear-gradient(135deg, #0284c7 0%, #06b6d4 100%);
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
}

.img-preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
  gap: 0.65rem;
  max-height: 290px;
  overflow-y: auto;
  padding-right: 4px;
}

.img-preset-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.65rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.img-preset-card:hover {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.img-preset-card.active {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.18);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.3);
}

.img-preset-thumb {
  width: 100%;
  height: 64px;
  border-radius: 0.45rem;
  background-size: cover;
  background-position: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.img-preset-name {
  font-size: 0.76rem;
  font-weight: 600;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.file-upload-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.file-upload-input {
  display: none;
}

/* 버튼 스타일 */
.btn-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: 0.65rem;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #06b6d4);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.4);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
}

.btn-secondary:hover {
  background: rgba(51, 65, 85, 0.9);
  color: #ffffff;
}

.btn-danger {
  background: rgba(225, 29, 72, 0.2);
  border: 1px solid rgba(225, 29, 72, 0.4);
  color: #fda4af;
}

.btn-danger:hover {
  background: rgba(225, 29, 72, 0.4);
  color: #ffffff;
}

.btn-warning {
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fde68a;
}

.btn-warning:hover {
  background: rgba(245, 158, 11, 0.4);
  color: #ffffff;
}

.info-box {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.25);
  border-radius: 0.75rem;
  padding: 0.9rem 1.1rem;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: #bae6fd;
}

.info-box code {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-weight: 600;
}

/* 4. 모달 푸터 */
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(15, 23, 42, 0.5);
}

.save-status {
  font-size: 0.8rem;
  color: #10b981;
}

/* 5. 기념일 & 국경일 관리 UI */
.anniversary-form-box {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.9rem;
  padding: 1.1rem;
  margin-bottom: 1.2rem;
}

.anniv-list-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 0.3rem;
}

.anniv-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
  transition: all 0.2s ease;
}

.anniv-item-card:hover {
  background: rgba(51, 65, 85, 0.7);
  border-color: rgba(56, 189, 248, 0.4);
}

.anniv-item-main {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.anniv-item-icon {
  font-size: 1.4rem;
}

.anniv-item-title {
  font-weight: 600;
  color: #f8fafc;
  font-size: 0.92rem;
}

.anniv-item-meta {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-top: 0.1rem;
}

.anniv-item-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.holiday-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 0.3rem;
}

.holiday-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.9rem;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
  transition: all 0.2s ease;
}

.holiday-card:hover {
  border-color: rgba(56, 189, 248, 0.4);
}

.holiday-card-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.holiday-card-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #f8fafc;
}

.holiday-card-date {
  font-size: 0.72rem;
  color: #94a3b8;
}
