/* ═══════════════════════════════════════
   BHT Tea Blender — Production Styles
   Brown House & Tea brand design
   ═══════════════════════════════════════ */

:root {
  --bht-green: #1F3F2F;
  --bht-green-mid: #2D5A27;
  --bht-green-light: #E6F2E8;
  --bht-green-accent: #59A56D;
  --bht-cream: #FFFBF2;
  --bht-cream-dark: #F5F0E6;
  --bht-pink: #F8D7E8;
  --bht-pink-dark: #E8A5C3;
  --bht-rose: #F2C4D4;
  --bht-yellow: #F5D76E;
  --bht-yellow-bg: #FDF3D0;
  --bht-orange: #E06B44;
  --bht-text: #1F3F2F;
  --bht-text-light: #5A7A6A;
  --bht-white: #FFFFFF;
  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-soft: 0 4px 20px rgba(31,63,47,0.06);
  --shadow-card: 0 2px 12px rgba(31,63,47,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'filson-pro', sans-serif;
  background: var(--bht-cream);
  color: var(--bht-text);
  min-height: 100vh;
  font-weight: 300;
}

/* ─── TOP BAR ─── */
.top-bar {
  background: var(--bht-green);
  color: #fff;
  text-align: center;
  padding: 8px 16px;
  font-size: 0.8rem;
  font-weight: 400;
}
.top-bar a { color: #C4D4A0; text-decoration: underline; }

/* ─── HEADER ─── */
.header {
  background: var(--bht-white);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(31,63,47,0.06);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-logo {
  text-decoration: none;
  display: flex;
  align-items: center;
}
.header-logo img {
  height: 48px;
  width: auto;
}
.header-nav { display: flex; align-items: center; gap: 24px; }
.header-nav a {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--bht-text);
  text-decoration: none;
  font-weight: 400;
}
.header-nav a:hover { color: var(--bht-green-accent); }
.header-nav .nav-cta {
  background: var(--bht-green);
  color: #fff !important;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.8rem;
}

/* ─── HERO ─── */
.hero {
  background: linear-gradient(135deg, var(--bht-pink) 0%, #FCE4EC 50%, var(--bht-yellow-bg) 100%);
  padding: 3rem 1.5rem 2.5rem;
  text-align: center;
  margin: 16px;
  border-radius: var(--radius-xl);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; top: -20px; right: -20px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(255,255,255,0.4) 0%, transparent 70%);
  border-radius: 50%;
}
.hero::after {
  content: '🍵';
  position: absolute; top: 20px; right: 40px;
  font-size: 3rem; opacity: 0.15; transform: rotate(15deg);
}
.hero-content { position: relative; z-index: 1; max-width: 600px; margin: 0 auto; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bht-green); color: #fff;
  padding: 6px 16px; border-radius: 50px;
  font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 1rem;
}
.hero-badge .dot {
  width: 6px; height: 6px; background: #8FBE7A;
  border-radius: 50%; animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(1.3)} }
.hero h1 {
  font-family: 'new-spirit', serif;
  font-size: 2.6rem; font-weight: 500;
  line-height: 1.15; margin-bottom: 0.75rem;
  color: var(--bht-green);
}
.hero h1 em, .hero h1 span { font-style: italic; color: var(--bht-green-accent); }
.hero p {
  font-size: 1rem; color: var(--bht-text-light);
  line-height: 1.6; max-width: 460px; margin: 0 auto;
}

/* ─── LAYOUT ─── */
.main-container { max-width: 1140px; margin: 0 auto; padding: 0 16px; }
.app-layout {
  display: grid; grid-template-columns: 1fr 300px;
  gap: 16px; margin-top: -1rem;
  position: relative; z-index: 2; align-items: start;
}

