/* =========================
   ROOT VARIABLES
   ========================= */
:root {
  --font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  --gap: 24px;
  --accent: #6b3e1b; /* dark brown accent for buttons/PS cards */
  --muted: #666;
  --pill-font-size: 0.85rem;
  --pill-padding: 4px 8px;
  --pill-radius: 12px;
  --pill-max-width: 80px;
}

/* =========================
   GLOBAL BOX-SIZING
   ========================= */
*, *::before, *::after {
  box-sizing: border-box;
}

/* =========================
   BODY & CONTAINER
   ========================= */
body {
  font-family: var(--font-family);
  background-color: #fff8f0;
  color: #3e2c1b;
  margin: 0;
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* =========================
   HEADER
   ========================= */
header {
  background: linear-gradient(90deg, #6b3e1b, #8b5a32);
  color: white;
  padding: calc(18px + env(safe-area-inset-top)) 0 18px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

header h1 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: 0.6px;
}

header p {
  margin: 6px 0 0 0;
  font-size: 0.9rem;
  opacity: 0.95;
}

/* Header inner container */
header > div {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--gap);
}

/* =========================
   BEER GRID & CARDS
   ========================= */
/* Keep beer grid visible below Admin sections */
.grid-container {
  margin-top: 1rem;
  z-index: 1;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--gap);
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
  position: relative;
  z-index: 2;
}

/* Prairie Sun overlay */
.ps-overlay {
  position: absolute;
  top: 50%;
  right: 5%;
  transform: translateY(-50%);
  background-image: url("/images/prairie-sun-light-logo.png");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
  width: 25%;
  aspect-ratio: 1 / 1;
  animation: pulseWatermark 4s infinite ease-in-out;
}

/* Keep all content above the overlay */
.card > *:not(.ps-overlay) {
  position: relative;
  z-index: 1;
}

/* =========================
   META / SEARCH
   ========================= */
.meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.meta .updated {
  color: var(--muted);
  font-size: 0.9rem;
}

input[type=search] {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #ddd;
  width: 100%;
  max-width: 340px;
}

/* =========================
   META ROW (ABV / IBU)
   ========================= */
.meta-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 4px;
}

/* =========================
   PILLS (ABV, IBU, ON TAP, NOT ON)
   ========================= */
.pill, .on-tap, .not-on {
  display: inline-block;
  padding: var(--pill-padding);
  border-radius: var(--pill-radius);
  font-size: var(--pill-font-size);
  text-align: left;
  max-width: var(--pill-max-width);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

/* ABV / Not-On pill */
.pill, .not-on {
  background: #eee;
  color: #3e2c1b;
}

/* On Tap pill */
.on-tap {
  background: #dff5e1;          /* green background */
  color: #196619;               /* dark green text */
}

/* =========================
   Admin Toggle container
   ========================= */
.toggle-container {
  display: flex;
  justify-content: space-between; /* keep label left, slider right */
  align-items: center;
  padding: var(--pill-padding);
  border-radius: var(--pill-radius);
  background: #dff5e1;
  font-size: var(--pill-font-size);
  width: 50%;
}

.toggle-container .toggle {
  flex-shrink: 0;
}

/* Toggle box & slider */
.toggle {
  position: relative;
  display: inline-block;
  width: 60px;  /* wider so knob can move fully */
  height: 28px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;  /* gray when off */
  transition: 0.4s;
  border-radius: 28px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

.toggle input:checked + .slider {
  background-color: #4caf50; /* green when ON */
}

.toggle input:checked + .slider:before {
  transform: translateX(32px); /* knob moves right when ON */
}

/* Mobile / iPhone adjustments */
@media (max-width: 500px) {
  .toggle {
    width: 50px;
  }
  .slider:before {
    width: 22px;
    height: 22px;
  }
  .toggle input:checked + .slider:before {
    transform: translateX(26px);
  }
}
/* =========================
   TAGS & SIZES
   ========================= */
.tags {
  display: flex;
  gap: var(--gap);
  flex-wrap: wrap;
  margin-top: 8px;
}

.tag {
  font-size: 0.78rem;
  color: var(--muted);
  background: #f6f6f6;
  padding: 4px 8px;
  border-radius: 999px;
}

.sizes {
  margin-top: 10px;
  display: flex;
  gap: var(--gap);
  flex-wrap: wrap;
}

.size {
  font-weight: 700;
}

/* =========================
   FOOTER
   ========================= */
footer {
  padding: 12px;
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

.tv-note {
  display: none;
}

@media (min-width: 900px) {
  header h1 { font-size: 1.35rem; }
  .tv-note { display: block; font-size: 0.9rem; color: #fff; opacity: 0.9; }
}

/* =========================
   AFTER ADMIN LOGIN MODAL
   ========================= */
   
#saveTaplistBtn,
#exitAdminBtn {
  display: none; /* hide by default */
}
body.admin-mode #saveTaplistBtn,
body.admin-mode #exitAdminBtn {
  display: inline-block; /* show in admin mode */
}

body.admin-mode #adminBtn {
  display: none;
}

/* =========================
   ADMIN PAGE
   ========================= */
#adminPage {
  display: none; /* Hidden until Admin login */
  margin-top: 2rem;
  padding: var(--gap);
  position: relative; /* flow layout */
  background: none;
}

