/* Kau² App Styles — matches landing page design tokens */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --warm: #FF6B35;
  --warm-light: #FF8B5E;
  --dark: #1A1A2E;
  --cream: #FFF8F0;
  --olive: #2D4A3E;
  --gold: #E8A838;
  --muted: #8B8B9E;
  --light-olive: #E8F0EC;
  --danger: #E74C3C;
  --success: #27AE60;
  --border: rgba(26, 26, 46, 0.08);
  --shadow: 0 2px 12px rgba(26, 26, 46, 0.08);
  --shadow-lg: 0 8px 32px rgba(26, 26, 46, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --nav-h: 64px;
  --bottom-h: 72px;
}

body {
  font-family: 'DM Sans', sans-serif;
  color: var(--dark);
  background: var(--cream);
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: 'Space Grotesk', sans-serif; }

/* TOP NAV */
.app-nav {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 100;
  padding: 0 20px;
  height: var(--nav-h);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 248, 240, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.app-nav .logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--dark);
  letter-spacing: -0.5px;
  text-decoration: none;
}
.app-nav .logo span { color: var(--warm); }
.app-nav .logo sup { font-size: 0.65em; color: var(--warm); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--light-olive);
  color: var(--olive);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

/* BOTTOM NAV (mobile-first) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  width: 100%;
  z-index: 100;
  height: var(--bottom-h);
  background: rgba(255, 248, 240, 0.97);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  position: relative;
  background: none;
  border: none;
}
.bottom-nav .nav-item.active { color: var(--warm); }
.bottom-nav .nav-item:hover { color: var(--dark); }

.bottom-nav .nav-item svg {
  width: 22px;
  height: 22px;
  stroke-width: 2;
}

.nav-item .badge {
  position: absolute;
  top: 2px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warm);
}

/* SNAP BUTTON (center of bottom nav) */
.snap-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--warm), var(--gold));
  border: 3px solid var(--cream);
  box-shadow: 0 4px 16px rgba(255, 107, 53, 0.35);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transform: translateY(-12px);
  transition: all 0.2s;
}
.snap-btn:hover { transform: translateY(-14px); box-shadow: 0 6px 20px rgba(255, 107, 53, 0.45); }
.snap-btn:active { transform: translateY(-10px); }
.snap-btn svg { width: 26px; height: 26px; }

/* MAIN CONTENT AREA */
.app-content {
  padding-top: var(--nav-h);
  padding-bottom: calc(var(--bottom-h) + 16px);
  min-height: 100vh;
}

.page {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

/* AUTH PAGE */
.auth-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--nav-h));
  padding: 40px 24px;
}

.auth-card {
  background: white;
  border-radius: 16px;
  padding: 40px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.auth-card h2 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.auth-card .subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 32px;
}

/* FORM ELEMENTS */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--dark);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  color: var(--dark);
  background: var(--cream);
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--warm);
  background: white;
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--warm);
  color: white;
  width: 100%;
}
.btn-primary:hover { background: var(--warm-light); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--light-olive);
  color: var(--olive);
}
.btn-secondary:hover { background: #d8e8de; }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding: 8px 16px;
}
.btn-ghost:hover { color: var(--dark); }

.btn-sm { padding: 8px 16px; font-size: 0.85rem; }

.text-link {
  color: var(--warm);
  cursor: pointer;
  font-weight: 500;
  background: none;
  border: none;
  font-size: inherit;
  font-family: inherit;
}
.text-link:hover { text-decoration: underline; }

/* ROLE TOGGLE */
.role-toggle {
  display: flex;
  background: var(--cream);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
}
.role-toggle button {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
}
.role-toggle button.active {
  background: white;
  color: var(--dark);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* SNAP/UPLOAD PAGE */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: 16px;
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.upload-area:hover { border-color: var(--warm); }
.upload-area.has-image { padding: 0; border-style: solid; border-color: var(--warm); }
.upload-area img {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: 14px;
}
.upload-area .upload-icon { font-size: 2.5rem; margin-bottom: 12px; }
.upload-area .upload-text { color: var(--muted); font-size: 0.95rem; }
.upload-area .upload-hint { color: var(--muted); font-size: 0.8rem; margin-top: 8px; opacity: 0.7; }
.upload-area input[type="file"] { display: none; }

/* Camera button overlay */
.camera-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  justify-content: center;
}

