/* web/css/share.css — Feature #8: 인스타그램 스토리 9:16 캔버스 & 카카오톡 공유 모달 스타일 (Light Theme) */

/* 1. 공유 모달 루트 및 백드롭 */
#share-modal-root {
  position: relative;
  z-index: 99999;
}

.share-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  animation: shareFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* 2. 모달 컨테이너 */
.share-modal {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.16),
              0 0 35px rgba(99, 102, 241, 0.08);
  width: 100%;
  max-width: 460px;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #0f172a;
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  animation: shareScaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes shareScaleUp {
  from {
    transform: scale(0.93) translateY(12px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* 3. 모달 헤더 */
.share-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px 22px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.share-modal-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.share-modal-subtitle {
  margin: 4px 0 0 0;
  font-size: 0.8rem;
  color: #64748b;
  letter-spacing: -0.01em;
}

.share-modal-close {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 1.35rem;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
}

.share-modal-close:hover {
  background: #e2e8f0;
  color: #0f172a;
  transform: rotate(90deg);
}

/* 4. 모달 본문 */
.share-modal-body {
  padding: 16px 20px 20px 20px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.share-modal-body::-webkit-scrollbar {
  width: 6px;
}

.share-modal-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

/* 5. 테마 선택 필터 (Theme selector pills) */
.theme-selector {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.theme-pill {
  flex: 1;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #334155;
  padding: 7px 10px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-align: center;
}

.theme-pill:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.theme-pill.active {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  border-color: #6366f1;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

/* 6. 9:16 인스타그램 스토리 캔버스 프리뷰 래퍼 */
.share-canvas-wrapper {
  position: relative;
  width: 100%;
  max-width: 250px;
  aspect-ratio: 9 / 16;
  margin: 0 auto;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 15px 35px rgba(15, 23, 42, 0.12),
              0 0 20px rgba(99, 102, 241, 0.08);
  border: 2px solid #e2e8f0;
  background: #000000;
}

.share-canvas-wrapper canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.share-canvas-spinner {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2563eb;
  font-size: 0.85rem;
  font-weight: 600;
  backdrop-filter: blur(4px);
}

/* 7. 고정 URL 표시창 */
.share-url-container {
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 4px 6px 4px 12px;
  gap: 8px;
}

.share-url-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #2563eb;
  font-size: 0.82rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  outline: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.share-url-copy-btn {
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.3);
  color: #2563eb;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.share-url-copy-btn:hover {
  background: #2563eb;
  color: #ffffff;
}

/* 8. 공유 액션 버튼 그룹 */
.share-actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.share-btn {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  border: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.share-btn:active {
  transform: scale(0.98);
}

/* 인스타그램 스토리 바로 보내기 버튼 (Instagram gradient) */
.share-btn-insta {
  background: linear-gradient(135deg, #405de6 0%, #5851db 20%, #833ab4 40%, #c13584 60%, #e1306c 80%, #fd1d1d 100%);
  color: #ffffff;
  box-shadow: 0 4px 18px rgba(225, 48, 108, 0.35);
}

.share-btn-insta:hover {
  filter: brightness(1.12);
  box-shadow: 0 6px 24px rgba(225, 48, 108, 0.5);
}

/* 인스타그램 스토리 저장 버튼 (Instagram gradient) */
.share-btn-save {
  background: linear-gradient(135deg, #833ab4 0%, #fd1d1d 50%, #fcb045 100%);
  color: #ffffff;
  box-shadow: 0 4px 18px rgba(253, 29, 29, 0.3);
}

.share-btn-save:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 24px rgba(253, 29, 29, 0.45);
}

/* 카카오톡 / 모바일 공유 버튼 (Kakao Yellow) */
.share-btn-kakao {
  background: #fee500;
  color: #191919;
  font-weight: 800;
  box-shadow: 0 4px 16px rgba(254, 229, 0, 0.25);
}

.share-btn-kakao:hover {
  background: #fdd800;
  box-shadow: 0 6px 22px rgba(254, 229, 0, 0.35);
}

/* 고정 URL 전체 복사 버튼 */
.share-btn-copy {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  font-size: 0.85rem;
  font-weight: 600;
}

.share-btn-copy:hover {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #94a3b8;
}

/* 9. 전역 토스트 알림 (Toast Notification) */
.share-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(99, 102, 241, 0.5);
  color: #f8fafc;
  padding: 12px 22px;
  border-radius: 9999px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.3),
              0 0 24px rgba(99, 102, 241, 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 90vw;
  text-align: center;
  word-break: break-all;
  white-space: pre-line;
}

.share-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* 10. 반응형 모바일 최적화 */
@media (max-width: 480px) {
  .share-modal {
    max-height: 96vh;
    border-radius: 20px;
  }

  .share-modal-header {
    padding: 14px 18px 12px 18px;
  }

  .share-modal-title {
    font-size: 1.05rem;
  }

  .share-modal-body {
    padding: 14px 16px 18px 16px;
    gap: 12px;
  }

  .share-canvas-wrapper {
    max-width: 210px;
  }

  .share-btn {
    padding: 11px 14px;
    font-size: 0.88rem;
  }
}