#adminPanel {
  background-color: #f9f7f6; 
  padding: 1rem; 
  border-top: 2px solid var(--accent); 
}

#adminPanelHeader {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: var(--gap);
}

#adminPanelHeader button {
  padding: 8px 14px;
  border-radius: 6px;
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-size: 0.9rem;
  white-space: nowrap;
}


/* Beer list scrollable inside panel */
#adminBeerList {
  max-height: 60vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 8px;
}

/* =========================
   ADMIN LOGIN MODAL
   ========================= */
#adminLoginModal {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  justify-content: center; align-items: center;
  z-index: 3000;
}

#adminLoginModalContent {
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  max-width: 300px;
  width: 90%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#adminLoginError {
  color: red;
  display: none;
  font-size: 0.9rem;
}

/* =========================
   ADMIN BUTTONS
   ========================= */
#adminBtn {
  position: relative;
  z-index: 9999;
  cursor: pointer;
  background-color: var(--accent);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  font-size: 0.9rem;
}

#adminControls {
  display: none;
  gap: 10px;
  margin: 10px 0;
  align-items: center;
}

#adminControls .admin-btn {
  font-size: 0.9rem;
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
}

/* =========================
   ANIMATIONS
   ========================= */
@keyframes pulseWatermark {
  0%, 100% { opacity: 0.50; }
  50% { opacity: 1; }
}

html, body {
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* smooth iPhone scroll */
}

/* =========================
   MOBILE TWEAKS
   ========================= */
@media (max-width: 500px) {
  .card { padding: 8px; }
  .tags, .sizes { gap: 4px; }
}
@media (max-width: 500px) {
  .pill {
    max-width: 120px;   /* bigger pill on mobile so ABV fits */
  }
}

/* New buttons container */
.header-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap; /* allows wrapping on narrow screens */
}

/* Make buttons smaller on narrow screens */
@media (max-width: 500px) {
  .header-buttons button {
    padding: 4px 8px;
    font-size: 0.85rem;
  }
}

/* ===============================
   COLOR ADMIN UP AND DOWN BUTTONS
   =============================== */
.admin-btn[data-action="move-up"] {
  background-color: #4CAF50; /* green */
  color: white;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
}

.admin-btn[data-action="move-down"] {
  background-color: #f44336; /* red */
  color: white;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
}

/* ===============================
   Highlight Beer name in renderAdminBeerInputs
   =============================== */
input.beer-name {
  background-color: #fff9c4; /* pale yellow */
  border: 1px solid #fdd835;
  border-radius: 4px;
  padding: 4px 6px;
}

/* ===============================
   Solo beer save button
   =============================== */
.admin-btn.save-beer-btn {
  background-color: #1e90ff; /* Dodger blue */
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s;
}

.admin-btn.save-beer-btn:hover:not(:disabled) {
  background-color: #1c86ee; /* slightly darker blue on hover */
}

.admin-btn.save-beer-btn:disabled {
  background-color: #a0c4ff; /* light blue for disabled */
  cursor: not-allowed;
}

/* Fullscreen Barley Field Background */
#background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("/images/barley_CHAT.png"); /* <-- your image here */
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  z-index: -1;
  filter: brightness(0.9); /* optional: darken slightly for contrast */
}

/* PSun filter button */
#psunFilter.active {
  background: #b55000;   /* keep the accent color */
  transform: scale(0.9); /* subtle press effect */
  opacity: 0.6;           /* faded look */
  transition: all 0.2s ease; /* smooth change when toggling */
}

.pending-off {
  opacity: 0.6;
  filter: grayscale(0.6);
  transition: opacity 0.3s ease, filter 0.3s ease;
}

