/* ── BrewChat Theme ──────────────────────────────────────────── */
:root {
  --amber:  #FDB833;
  --amber-dark: #e09e10;
  --hops:   #4A7C3F;
  --mead:   #C4783F;
  --berry:  #8B2FC9;
  --cider:  #A8C23A;
  --foam:   #FFF9ED;
  --copper: #B87333;
  --ink:    #2D1F0E;
  --muted:  #7a6652;
  --card-shadow: 0 2px 12px rgba(45,31,14,.10);
}

/* ── Base ──────────────────────────────────────────────────── */
body {
  background: var(--foam);
  color: var(--ink);
  font-family: 'Nunito', sans-serif;
}

.brew-title {
  font-family: 'Fredoka One', cursive;
  color: var(--ink);
  letter-spacing: .02em;
}

/* ── Navbar ────────────────────────────────────────────────── */
.brew-navbar {
  background: var(--amber);
  box-shadow: 0 2px 8px rgba(45,31,14,.18);
  position: relative;
  z-index: 10;
}

.brew-navbar .nav-link {
  color: var(--ink) !important;
  font-weight: 600;
  border-radius: 8px;
  transition: background .15s;
}
.brew-navbar .nav-link:hover,
.brew-navbar .nav-link.active {
  background: rgba(45,31,14,.12);
}

.brew-logo {
  font-family: 'Fredoka One', cursive;
  font-size: 1.4rem;
  color: var(--ink) !important;
  text-decoration: none;
  letter-spacing: .03em;
}

.brew-hop {
  display: inline-block;
  animation: hop-float 3s ease-in-out infinite;
}
@keyframes hop-float {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50%       { transform: translateY(-4px) rotate(5deg); }
}

/* ── Cards ─────────────────────────────────────────────────── */
.brew-card {
  border: 2px solid rgba(184,115,51,.18);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  background: #fff;
}

.brew-member-card:hover,
.brew-recipe-card:hover,
.brew-album-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(45,31,14,.15);
  transition: transform .15s, box-shadow .15s;
}

/* ── Buttons ───────────────────────────────────────────────── */
.brew-btn-primary {
  background: var(--amber);
  border: 2px solid var(--amber-dark);
  color: var(--ink);
  font-weight: 700;
  border-radius: 10px;
  transition: background .15s, transform .1s;
}
.brew-btn-primary:hover {
  background: var(--amber-dark);
  color: var(--ink);
  transform: translateY(-1px);
}

.brew-btn-secondary {
  background: #fff;
  border: 2px solid var(--copper);
  color: var(--copper);
  font-weight: 700;
  border-radius: 10px;
  transition: background .15s;
}
.brew-btn-secondary:hover {
  background: var(--foam);
  color: var(--mead);
  border-color: var(--mead);
}

/* ── Inputs ────────────────────────────────────────────────── */
.brew-input, .form-control, .form-select {
  border: 2px solid rgba(184,115,51,.30);
  border-radius: 10px;
  background: #fffdf7;
  transition: border-color .15s, box-shadow .15s;
}
.brew-input:focus, .form-control:focus, .form-select:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(253,184,51,.25);
  background: #fff;
}

/* ── Avatars ───────────────────────────────────────────────── */
.brew-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fredoka One', cursive;
  font-weight: 400;
  color: #fff;
  border-radius: 50%;
  flex-shrink: 0;
  user-select: none;
  overflow: hidden;
}
.brew-avatar--sm  { width: 2rem;  height: 2rem;  font-size: .9rem; }
.brew-avatar--md  { width: 44px;  height: 44px;  font-size: 1.1rem; }
.brew-avatar--lg  { width: 64px;  height: 64px;  font-size: 1.6rem; }
.brew-avatar--xl  { width: 96px;  height: 96px;  font-size: 2.2rem; }

/* ── Chat Layout ────────────────────────────────────────────── */
.brew-chat-layout {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.brew-chat-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.brew-chat-header {
  padding: .75rem 1rem;
  background: #fff;
  border-bottom: 2px solid rgba(184,115,51,.15);
  font-family: 'Fredoka One', cursive;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}

.brew-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  scroll-behavior: smooth;
}

.brew-chat-input-wrap {
  padding: .75rem 1rem;
  background: #fff;
  border-top: 2px solid rgba(184,115,51,.15);
  flex-shrink: 0;
}

.brew-chat-form {
  max-width: 100%;
}

.brew-msg-input {
  font-size: 1rem;
}