/* ─── CHAT BOX ─── */
.chat-box {
  background: var(--bht-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  min-height: 520px;
  display: flex; flex-direction: column;
}
.chat-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  background: var(--bht-white);
  border-bottom: 1px solid rgba(31,63,47,0.06);
}
.chat-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, var(--bht-green-accent), var(--bht-green));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
}
.chat-header-info h3 {
  font-family: 'new-spirit', serif;
  font-size: 1rem; font-weight: 500; color: var(--bht-green);
}
.chat-header-info p {
  font-size: 0.75rem; color: var(--bht-green-accent);
  display: flex; align-items: center; gap: 4px;
}
.chat-header-info p::before {
  content: ''; width: 6px; height: 6px;
  background: var(--bht-green-accent); border-radius: 50%;
}
.chat-messages {
  flex: 1; padding: 20px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
  max-height: 480px; scroll-behavior: smooth;
  background: var(--bht-cream);
}
.message {
  display: flex; gap: 10px; max-width: 85%;
  animation: msgIn .35s ease-out;
}
@keyframes msgIn { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }
.message.ai { align-self: flex-start; }
.message.user { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 0.8rem;
}
.message.ai .msg-avatar { background: linear-gradient(135deg, var(--bht-green-accent), var(--bht-green)); }
.message.user .msg-avatar { background: var(--bht-pink-dark); color: #fff; font-size: 0.7rem; }
.msg-bubble {
  padding: 12px 16px; border-radius: var(--radius-lg);
  font-size: 0.9rem; line-height: 1.6;
}
.message.ai .msg-bubble {
  background: var(--bht-white); color: var(--bht-text);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(31,63,47,0.06);
}
.message.user .msg-bubble {
  background: var(--bht-green); color: #fff;
  border-bottom-right-radius: 4px;
}
.msg-bubble strong { font-weight: 600; }

/* Quick replies */
.quick-replies { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; animation: msgIn .4s ease-out; }
.quick-reply {
  padding: 8px 16px; border: 1.5px solid var(--bht-green);
  border-radius: 50px; background: var(--bht-white);
  color: var(--bht-green); font-size: 0.8rem;
  cursor: pointer; transition: all .2s;
  font-family: 'filson-pro', sans-serif;
}
.quick-reply:hover {
  background: var(--bht-green); color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(31,63,47,0.15);
}

/* Chat input */
.chat-input-area {
  padding: 14px 18px; background: var(--bht-white);
  border-top: 1px solid rgba(31,63,47,0.06);
}
.chat-input-row { display: flex; gap: 10px; align-items: flex-end; }
.chat-input {
  flex: 1; border: 1.5px solid rgba(31,63,47,0.12);
  border-radius: var(--radius-lg); padding: 12px 16px;
  font-size: 0.9rem; font-family: 'filson-pro', sans-serif;
  outline: none; transition: border-color .2s, box-shadow .2s;
  resize: none; min-height: 44px; max-height: 120px;
  line-height: 1.5; background: var(--bht-cream);
}
.chat-input:focus {
  border-color: var(--bht-green-accent);
  box-shadow: 0 0 0 3px rgba(89,165,109,0.1);
}
.chat-input::placeholder { color: rgba(31,63,47,0.3); }
.send-btn {
  width: 44px; height: 44px; border-radius: var(--radius-md);
  border: none; background: var(--bht-green); color: #fff;
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; transition: all .2s; flex-shrink: 0;
}
.send-btn:hover {
  background: var(--bht-green-mid);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(31,63,47,0.2);
}
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.send-btn svg { width: 20px; height: 20px; }
.char-counter {
  font-size: 0.7rem; color: rgba(31,63,47,0.3);
  text-align: right; margin-top: 4px;
}
.rate-limit-info {
  background: var(--bht-yellow-bg); border: 1px solid var(--bht-yellow);
  border-radius: var(--radius-sm); padding: 8px 12px;
  font-size: 0.8rem; color: var(--bht-text); margin-bottom: 8px;
}

/* ─── INGREDIENTS PANEL ─── */
.ingredients-panel {
  background: var(--bht-white); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft); overflow: hidden;
  position: sticky; top: 80px;
}
.panel-header {
  padding: 16px 18px;
  background: linear-gradient(135deg, var(--bht-green-light) 0%, #D4ECD8 100%);
  display: flex; align-items: center; gap: 8px;
}
.panel-header h3 {
  font-family: 'new-spirit', serif;
  font-size: 0.95rem; font-weight: 500; color: var(--bht-green);
}
.panel-body { max-height: 440px; overflow-y: auto; }
.ing-category { border-bottom: 1px solid rgba(31,63,47,0.04); }
.ing-category-header {
  padding: 10px 18px; background: var(--bht-cream);
  font-size: 0.75rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--bht-text); cursor: pointer;
  display: flex; justify-content: space-between;
  align-items: center; user-select: none; transition: background .15s;
}
.ing-category-header:hover { background: var(--bht-green-light); }
.ing-category-header .arrow { transition: transform .2s; font-size: 0.6rem; }
.ing-category-header.open .arrow { transform: rotate(90deg); }
.ing-category-list { display: none; }
.ing-category-list.open { display: block; }
.ing-item {
  padding: 7px 18px 7px 28px; font-size: 0.8rem;
  color: var(--bht-text);
  border-bottom: 1px solid rgba(31,63,47,0.03);
  cursor: pointer; transition: background .15s;
  display: flex; align-items: center; gap: 8px;
}
.ing-item:hover { background: var(--bht-green-light); }
.ing-item .ing-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.ing-item .ing-dot.baza { background: var(--bht-green); }
.ing-item .ing-dot.dodatek { background: var(--bht-green-accent); }
.ing-item .ing-dot.akcent { background: var(--bht-orange); }
.ing-item-name { font-weight: 500; flex: 1; }
.ing-item-role { font-size: 0.65rem; color: #999; }
.panel-legend {
  padding: 10px 18px; display: flex; gap: 14px;
  border-top: 1px solid rgba(31,63,47,0.06);
  font-size: 0.7rem; color: #999; background: var(--bht-cream);
}
.panel-legend span { display: flex; align-items: center; gap: 4px; }
.panel-legend .dot-leg { width: 6px; height: 6px; border-radius: 50%; }
.panel-legend .dot-leg.baza { background: var(--bht-green); }
.panel-legend .dot-leg.dodatek { background: var(--bht-green-accent); }
.panel-legend .dot-leg.akcent { background: var(--bht-orange); }

/* ─── RECIPE CARD ─── */
.recipe-card {
  background: linear-gradient(135deg, var(--bht-yellow-bg) 0%, #FFF8E8 100%);
  border: 2px solid var(--bht-yellow);
  border-radius: var(--radius-lg); padding: 20px; margin-top: 8px;
}
.recipe-card h4 {
  font-family: 'new-spirit', serif;
  font-size: 1.15rem; color: var(--bht-green);
  margin-bottom: 4px; font-weight: 500;
}
.recipe-card .recipe-subtitle {
  font-size: 0.8rem; color: var(--bht-text-light);
  font-style: italic; margin-bottom: 14px;
}
.recipe-ingredients { list-style: none; margin-bottom: 12px; }
.recipe-ingredients li {
  display: flex; justify-content: space-between;
  align-items: center; padding: 7px 0;
  border-bottom: 1px solid rgba(31,63,47,0.06); font-size: 0.85rem;
}
.recipe-ingredients li:last-child { border-bottom: none; }
.recipe-ingredients .ing-name { font-weight: 500; color: var(--bht-text); }
.recipe-ingredients .ing-role-tag {
  font-size: 0.7rem; color: var(--bht-green-accent);
  background: var(--bht-green-light); padding: 2px 10px; border-radius: 50px;
}
.recipe-ingredients .ing-pct { font-weight: 600; color: var(--bht-green); }
.recipe-desc {
  font-size: 0.85rem; line-height: 1.6; color: var(--bht-text-light);
  padding: 10px 0; border-top: 1px solid rgba(31,63,47,0.08);
}
.recipe-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.recipe-btn {
  padding: 12px 24px; border-radius: var(--radius-sm);
  font-size: 0.85rem; font-weight: 600; cursor: pointer;
  transition: all .2s; font-family: 'filson-pro', sans-serif; border: none;
}
.recipe-btn.primary { background: var(--bht-green); color: #fff; }
.recipe-btn.primary:hover {
  background: var(--bht-green-mid);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(31,63,47,0.2);
}
.recipe-btn.secondary {
  background: var(--bht-white);
  border: 1.5px solid var(--bht-green); color: var(--bht-green);
}
.recipe-btn.secondary:hover { background: var(--bht-green); color: #fff; }

/* ─── HOW IT WORKS ─── */
.how-it-works { padding: 3rem 0 2rem; }
.how-it-works h2 {
  font-family: 'new-spirit', serif;
  font-size: 1.6rem; text-align: center;
  color: var(--bht-green); margin-bottom: 1.5rem; font-weight: 500;
}
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.step {
  border-radius: var(--radius-xl); padding: 1.5rem 1.25rem;
  text-align: center; transition: transform .2s;
}
.step:nth-child(1) { background: var(--bht-pink); }
.step:nth-child(2) { background: var(--bht-green-light); }
.step:nth-child(3) { background: var(--bht-yellow-bg); }
.step:nth-child(4) { background: #E8D4F0; }
.step:hover { transform: translateY(-3px); }
.step-num {
  width: 40px; height: 40px; background: var(--bht-green);
  color: #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; margin: 0 auto 0.75rem;
}
.step h4 {
  font-family: 'new-spirit', serif;
  font-size: 1rem; color: var(--bht-green);
  margin-bottom: 0.4rem; font-weight: 500;
}
.step p { font-size: 0.8rem; color: var(--bht-text-light); line-height: 1.5; }

/* ─── FOOTER ─── */
.footer {
  background: var(--bht-cream-dark);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  text-align: center; padding: 2.5rem 1rem; margin-top: 2rem;
}
.footer-brand {
  font-family: 'new-spirit', serif;
  font-size: 1.1rem; color: var(--bht-green); font-weight: 600;
}
.footer-logo { height: 40px; width: auto; }
.footer p { font-size: 0.8rem; color: var(--bht-text-light); margin-top: 4px; }
.footer-links { margin-top: 12px; display: flex; gap: 20px; justify-content: center; }
.footer-links a {
  font-size: 0.8rem; color: var(--bht-text-light); text-decoration: none;
}
.footer-links a:hover { color: var(--bht-green); text-decoration: underline; }

/* ─── ORDER MODAL ─── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(31,63,47,0.5);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; backdrop-filter: blur(4px);
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bht-white); border-radius: var(--radius-xl);
  padding: 2rem; max-width: 500px; width: 90%;
  box-shadow: 0 20px 60px rgba(31,63,47,0.15);
  max-height: 90vh; overflow-y: auto;
}
.modal h2 {
  font-family: 'new-spirit', serif;
  font-size: 1.4rem; color: var(--bht-green);
  margin-bottom: 1rem;
}
.modal .form-group { margin-bottom: 1rem; }
.modal label {
  display: block; font-size: 0.85rem;
  font-weight: 500; margin-bottom: 4px; color: var(--bht-text);
}
.modal input, .modal textarea, .modal select {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid rgba(31,63,47,0.12);
  border-radius: var(--radius-sm);
  font-size: 0.9rem; font-family: 'filson-pro', sans-serif;
  background: var(--bht-cream); outline: none;
  transition: border-color .2s;
}
.modal input:focus, .modal textarea:focus {
  border-color: var(--bht-green-accent);
}
.modal .gdpr-check {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 0.8rem; color: var(--bht-text-light);
}
.modal .gdpr-check input[type="checkbox"] { width: auto; margin-top: 2px; }
.modal .modal-actions { display: flex; gap: 10px; margin-top: 1.5rem; }
.modal .btn-submit {
  flex: 1; padding: 12px; background: var(--bht-green);
  color: #fff; border: none; border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
  font-family: 'filson-pro', sans-serif; transition: all .2s;
}
.modal .btn-submit:hover { background: var(--bht-green-mid); }
.modal .btn-cancel {
  padding: 12px 20px; background: transparent;
  border: 1.5px solid rgba(31,63,47,0.15);
  border-radius: var(--radius-sm);
  color: var(--bht-text-light); cursor: pointer;
  font-family: 'filson-pro', sans-serif;
}

/* ─── TYPING INDICATOR ─── */
.typing-indicator { display: flex; gap: 4px; padding: 8px 16px; }
.typing-indicator span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--bht-green-accent); opacity: 0.3;
  animation: typing 1.4s ease-in-out infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%,100%{opacity:.3;transform:scale(1)} 50%{opacity:1;transform:scale(1.2)} }

/* ─── ERROR ─── */
.error-msg {
  background: #FFF0F0; border: 1px solid #FFB4B4;
  border-radius: var(--radius-sm); padding: 10px 14px;
  font-size: 0.85rem; color: #C53030;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 900px) {
  .app-layout { grid-template-columns: 1fr; }
  .ingredients-panel { order: -1; position: relative; top: 0; }
  .panel-body { max-height: 200px; }
  .header-nav a:not(.nav-cta) { display: none; }
}
@media (max-width: 640px) {
  .hero { padding: 2rem 1rem; margin: 10px; }
  .hero h1 { font-size: 1.8rem; }
  .chat-messages { max-height: 380px; padding: 14px; }
  .steps { grid-template-columns: 1fr 1fr; }
  .recipe-actions { flex-direction: column; }
  .recipe-btn { width: 100%; text-align: center; }
}
@media (max-width: 400px) {
  .steps { grid-template-columns: 1fr; }
}
