/**
 * ============================================================
 * LAYER 3: COMPONENTS - SOCIAL ICONS
 * ============================================================
 *
 * 역할: 소셜 아이콘 바 시스템
 *
 * 포함:
 * - 소셜 아이콘 아코디언
 * - 아이콘 선택 UI
 * - 드래그앤드롭 핸들
 *
 * 출처:
 * - social-icons.css (전체)
 *
 * 의존성:
 * - 없음 (완전 독립적)
 * - Lucide Icons 라이브러리
 *
 * 새 아이콘 추가 시:
 * - .social-icon-{name} 패턴 사용
 *
 * Last Updated: 2025-11-05
 * ============================================================
 */

/* ========================================
   소셜 아이콘 바 시스템
   Lucide + brands.css 기반 (Font Awesome 제외)
   ======================================== */

/* 섹션 */
.social-icons-section {
  margin-bottom: 16px;
}

.social-icon-accordion {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  overflow: hidden;
}

.social-icon-accordion .link-body {
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.social-icon-accordion.expanded .link-body {
  padding: 20px;
  max-height: 1200px;
}

.social-icon-accordion.expanded .expand-icon {
  transform: rotate(90deg);
}

/* 추가 버튼 */
.btn-add-social {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #6A9BCC 0%, #435c75 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  margin-bottom: 16px;
}

.btn-add-social:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(106, 155, 204, 0.3);
}

.btn-add-social i {
  width: 18px;
  height: 18px;
}

/* 드래그 리스트 */
.social-icons-drag-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 40px;
  touch-action: pan-y;
}

/* 소셜 아이콘 항목 - 한 줄 레이아웃 */
.social-icon-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  cursor: grab;
  transition: all 0.2s ease;
  touch-action: pan-y;
}

