/* ========================================
   style.css – Poesi 커스텀 스타일
   ======================================== */

:root {
  --ink: #0A0A0A;
  --ink-dim: rgba(80, 85, 100, 0.65);
  --ink-faint: rgba(80, 85, 100, 0.4);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 0, 0, 0.08);
  --highlight-bg: linear-gradient(180deg, rgba(200, 205, 215, 0.5), rgba(180, 185, 195, 0.2));
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --base-bg: #f0f2f5;
}

html.dark {
  --ink: #f2f2f2;
  --ink-dim: rgba(210, 213, 225, 0.65);
  --ink-faint: rgba(210, 213, 225, 0.4);
  --glass-bg: rgba(30, 30, 34, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --highlight-bg: linear-gradient(180deg, rgba(90, 95, 110, 0.5), rgba(70, 75, 90, 0.2));
  --base-bg: #131316;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { min-height: 100vh; }
body {
  background: var(--base-bg);
  padding-bottom: 100px;
  transition: background-color 0.4s ease, color 0.4s ease;
  font-family: 'Inter', -apple-system, sans-serif;
}
html { background: var(--base-bg); transition: background-color 0.4s ease; }

/* 모든 요소에 부드러운 컬러 전환 (tabbar는 자체 spring 유지) */
body, body * {
  transition: background-color 0.35s ease, color 0.35s ease, border-color 0.35s ease, fill 0.35s ease, stroke 0.35s ease;
}

/* ===== Hover polish ===== */
a, button { transition: transform 0.2s var(--ease), background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease; }
header a:hover img { transform: scale(1.06); }
header a img { transition: transform 0.25s var(--spring); }
#theme-toggle:hover { background: rgba(0,0,0,0.06); transform: scale(1.08) rotate(12deg); }
html.dark #theme-toggle:hover { background: rgba(255,255,255,0.08); }
#gps-btn:hover, #location-toggle:hover, #google-login:hover { transform: translateY(-1px); }
#publish-btn:not(:disabled):hover, #auth-submit:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,0.15); }
.auth-tab:hover { transform: translateY(-1px); }
.poem-card { transition: transform 0.3s var(--ease); }
.poem-card:hover { transform: translateY(-3px); }
.more-btn:hover { transform: translateX(2px); }

@keyframes theme-spin {
  from { transform: rotate(-100deg) scale(0.4); opacity: 0; }
  to { transform: rotate(0) scale(1); opacity: 1; }
}
#theme-icon.spin { animation: theme-spin 0.45s var(--spring); }
html.dark body { color: #e5e5e5; }
html.dark #theme-icon circle { fill: none; }
html.dark #poesi-logo { filter: invert(1); }

/* 다크 모드에서 Tailwind 컬러 클래스 오버라이드 */
html.dark .text-gray-300 { color: #6b6b70 !important; }
html.dark .text-gray-400 { color: #8a8a90 !important; }
html.dark .text-gray-500 { color: #9a9aa0 !important; }
html.dark .text-gray-600 { color: #b0b0b6 !important; }
html.dark .text-gray-700 { color: #c8c8ce !important; }
html.dark .text-gray-800 { color: #e0e0e5 !important; }
html.dark .text-gray-900 { color: #f5f5f5 !important; }

html.dark .bg-white { background-color: #1c1c20 !important; }
html.dark .bg-gray-100 { background-color: #232327 !important; }
html.dark .bg-gray-900 { background-color: #f0f0f0 !important; color: #111 !important; }
html.dark .bg-gray-900.text-white { color: #111 !important; }
html.dark .bg-gray-900:hover, html.dark .hover\:bg-gray-700:hover { background-color: #d8d8d8 !important; }
html.dark .bg-black { background-color: #000; }
html.dark .bg-gradient-to-br.from-gray-200.to-gray-300 {
  background-image: linear-gradient(to bottom right, #333338, #232327) !important;
}

html.dark .border-gray-50 { border-color: #29292d !important; }
html.dark .border-gray-100 { border-color: #2c2c31 !important; }
html.dark .border-gray-200 { border-color: #35353a !important; }
html.dark .hover\:border-gray-400:hover { border-color: #55555c !important; }

html.dark #title-input::placeholder, html.dark #body-input::placeholder { color: #4a4a50; }
html.dark .auth-input { border-bottom-color: #35353a; }
html.dark .auth-input::placeholder { color: #55555c; }

/* ===== Tabbar (liquid glass) ===== */
.tabbar-wrap {
  position: fixed;
  bottom: 20px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  z-index: 50;
  pointer-events: none;
  animation: slide-up 0.6s var(--spring) 0.2s both;
}
@keyframes slide-up {
  from { transform: translateY(80px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.tabbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px;
  border-radius: 999px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 30px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.8);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  pointer-events: auto;
  animation: float 5s ease-in-out infinite;
  animation-delay: 0.8s;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  25% { transform: translateY(-3px); }
  50% { transform: translateY(1px); }
  75% { transform: translateY(-2px); }
}

.tabbar-highlight {
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 0;
  z-index: 1;
  border-radius: 999px;
  width: 56px;
  background: var(--highlight-bg);
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.9);
  transition: transform 0.5s var(--spring), width 0.4s var(--spring);
  pointer-events: none;
  will-change: transform, width;
}

.tab {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 14px;
  border: none;
  background: none;
  color: var(--ink-dim);
  font-size: 13px;
  font-weight: 500;
  border-radius: 999px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.2s var(--ease);
  font-family: 'Inter', sans-serif;
}
.tab svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.3s var(--spring);
  flex-shrink: 0;
}
.tab[aria-selected="true"] { color: var(--ink); }
.tab:not([aria-selected="true"]):hover { color: rgba(30,35,50,0.8); }
.tab:not([aria-selected="true"]):hover svg { transform: scale(1.08); }
html.dark .tab:not([aria-selected="true"]):hover { color: rgba(230,232,240,0.85); }

.tab-label {
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  margin-left: 0;
  transition: max-width 0.35s var(--ease), opacity 0.25s var(--ease), margin-left 0.35s var(--ease);
}
.tab[aria-selected="true"] .tab-label {
  max-width: 80px;
  opacity: 1;
  margin-left: 7px;
}

.tabbar::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(120px 80px at var(--mx, 50%) var(--my, 0%), rgba(0,0,0,0.04), transparent 70%);
  opacity: 0.6;
  mix-blend-mode: multiply;
  transition: background 0.1s ease-out;
}

.tabbar::after {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: -10%;
  width: 40px;
  border-radius: 999px;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 0%, rgba(0,0,0,0) 20%, rgba(0,0,0,0.04) 50%, rgba(0,0,0,0) 80%, transparent 100%);
  mix-blend-mode: multiply;
  animation: shimmer 6s ease-in-out infinite;
  animation-delay: 1.2s;
}
@keyframes shimmer {
  0% { left: -10%; opacity: 0; }
  10% { opacity: 0.6; }
  40% { left: 90%; opacity: 0.6; }
  50% { left: 90%; opacity: 0; }
  100% { left: -10%; opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .tabbar-wrap { animation: none !important; transform: none !important; opacity: 1 !important; }
  .tabbar { animation: none !important; }
  .tabbar::after { animation: none !important; display: none; }
}

/* ===== View ===== */
.view { display: none; animation: fadeView 0.25s ease; }
.view.active { display: block; }
@keyframes fadeView {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Write ===== */
#title-input::placeholder, #body-input::placeholder { color: #d1d5db; }
#title-input, #body-input { outline: none; resize: none; border: none; background: transparent; width: 100%; }
#title-input { font-weight: 700; font-size: 1.5rem; }
#body-input { font-size: 1rem; line-height: 2.25rem; }
#map-section { max-height: 0; overflow: hidden; transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1); }
#map-section.open { max-height: 400px; }
#map { height: 240px; border-radius: 12px; z-index: 0; }
.palette-option { cursor: pointer; transition: all 0.2s ease; border: 2px solid transparent; }
.palette-option:hover { transform: translateY(-2px); }
.palette-option.selected { border-color: #1a1a1a; transform: scale(1.05); }

/* ===== Profile ===== */
.tab-wrapper { overflow: hidden; position: relative; }
.tab-track { display: flex; transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1); will-change: transform; }
.tab-pane { min-width: 100%; flex-shrink: 0; }
.tab-indicator {
  position: absolute;
  bottom: 0;
  height: 1px;
  background: #1a1a1a;
  transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1), width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Feed ===== */
.poem-card { animation: fadeUp 0.5s ease forwards; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.poem-rest { max-height: 0; overflow: hidden; transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1); }
.arrow-icon { transition: transform 0.3s ease; }
.palette-tag { transition: all 0.2s ease; cursor: pointer; }
.palette-tag:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }

.suggestion-chip { background: rgba(0,0,0,0.05); color: var(--ink-dim); cursor: pointer; }
.suggestion-chip:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
html.dark .suggestion-chip { background: rgba(255,255,255,0.08); }

/* ===== Auth Modal ===== */
#auth-modal { opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
#auth-modal.open { opacity: 1; pointer-events: all; }
#auth-box { transform: translateY(24px); transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1); }
#auth-modal.open #auth-box { transform: translateY(0); }
.auth-input { width: 100%; border: none; border-bottom: 1px solid #e5e7eb; padding: 10px 0; font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 300; outline: none; background: transparent; }
.auth-input:focus { border-bottom-color: #1a1a1a; }
.auth-input::placeholder { color: #d1d5db; }
.auth-tab { transition: all 0.2s ease; cursor: pointer; }
.auth-tab.active { color: #1a1a1a; border-bottom: 1px solid #1a1a1a; }