/**
 * FaceRead AI - Custom Styles
 * Tailwind CSS 보완용 커스텀 스타일
 */

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

/* Custom Animations */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.skeleton-loader {
  background: linear-gradient(
    90deg,
    #1e293b 0%,
    #334155 50%,
    #1e293b 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite linear;
}

/* Score Counting Animation */
@keyframes countUp {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.score-animate {
  animation: countUp 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Fade In Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.6s ease-out;
}

/* Modal Scale Animation */
@keyframes modalScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-content {
  animation: modalScale 0.3s ease-out;
}

/* Score Gauge Animation */
@keyframes gaugeProgress {
  from {
    stroke-dashoffset: 502.65;
  }
}

.score-gauge-fill {
  transition: stroke-dashoffset 2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Toast Notification */
.toast-show {
  opacity: 1 !important;
  transform: translate(-50%, 0) !important;
}

/* Upload Frame - 265×265 고정 크기 */
.upload-frame {
  width: 265px;
  height: 265px;
}

/* Upload Frame Hover Effect */
.upload-frame:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(139, 92, 246, 0.2);
}

/* Locked Content Blur */
.locked-content {
  position: relative;
  filter: blur(8px);
  pointer-events: none;
}

.locked-content::after {
  content: '🔒';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 3rem;
  filter: blur(0);
}

/* Prose Styling for Result Content */
.prose {
  line-height: 1.8;
}

.prose h1,
.prose h2,
.prose h3 {
  color: #e2e8f0;
  font-weight: 700;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

.prose p {
  margin-bottom: 1em;
  color: #cbd5e1;
}

.prose strong {
  color: #f0abfc;
  font-weight: 600;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #1e293b;
}

::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* Loading Spinner */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Chat Bubble Bounce */
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40%            { transform: translateY(-5px); opacity: 1; }
}

.spinner {
  animation: spin 1s linear infinite;
}

/* Responsive Utilities */
@media (max-width: 768px) {
  .upload-box {
    margin-bottom: 1rem;
  }
}

/* Focus States */
button:focus,
input:focus {
  outline: 2px solid #a78bfa;
  outline-offset: 2px;
}

/* Disabled State */
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Gradient Text */
.gradient-text {
  background: linear-gradient(135deg, #a78bfa 0%, #f0abfc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Card Hover Effect */
.card-hover {
  transition: all 0.3s ease;
}

.card-hover:hover {
  transform: scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* ═══════════════════════════════════════════════════
   매칭 시스템 전용 스타일
   ═══════════════════════════════════════════════════ */

/* 황금빛 테두리 — 천생연분(95+) 카드 */
@keyframes goldSweep {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.match-card-divine {
  position: relative;
  border-radius: 1.25rem;
  padding: 2px; /* border 두께 */
  background: linear-gradient(120deg, #f59e0b, #fcd34d, #f59e0b, #fbbf24, #d97706);
  background-size: 300% 300%;
  animation: goldSweep 3s ease infinite;
  box-shadow: 0 0 24px rgba(251,191,36,0.35), 0 0 60px rgba(251,191,36,0.12);
}

.match-card-divine .match-card-inner {
  border-radius: 1.125rem;
  background: #0f172a;
}

/* 일반 카드 Glassmorphism */
.match-card {
  background: rgba(30, 41, 59, 0.65);
  border: 1px solid rgba(71, 85, 105, 0.45);
  border-radius: 1.25rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.3s ease;
}

.match-card:hover {
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 8px 32px rgba(139, 92, 246, 0.15);
  transform: translateY(-2px);
}

/* 블러 사진 래퍼 */
.match-photo-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}

.match-photo-blur {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  filter: blur(14px);
  transform: scale(1.08); /* blur 가장자리 클리핑 방지 */
}

.match-photo-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(109,40,217,0.4), rgba(192,38,211,0.3));
  border: 2px solid rgba(139,92,246,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  filter: blur(14px);
  transform: scale(1.08);
}

.match-photo-lock {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0,0,0,0.35);
}

/* 점수 프로그레스 바 */
.score-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(71, 85, 105, 0.4);
  border-radius: 9999px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 9999px;
  width: 0%;
  transition: width 1.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.score-bar-fill.divine {
  background: linear-gradient(90deg, #f59e0b, #fcd34d, #f59e0b);
  background-size: 200% 100%;
  animation: goldSweep 2s ease infinite;
}

.score-bar-fill.high {
  background: linear-gradient(90deg, #7c3aed, #c026d3);
}

.score-bar-fill.mid {
  background: linear-gradient(90deg, #3b82f6, #7c3aed);
}

/* 긴급성 배지 (Top 1 전용) */
@keyframes pulseBadge {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.8; transform: scale(1.04); }
}

.urgency-badge {
  animation: pulseBadge 2s ease-in-out infinite;
  background: linear-gradient(90deg, rgba(239,68,68,0.25), rgba(251,146,60,0.2));
  border: 1px solid rgba(239,68,68,0.4);
}

/* 잠금 해제 버튼 shimmer */
@keyframes btnShimmer {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}

.unlock-btn {
  background: linear-gradient(
    90deg,
    #7c3aed 0%,
    #a855f7 25%,
    #c026d3 50%,
    #a855f7 75%,
    #7c3aed 100%
  );
  background-size: 200% auto;
  animation: btnShimmer 4s linear infinite;
  border-radius: 0.75rem;
  font-weight: 700;
  color: #fff;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}

.unlock-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.unlock-btn:active {
  transform: translateY(0);
}

/* 스켈레톤 — 매칭 카드 */
.match-skeleton {
  background: rgba(30,41,59,0.6);
  border: 1px solid rgba(71,85,105,0.3);
  border-radius: 1.25rem;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.skel-block {
  border-radius: 0.5rem;
  background: linear-gradient(90deg,rgba(30,41,59,0.9) 25%,rgba(51,65,85,0.7) 50%,rgba(30,41,59,0.9) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* 필터 칩 */
.filter-chip {
  padding: 0.375rem 0.875rem;
  border-radius: 9999px;
  border: 1px solid rgba(71,85,105,0.5);
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  background: transparent;
}

.filter-chip.active {
  background: rgba(109,40,217,0.35);
  border-color: #7c3aed;
  color: #c4b5fd;
}

/* 설정 패널 슬라이드 */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.settings-panel {
  animation: slideDown 0.25s ease-out;
}

/* 오행 컬러 배지 */
.elem-木 { color: #4ade80; background: rgba(74,222,128,0.12); border-color: rgba(74,222,128,0.3); }
.elem-火 { color: #f87171; background: rgba(248,113,113,0.12); border-color: rgba(248,113,113,0.3); }
.elem-土 { color: #fbbf24; background: rgba(251,191,36,0.12); border-color: rgba(251,191,36,0.3); }
.elem-金 { color: #cbd5e1; background: rgba(203,213,225,0.12); border-color: rgba(203,213,225,0.3); }
.elem-水 { color: #60a5fa; background: rgba(96,165,250,0.12); border-color: rgba(96,165,250,0.3); }

/* Cropper.js Dark Theme Overrides */
.cropper-container {
  border-radius: 0.75rem;
}

.cropper-modal {
  background-color: #0f172a;
  opacity: 0.7;
}

.cropper-view-box {
  outline: 2px solid rgba(167, 139, 250, 0.7);
  outline-color: rgba(167, 139, 250, 0.7);
}

.cropper-line,
.cropper-point {
  display: none;
}

.cropper-dashed {
  border-color: rgba(255, 255, 255, 0.3);
}