#offsaleFilter.active {
  background: #b55000;   /* keep the accent color */
  transform: scale(0.9); /* subtle press effect */
  opacity: 0.6;           /* faded look */
  transition: all 0.2s ease; /* smooth change when toggling */
}

/* Offsale overlay (static image, no animation) */
.card.offsale .offsale-overlay {
  position: absolute;
  top: 50%;
  right: 5%;
  transform: translateY(-50%);
  background-image: url("/images/offsale_nobackground.png"); /* ensure this is a clean PNG */
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 1.0; /* fully visible */
  pointer-events: none;
  z-index: 0; /* stays below card content */
  width: 25%;
  aspect-ratio: 1 / 1;
}

/* Offsale card background (frosted amber bottle shop vibe) */
.card.offsale {
  background: linear-gradient(145deg, rgba(165, 107, 0, 0.9) 0%, rgba(212, 155, 51, 0.85) 70%, rgba(241, 194, 125, 0.8) 100%);
  border: 2px solid rgba(210, 155, 51, 0.6);
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 15px rgba(210, 155, 51, 0.25);
  color: #000000; /* pure black text */
  backdrop-filter: blur(2px); /* subtle frosted effect */
  border-radius: 8px;
}

/* Ensure all other content inside offsale card stays above overlay */
.card.offsale > *:not(.offsale-overlay) {
  position: relative;
  z-index: 1;
}

/* Force all text inside offsale card to black */
.card.offsale,
.card.offsale * {
  color: #000000 !important;
}

/* Full-screen intro layer */
#intro {
  position: fixed;
  inset: 0;
  background: #000; /* Black, looks premium — change if you want */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  opacity: 1;
  transition: opacity 2.0s ease;
}

/* Logo animation */
#intro-logo {
  width: 160px;
  opacity: 0;
  transform: scale(0.85);
  animation: introLogoFade 2.0s ease forwards;
}

@keyframes introLogoFade {
  0% {
    opacity: 0;
    transform: scale(0.85);
  }
  80% {
    opacity: 1;
    transform: scale(1.04);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Fade in the entire page AFTER intro disappears */
body {
  opacity: 0;
  transition: opacity 1.2s ease;
}
body.loaded {
  opacity: 1;
}

/* Both Prairie Sun Brewery & Offsale overlay (static image, no animation) */
.card.psunoffsale .psunoffsale-overlay {
  position: absolute;
  top: 50%;
  right: 5%;
  transform: translateY(-50%);
  background-image: url("/images/prairie-sun-light-logo.png"); /* ensure this is a clean PNG */
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 1.0; /* fully visible */
  pointer-events: none;
  z-index: 0; /* stays below card content */
  width: 25%;
  aspect-ratio: 1 / 1;
  animation: pulseWatermark 4s infinite ease-in-out;
}

/* Both Prairie Sun Brewery & Offsale card background (frosted amber bottle shop vibe) */
.card.psunoffsale {
  background: linear-gradient(145deg, rgba(165, 107, 0, 0.9) 0%, rgba(212, 155, 51, 0.85) 70%, rgba(241, 194, 125, 0.8) 100%);
  border: 2px solid rgba(210, 155, 51, 0.6);
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 15px rgba(210, 155, 51, 0.25);
  color: #000000; /* pure black text */
  backdrop-filter: blur(2px); /* subtle frosted effect */
  border-radius: 8px;
}

/* Both Prairie Sun Brewery & Offsale - Ensure all other content inside offsale card stays above overlay */
.card.psunoffsale > *:not(.psunoffsale-overlay) {
  position: relative;
  z-index: 1;
}

/* Force all text inside offsale card to black */
.card.psunoffsale,
.card.psunoffsale * {
  color: #000000 !important;
}

/* Controls container: stack two rows */
.controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-wrap: wrap;
}

/* Each row of controls */
.controls-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* General button styling */
.controls button {
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  background: var(--accent);
  color: white;
  font-size: 0.95rem;
  transition: transform 0.15s ease, background 0.15s ease;
}

/* Highlighted buttons: PSun & Offsale */
.highlight-btn {
  font-size: 1.1rem;
  font-weight: 600;
  padding: 10px 16px;
  background: linear-gradient(45deg, #b55000, #ff8800);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.highlight-btn:hover {
  transform: scale(1.05);
  background: linear-gradient(45deg, #ff6600, #ffaa33);
}