.social-icon-item:hover {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.social-icon-item.gu-mirror {
  cursor: grabbing;
  opacity: 0.8;
}

.social-icon-drag-handle {
  cursor: grab;
  color: #999;
  font-weight: bold;
  font-size: 16px;
  flex-shrink: 0;
  user-select: none;
  touch-action: none;
}

.social-icon-drag-handle:active {
  cursor: grabbing;
}

.social-icon-preview {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: white;
  border: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

/* Lucide 아이콘 */
.social-icon-preview i {
  width: 20px;
  height: 20px;
  color: #333;
}

/* ========================================
   🇰🇷 한국 플랫폼 텍스트 로고 (brands.css 재사용)
   ======================================== */

/* 네이버 - N 로고 (프레임 제거) */
.social-icon-preview.naver::before,
.social-icon-option-preview.naver::before,
.preview-social-icon.naver::before {
  content: "N";
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 900;
  font-size: 18px;
  color: #03C75A;
}

.dark-bg .preview-social-icon.naver::before {
  color: white;
}

/* 카카오 - K 로고 */
.social-icon-preview.kakao::before,
.social-icon-option-preview.kakao::before,
.preview-social-icon.kakao::before {
  content: "K";
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 900;
  font-size: 18px;
  color: #FEE500;
}

.dark-bg .preview-social-icon.kakao::before {
  color: white;
}

/* 배달의민족 */
.social-icon-preview.baemin::before,
.social-icon-option-preview.baemin::before,
.preview-social-icon.baemin::before {
  content: "배민";
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: #000;
}

.dark-bg .preview-social-icon.baemin::before {
  color: white;
}

/* 쿠팡 */
.social-icon-preview.coupang::before,
.social-icon-option-preview.coupang::before,
.preview-social-icon.coupang::before {
  content: "쿠팡";
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: #000;
}

.dark-bg .preview-social-icon.coupang::before {
  color: white;
}

/* 당근 */
.social-icon-preview.daangn::before,
.social-icon-option-preview.daangn::before,
.preview-social-icon.daangn::before {
  content: "당근";
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: #000;
}

.dark-bg .preview-social-icon.daangn::before {
  color: white;
}

/* 요기요 */
.social-icon-preview.yogiyo::before,
.social-icon-option-preview.yogiyo::before,
.preview-social-icon.yogiyo::before {
  content: "요기요";
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: #000;
}

.dark-bg .preview-social-icon.yogiyo::before {
  color: white;
}

/* 토스 */
.social-icon-preview.toss::before,
.social-icon-option-preview.toss::before,
.preview-social-icon.toss::before {
  content: "toss";
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: #000;
}

.dark-bg .preview-social-icon.toss::before {
  color: white;
}

/* 한국 플랫폼은 아이콘 숨김 */
.social-icon-preview.naver i,
.social-icon-preview.kakao i,
.social-icon-preview.baemin i,
.social-icon-preview.coupang i,
.social-icon-preview.daangn i,
.social-icon-preview.yogiyo i,
.social-icon-preview.toss i,
.social-icon-option-preview.naver i,
.social-icon-option-preview.kakao i,
.social-icon-option-preview.baemin i,
.social-icon-option-preview.coupang i,
.social-icon-option-preview.daangn i,
.social-icon-option-preview.yogiyo i,
.social-icon-option-preview.toss i,
.preview-social-icon.naver i,
.preview-social-icon.kakao i,
.preview-social-icon.baemin i,
.preview-social-icon.coupang i,
.preview-social-icon.daangn i,
.preview-social-icon.yogiyo i,
.preview-social-icon.toss i {
  display: none;
}

.social-icon-name {
  font-weight: 600;
  color: #333;
  font-size: 13px;
  flex-shrink: 0;
  width: 80px;
}

/* 🔥 URL 입력 필드 (한 줄 레이아웃) */
.social-icon-url-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 13px;
  color: #333;
  transition: all 0.2s ease;
  min-width: 0;
}

.social-icon-url-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.social-icon-url-input.url-required {
  border-color: #ff6b6b;
  background: #fff5f5;
}

.social-icon-url-input.url-required:focus {
  border-color: #ff6b6b;
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

.social-icon-url-input::placeholder {
  color: #999;
}

.social-icon-url-input.url-required::placeholder {
  color: #ff6b6b;
}

.btn-delete-social {
  padding: 6px 10px;
  background: white;
  border: 1px solid #e74c3c;
  color: #e74c3c;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.btn-delete-social:hover {
  background: #e74c3c;
  color: white;
}

/* 🔥 모달 오버레이 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  z-index: 2000;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background: white;
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.25);
  max-width: 600px;
  width: 90%;
  max-height: 85vh;
  overflow: hidden;
  animation: modalSlideIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.modal-header {
  padding: 24px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fafafa;
}

.modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #333;
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #999;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  line-height: 1;
}

.modal-close:hover {
  background: #e9e9e9;
  color: #333;
}

.modal-body {
  padding: 24px;
  max-height: calc(85vh - 140px);
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: #fafafa;
}

.modal-footer .btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.modal-footer .btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.modal-footer .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.modal-footer .btn-secondary {
  background: #f0f0f0;
  color: #666;
}

.modal-footer .btn-secondary:hover {
  background: #e0e0e0;
}

/* 모달 그리드 */
.social-modal-body {
  max-height: 60vh;
  overflow-y: auto;
}

.social-icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.social-icon-option {
  padding: 16px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
}

.social-icon-option:hover {
  border-color: #667eea;
  background: #f8f9ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.social-icon-option.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.social-icon-option-preview {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.social-icon-option-preview i {
  width: 24px;
  height: 24px;
  color: #333;
}

.social-icon-option-name {
  font-size: 13px;
  font-weight: 600;
  color: #333;
}

/* URL 입력 모달 */
.social-url-input-group {
  margin-top: 16px;
}

.social-url-input-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  color: #555;
}

.social-url-input-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
}

.social-url-input-group input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ========================================
   미리보기 소셜 아이콘 바
   ======================================== */

.preview-social-icons {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 24px 0;
  padding: 16px 0;
}

.preview-social-icons.position-bottom {
  margin-top: 0;
}

/* 프레임 제거, 아이콘만 */
.preview-social-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  cursor: pointer;
  text-decoration: none;
  position: relative;
  color: var(--text-color);  /* 🔥 CSS 변수 사용 (제목과 동일 방식) */
}

.preview-social-icon:hover {
  transform: scale(1.15);
}

.preview-social-icon i {
  width: 28px;
  height: 28px;
  color: var(--text-color);  /* 🔥 CSS 변수 사용 (제목과 동일 방식) */
  stroke-width: 1.5;
}

/* 어두운 배경에서 흰색 아이콘 (JS가 .dark-bg 클래스 추가) */
.dark-bg .preview-social-icon {
  color: white !important;  /* 🔥 CSS 변수 덮어쓰기 */
}
.dark-bg .preview-social-icon i {
  color: white !important;  /* 🔥 CSS 변수 덮어쓰기 */
}

/* 반응형 */
@media (max-width: 768px) {
  .social-icon-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .social-icon-url {
    display: none;
  }

  .preview-social-icons {
    gap: 12px;
  }

  .preview-social-icon {
    width: 44px;
    height: 44px;
  }
}