/* ── Messages ───────────────────────────────────────────────── */
.brew-message {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  animation: brew-pop .2s ease-out;
}

@keyframes brew-pop {
  from { opacity: 0; transform: translateY(8px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.brew-message-body {
  max-width: calc(100% - 44px);
}

.brew-message-meta {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  margin-bottom: .15rem;
}

.brew-message-author {
  font-weight: 700;
  font-size: .85rem;
  color: var(--ink);
  text-decoration: none;
}
.brew-message-author:hover { text-decoration: underline; color: var(--mead); }

.brew-message-time {
  font-size: .72rem;
  color: var(--muted);
}

.brew-message-text {
  background: #fff;
  border: 1.5px solid rgba(184,115,51,.18);
  border-radius: 0 12px 12px 12px;
  padding: .5rem .75rem;
  font-size: .95rem;
  line-height: 1.5;
  word-break: break-word;
  box-shadow: 0 1px 4px rgba(45,31,14,.06);
}

.brew-message--mine .brew-message-text {
  background: #fff8e1;
  border-color: rgba(253,184,51,.4);
  border-radius: 12px 0 12px 12px;
}

/* ── Online indicator ───────────────────────────────────────── */
.brew-online-dot {
  display: inline-block;
  width: 8px; height: 8px;
  background: #2ecc71;
  border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .6; transform: scale(1.3); }
}

/* ── Login page ─────────────────────────────────────────────── */
.brew-login-page {
  background: linear-gradient(135deg, #ffe9a0 0%, #ffd166 40%, #f4a261 100%);
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

.brew-login-card {
  background: #fff;
  border-radius: 24px;
  padding: 2.5rem;
  width: min(400px, 90vw);
  box-shadow: 0 8px 40px rgba(45,31,14,.2);
  position: relative;
  z-index: 10;
}

.brew-login-icon {
  font-size: 3rem;
  animation: brew-bounce 1.5s ease-in-out infinite;
}
@keyframes brew-bounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}

/* ── Bubbles (login page decoration) ───────────────────────── */
.brew-bubbles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.brew-bubble {
  position: absolute;
  bottom: -60px;
  background: rgba(255,255,255,.25);
  border-radius: 50%;
  animation: bubble-rise linear infinite;
}

.brew-bubble:nth-child(1)  { left:  5%; width: 20px; height: 20px; animation-duration: 6s;  animation-delay: 0s;   }
.brew-bubble:nth-child(2)  { left: 15%; width: 12px; height: 12px; animation-duration: 8s;  animation-delay: 1s;   }
.brew-bubble:nth-child(3)  { left: 25%; width: 30px; height: 30px; animation-duration: 7s;  animation-delay: 2s;   }
.brew-bubble:nth-child(4)  { left: 40%; width: 16px; height: 16px; animation-duration: 9s;  animation-delay: .5s;  }
.brew-bubble:nth-child(5)  { left: 55%; width: 24px; height: 24px; animation-duration: 6.5s; animation-delay: 3s;  }
.brew-bubble:nth-child(6)  { left: 65%; width: 10px; height: 10px; animation-duration: 10s; animation-delay: 1.5s; }
.brew-bubble:nth-child(7)  { left: 75%; width: 28px; height: 28px; animation-duration: 7.5s; animation-delay: 0.8s; }
.brew-bubble:nth-child(8)  { left: 85%; width: 14px; height: 14px; animation-duration: 8.5s; animation-delay: 2.5s; }
.brew-bubble:nth-child(9)  { left: 92%; width: 22px; height: 22px; animation-duration: 6s;  animation-delay: 4s;   }
.brew-bubble:nth-child(10) { left: 48%; width: 18px; height: 18px; animation-duration: 9.5s; animation-delay: 1.2s; }

@keyframes bubble-rise {
  0%   { transform: translateY(0) translateX(0);     opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: .8; }
  100% { transform: translateY(-110vh) translateX(20px); opacity: 0; }
}

/* ── Brew type badges ───────────────────────────────────────── */
.brew-type-badge {
  display: inline-block;
  padding: .2rem .65rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.brew-type-wine  { background: #f3e5f5; color: #6a1b9a; border: 1.5px solid #ce93d8; }
.brew-type-mead  { background: #fff8e1; color: #e65100; border: 1.5px solid #ffcc80; }
.brew-type-beer  { background: #fff3e0; color: #bf360c; border: 1.5px solid #ffab40; }
.brew-type-cider { background: #f1f8e9; color: #33691e; border: 1.5px solid #aed581; }
.brew-type-other { background: #f5f5f5; color: #424242; border: 1.5px solid #bdbdbd; }

/* ── Recipe body (rendered markdown) ───────────────────────── */
.brew-recipe-body h1, .brew-recipe-body h2, .brew-recipe-body h3 {
  font-family: 'Fredoka One', cursive;
  color: var(--mead);
  margin-top: 1.5rem;
}
.brew-recipe-body ul, .brew-recipe-body ol {
  padding-left: 1.5rem;
}
.brew-recipe-body code {
  background: var(--foam);
  border: 1px solid rgba(184,115,51,.2);
  border-radius: 4px;
  padding: .1em .3em;
}

/* ── Albums ─────────────────────────────────────────────────── */
.brew-album-cover {
  height: 160px;
  object-fit: cover;
  border-radius: 12px 12px 0 0;
}

.brew-album-placeholder {
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: #fff8e1;
  border-radius: 12px 12px 0 0;
}

.brew-photo-card {
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid rgba(184,115,51,.15);
  background: #fff;
}
.brew-photo-thumb {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}
.brew-photo-caption {
  padding: .4rem .6rem;
  font-size: .8rem;
  color: var(--muted);
}

/* ── Links ──────────────────────────────────────────────────── */
.brew-link { color: var(--mead); font-weight: 600; }
.brew-link:hover { color: var(--amber-dark); }

/* ── Alerts (use Bootstrap message tags) ───────────────────── */
.alert-success  { background: #f0fdf4; border-color: #86efac; color: #166534; }
.alert-error,
.alert-danger   { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }
.alert-warning  { background: #fffbeb; border-color: #fcd34d; color: #92400e; }
.alert-info     { background: #eff6ff; border-color: #93c5fd; color: #1e40af; }

/* ── Chat room background bubbles ──────────────────────────── */
.brew-chat-bubbles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.brew-chat-bubble {
  position: absolute;
  bottom: -30px;
  background: rgba(253, 184, 51, 0.22);
  border: 1.5px solid rgba(253, 184, 51, 0.42);
  border-radius: 50%;
  animation: chat-bubble-rise linear infinite;
}

.brew-chat-bubble:nth-child(1) { left:  7%; width: 14px; height: 14px; animation-duration: 13s;   animation-delay:  0s;   }
.brew-chat-bubble:nth-child(2) { left: 16%; width:  9px; height:  9px; animation-duration: 10.5s; animation-delay:  2s;   animation-name: chat-bubble-pop; }
.brew-chat-bubble:nth-child(3) { left: 28%; width: 18px; height: 18px; animation-duration: 16s;   animation-delay:  1s;   }
.brew-chat-bubble:nth-child(4) { left: 43%; width: 11px; height: 11px; animation-duration: 12s;   animation-delay:  4.5s; animation-name: chat-bubble-pop; }
.brew-chat-bubble:nth-child(5) { left: 57%; width: 16px; height: 16px; animation-duration: 14s;   animation-delay:  0.8s; }
.brew-chat-bubble:nth-child(6) { left: 69%; width:  8px; height:  8px; animation-duration: 11.5s; animation-delay:  3.5s; animation-name: chat-bubble-pop; }
.brew-chat-bubble:nth-child(7) { left: 81%; width: 20px; height: 20px; animation-duration: 17s;   animation-delay:  2.2s; }
.brew-chat-bubble:nth-child(8) { left: 92%; width: 12px; height: 12px; animation-duration: 10s;   animation-delay:  5.5s; animation-name: chat-bubble-pop; }

@keyframes chat-bubble-rise {
  0%   { transform: translateY(0) translateX(0);          opacity: 0; }
  8%   { opacity: .45; }
  90%  { opacity: .28; }
  100% { transform: translateY(-108vh) translateX(14px);  opacity: 0; }
}

@keyframes chat-bubble-pop {
  0%   { transform: translateY(0) translateX(0) scale(1);          opacity: 0; }
  8%   { opacity: .50; }
  62%  { transform: translateY(-42vh) translateX(8px) scale(1);    opacity: .44; }
  76%  { transform: translateY(-45vh) translateX(9px) scale(2.8);  opacity: 0; }
  100% { transform: translateY(-45vh) translateX(9px) scale(2.8);  opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .brew-chat-bubble { animation: none; opacity: 0; }
}

/* ── iOS install banner ─────────────────────────────────────── */
.brew-ios-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1050;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1rem;
  background: var(--hops);
  color: #fff;
  font-size: .9rem;
}