/* RESTAURANT PICKER */
.restaurant-picker {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.restaurant-picker h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.restaurant-list {
  max-height: 240px;
  overflow-y: auto;
}

.restaurant-item {
  padding: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1.5px solid transparent;
}
.restaurant-item:hover { background: var(--cream); }
.restaurant-item.selected { border-color: var(--warm); background: rgba(255, 107, 53, 0.05); }
.restaurant-item .r-name { font-weight: 500; font-size: 0.95rem; }
.restaurant-item .r-distance { color: var(--muted); font-size: 0.8rem; }
.restaurant-item .r-cuisine { color: var(--muted); font-size: 0.75rem; }

.location-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
  padding: 8px 0;
}
.location-dot { width: 8px; height: 8px; border-radius: 50%; }
.location-dot.active { background: var(--success); }
.location-dot.loading { background: var(--gold); animation: pulse 1s infinite; }
.location-dot.error { background: var(--danger); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* RATING */
.rating-group {
  margin-bottom: 16px;
}
.rating-group label {
  font-size: 0.85rem;
  font-weight: 500;
  display: block;
  margin-bottom: 8px;
}
.stars {
  display: flex;
  gap: 6px;
}
.star {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  cursor: pointer;
  border-radius: 8px;
  background: var(--cream);
  border: 1.5px solid var(--border);
  transition: all 0.15s;
}
.star:hover { border-color: var(--gold); }
.star.active { background: var(--gold); border-color: var(--gold); color: white; }

/* FEED / HISTORY */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 0 4px;
}
.section-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.snap-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.snap-card {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}
.snap-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.snap-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
}
.snap-card .snap-info {
  padding: 12px;
}
.snap-card .snap-restaurant {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.snap-card .snap-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--muted);
}
.snap-card .snap-rating { color: var(--gold); }
.snap-card .unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warm);
}

/* SNAP DETAIL */
.snap-detail-img {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.snap-detail-header {
  margin-bottom: 20px;
}
.snap-detail-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.snap-detail-header .meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.feedback-box {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.feedback-box h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.rating-display {
  display: flex;
  gap: 20px;
  margin-bottom: 12px;
}
.rating-display .rating-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
}
.rating-display .rating-value {
  color: var(--gold);
  font-weight: 600;
}

/* MESSAGES */
.messages-container {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.messages-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.9rem;
}

.messages-list {
  max-height: 400px;
  overflow-y: auto;
  padding: 16px;
}

.message-bubble {
  margin-bottom: 12px;
  max-width: 80%;
}
.message-bubble.mine { margin-left: auto; }
.message-bubble .bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
}
.message-bubble.mine .bubble {
  background: var(--warm);
  color: white;
  border-bottom-right-radius: 4px;
}
.message-bubble.theirs .bubble {
  background: var(--light-olive);
  color: var(--dark);
  border-bottom-left-radius: 4px;
}
.message-bubble .msg-meta {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 4px;
  padding: 0 4px;
}
.message-bubble.mine .msg-meta { text-align: right; }

.message-input {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.message-input input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  outline: none;
  background: var(--cream);
}
.message-input input:focus { border-color: var(--warm); background: white; }
.message-input button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--warm);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.message-input button:hover { background: var(--warm-light); }

/* INBOX */
.conversation-item {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  align-items: center;
}
.conversation-item:hover { background: var(--cream); }
.conversation-item:last-child { border-bottom: none; }

.convo-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.convo-info { flex: 1; min-width: 0; }
.convo-info .convo-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 2px;
}
.convo-info .convo-preview {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.convo-meta {
  text-align: right;
  flex-shrink: 0;
}
.convo-meta .convo-time {
  font-size: 0.7rem;
  color: var(--muted);
}
.convo-meta .unread-badge {
  display: inline-block;
  background: var(--warm);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  margin-top: 4px;
}

/* EMPTY STATES */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.empty-state p {
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 280px;
  margin: 0 auto 20px;
  line-height: 1.6;
}

/* LOADING */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--warm);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* TOAST */
.toast {
  position: fixed;
  bottom: calc(var(--bottom-h) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--dark);
  color: white;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 0.85rem;
  z-index: 200;
  opacity: 0;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-lg);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

/* MODAL OVERLAY */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 46, 0.5);
  z-index: 150;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal-content {
  background: var(--cream);
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  border-radius: 20px 20px 0 0;
  padding: 24px;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* BACK BUTTON */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  margin-bottom: 16px;
  background: none;
  border: none;
  font-family: inherit;
  padding: 4px 0;
}
.back-btn:hover { color: var(--dark); }

/* RESTAURANT DASHBOARD */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-card .stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--warm);
}
.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
}

/* DROPDOWN MENU */
.dropdown {
  position: relative;
}
.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  min-width: 160px;
  z-index: 110;
  margin-top: 8px;
}
.dropdown-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  background: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 6px;
  color: var(--dark);
}
.dropdown-menu button:hover { background: var(--cream); }
.dropdown-menu .danger { color: var(--danger); }

/* RESPONSIVE */
@media (max-width: 480px) {
  .snap-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

/* Hide things in auth state */
body.no-auth .bottom-nav,
body.no-auth .app-nav .nav-actions { display: none; }
