@import url('https://fonts.googleapis.com/css2?family=Gmarket+Sans:wght@300;500;700&display=swap');

:root {
  --primary-color: #ff3e00;
  --secondary-color: #ff9d00;
  --accent-color: #00d2ff;
  --bg-dark: #0a0b1e;
  --card-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text-main: #ffffff;
  --text-muted: #a0a0cc;
  --neon-shadow: 0 0 15px rgba(255, 62, 0, 0.4);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --mood-color: transparent;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Gmarket Sans', sans-serif;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
}

#app {
  width: 100%;
  max-width: 600px;
  padding: 2rem 1.5rem;
  z-index: 1;
}

/* Toast Notification */
#toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  color: #fff;
  padding: 12px 20px;
  border-radius: 30px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transform: translateY(-20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  animation: slideInDown 0.4s forwards, fadeOut 0.4s 2.6s forwards;
}

@keyframes slideInDown {
  to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeOut {
  to { transform: translateY(-20px); opacity: 0; }
}

/* Dynamic Background Canvas */
.background-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

.bg-img {
  width: 100%;
  height: 100%;
  background: url('./public/bg.png') center/cover no-repeat;
  filter: brightness(0.6);
  position: absolute;
}

.mood-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: radial-gradient(circle at 50% 50%, var(--mood-color) 0%, transparent 70%);
  opacity: 0.3;
  transition: background 1s ease-in-out;
  mix-blend-mode: color-dodge;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

.logo {
  font-size: 3.5rem;
  font-weight: 700;
  background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(var(--neon-shadow));
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-muted);
  font-weight: 300;
  font-size: 0.9rem;
}

/* Tabs Navigation */
.mode-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  justify-content: center;
}

.tab-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  padding: 0.8rem 1rem;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.95rem;
  flex: 1;
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  border-color: var(--accent-color);
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.2);
}

/* Glass Card */
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 24px;
  border: 1px solid var(--glass-border);
  padding: 2rem;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.view-container {
  transition: var(--transition);
}

.hidden-view {
  display: none !important;
}

/* Categories Area */
.category-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.cat-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  border-radius: 50px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.85rem;
}

.cat-btn.active {
  background: var(--accent-color);
  color: #000;
  font-weight: 500;
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.4);
}

/* Mix Mode Selectors */
.mix-selector {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.mix-group h4 {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
  text-align: center;
}

.btn-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.ing-btn, .method-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  padding: 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: var(--transition);
}

.ing-btn.selected, .method-btn.selected {
  background: var(--secondary-color);
  color: white;
  border-color: var(--secondary-color);
  box-shadow: 0 0 10px rgba(255, 157, 0, 0.3);
}

/* Favorites View */
.favorites-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 10px;
}

.empty-msg {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 0;
  line-height: 1.6;
}

.fav-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
}

.fav-info { font-weight: 500; font-size: 1.1rem; }
.fav-emoji { margin-right: 8px; }

.remove-fav-btn {
  background: rgba(255, 0, 0, 0.2);
  color: #ff6b6b;
  border: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
}
.remove-fav-btn:hover { background: rgba(255, 0, 0, 0.4); }

/* Slot Machine */
.slot-machine {
  margin: 2rem 0;
  border: 2px solid var(--glass-border);
  border-radius: 15px;
  overflow: hidden;
  height: 120px;
  background: rgba(0,0,0,0.3);
  position: relative;
  box-shadow: inset 0 5px 15px rgba(0,0,0,0.5);
}

.slot-shim {
  position: absolute;
  left: 0; width: 100%; height: 20px;
  z-index: 2;
  pointer-events: none;
}
.slot-shim-top {
  top: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
}
.slot-shim-bottom {
  bottom: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
}

.slot-inner {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

/* Motion blur class applied via JS during spin */
.spinning .slot-item {
  filter: blur(2px);
  color: var(--accent-color);
}

.slot-item {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 700;
  min-height: 120px;
  transition: filter 0.1s;
}
.slot-item .emoji { margin-right: 10px; }

/* Controls */
.main-btn {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border: none;
  padding: 1.2rem 2rem;
  font-size: 1.2rem;
  font-weight: 700;
  border-radius: 50px;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  box-shadow: 0 8px 20px rgba(255, 62, 0, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.main-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 10px 25px rgba(255, 62, 0, 0.5);
}
.main-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.ghost-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 1rem;
  width: 100%;
  cursor: pointer;
  text-decoration: underline;
  margin-top: 5px;
}
.ghost-btn:hover { color: #fff; }

/* Result Modal */
.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  display: flex; justify-content: center; align-items: center;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.4s ease;
}

.modal.hidden { 
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  width: 90%;
  max-width: 400px;
  text-align: center;
  transform: scale(1);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  /* dynamic border shadow based on mood */
  box-shadow: 0 0 40px var(--mood-color);
}
.modal.hidden .modal-content { transform: scale(0.9); }

.modal-emoji {
  font-size: 4rem;
  margin-bottom: 0.5rem;
  animation: bounce 2s infinite ease-in-out;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

.modal-title { font-size: 1.2rem; color: var(--text-muted); margin-bottom: 1rem; }

.highlight {
  font-size: 3.2rem;
  font-weight: 700;
  color: white;
  text-shadow: 0 0 20px var(--mood-color);
  display: block;
}

/* Reaction Bar */
.reaction-bar {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 1.5rem 0;
}

.reaction-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid var(--glass-border);
  border-radius: 50px;
  padding: 0.5rem 1rem;
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; gap: 5px;
  transition: var(--transition);
}
.reaction-btn:hover { background: rgba(255,255,255,0.2); }
.reaction-btn.active {
  background: var(--accent-color);
  color: #000;
  border-color: var(--accent-color);
}
#favorite-btn.active {
  background: #ffd700;
  border-color: #ffd700;
}

/* Nearby Restaurants UI */
.nearby-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0;
  text-align: left;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 5px;
}

.api-notice {
  font-size: 0.8rem;
  color: #ff9d00;
  text-align: center;
  margin-bottom: 0.5rem;
}

.loading-spinner, .error-msg, .empty-msg {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 1rem;
}

.restaurant-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  padding: 0.8rem 1rem;
  border-radius: 12px;
  color: var(--text-main);
  transition: var(--transition);
}
.restaurant-card:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.3);
}

.rest-name { font-weight: 700; font-size: 0.95rem; display: flex; align-items: center;}
.rest-rating { color: #f1c40f; font-size: 0.85rem; margin-left: 5px; }
.rest-dist { font-size: 0.8rem; color: var(--text-muted); margin-top: 3px; }

.rest-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.3rem;
}

.rest-btn {
  flex: 1;
  text-align: center;
  padding: 0.5rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  transition: var(--transition);
  color: #111;
}

.kakao-btn { background: #fee500; }
.kakao-btn:hover { background: #e5cf00; }

.naver-btn { background: #03c75a; color: white; }
.naver-btn:hover { background: #02b350; }

.modal-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.action-btn {
  flex: 1;
  padding: 1rem;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  transition: var(--transition);
}

.map-btn { background: var(--accent-color); color: #000; }
.share-btn { background: #fee500; color: #3c1e1e; } /* Kakao style yellow */
.map-btn:hover, .share-btn:hover { filter: brightness(1.1); }

/* Contact Section */
.contact-section { margin-top: 3rem; }
.contact-card { padding: 1.5rem; text-align: center; }
.contact-card h3 { margin-bottom: 0.5rem; }
.contact-card p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1.5rem; }

.contact-form { display: flex; flex-direction: column; gap: 0.8rem; }
.contact-form input, .contact-form textarea {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 0.8rem; color: #fff; font-size: 0.9rem;
}
.contact-form textarea { height: 100px; resize: none; }

.form-btn {
  background: rgba(255,255,255,0.1);
  color: #fff; border: 1px solid var(--glass-border);
  padding: 0.8rem; border-radius: 8px; font-weight: 700;
  cursor: pointer; transition: var(--transition);
}
.form-btn:hover { background: rgba(255,255,255,0.2); }

footer { text-align: center; margin-top: 2rem; color: var(--text-muted); font-size: 0.75rem; }

@media (max-width: 480px) {
  .btn-grid { grid-template-columns: repeat(2, 1fr); }
  .logo { font-size: 2.8rem; }
  .slot-item { font-size: 1.8rem; }
  .highlight { font-size: 2.5rem; }
}

/* Scrollbar styling for favorites */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); border-radius: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }
