/* ============================================================
   GLOBAL.CSS — Lama Worlds FoodCare
   Reset • Variables • Base • Galaxy BG • Glass • Buttons • Modals
   Admin Panel • Login • Share • History • Top Bar • Search
   ============================================================ */

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

/* -------------------------
   VARIABLES
------------------------- */
:root {
  --lw-bg: #050814;
  --lw-panel: rgba(8, 16, 32, 0.9);
  --lw-border: rgba(120, 190, 255, 0.4);

  --lw-accent: #45e0ff;
  --lw-accent-soft: #45e0ff55;

  --lw-text: #e5f3ff;
  --lw-text-soft: #b8c7e6;

  --lw-danger: #ff4b6a;
}

/* -------------------------
   BASE
------------------------- */
body {
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--lw-bg);
  color: var(--lw-text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 10px 80px;
  position: relative;
}

/* -------------------------
   BACKGROUND GALAXY
------------------------- */
.lw-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1100px 700px at 20% -10%, rgba(0, 170, 255, 0.12), transparent 55%),
    radial-gradient(800px 500px at 80% 0%, rgba(255, 0, 150, 0.08), transparent 60%),
    linear-gradient(180deg, #050814 0%, #050814 40%, #03050b 100%);
  overflow: hidden;
}

.lw-bg::before,
.lw-bg::after {
  content: "";
  position: absolute;
  inset: -40% -40%;
  background-image: radial-gradient(#ffffffd0 1px, transparent 1px);
  opacity: 0.035;
  background-size: 3px 3px;
  animation: twinkle 16s linear infinite;
}

.lw-bg::after {
  opacity: 0.02;
  background-size: 4px 4px;
  animation-duration: 24s;
  animation-direction: reverse;
}

@keyframes twinkle {
  0% {
    transform: translate3d(0, 0, 0);
  }

  100% {
    transform: translate3d(-60px, -60px, 0);
  }
}

/* -------------------------
   GLASS PANELS
------------------------- */
.glass {
  background: var(--lw-panel);
  border-radius: 14px;
  border: 1px solid var(--lw-border);
  backdrop-filter: blur(16px);
  box-shadow:
    0 0 22px rgba(0, 0, 0, 0.7),
    0 0 14px rgba(69, 224, 255, 0.12);
}

/* -------------------------
   LANG SWITCH BUTTON
------------------------- */
.lang-btn {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);

  width: 40px;
  height: 40px;

  padding: 2px;
  margin: 2px;
  border-radius: 10px;
  cursor: pointer;
  overflow: hidden;

  display: flex;
  justify-content: center;
  align-items: center;

  transition: 0.2s;
}

.lang-btn:hover {
  box-shadow: 0 0 10px #42e2ff;
  transform: translateY(-2px);
}

#lang-flag {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  transition: 0.18s ease;
}

/* -------------------------
   BUTTONS (global)
------------------------- */
.btn {
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.82rem;

  background: rgba(10, 20, 35, 0.9);
  border: 1px solid rgba(140, 190, 255, 0.4);
  color: var(--lw-text);

  cursor: pointer;
  transition: 0.15s;
}

.btn:hover {
  background: rgba(14, 28, 52, 1);
  box-shadow: 0 0 10px var(--lw-accent-soft);
}

.btn.small {
  padding: 4px 10px;
  font-size: 0.75rem;
  border: 1px solid rgba(120, 180, 230, 0.5);
}

.btn.small:hover {
  border-color: var(--lw-accent);
  background: rgba(10, 25, 45, 1);
}

.btn.tiny {
  padding: 3px 8px;
  font-size: 0.7rem;
}

.btn.primary {
  background: var(--lw-accent);
  color: #041018;
  border-color: var(--lw-accent);
}

.btn.danger {
  border-color: var(--lw-danger);
  color: #ffd7de;
  background: rgba(255, 75, 106, 0.12);
}

.btn.danger:hover {
  background: rgba(255, 75, 106, 0.25);
}

/* ============================================================
   GLOBAL MODALS
============================================================ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(1, 4, 12, 0.75);
  backdrop-filter: blur(10px);
}

.modal.hidden {
  display: none;
}

.modal-box {
  width: 100%;
  max-width: 360px;

  background: rgba(8, 16, 30, 0.98);
  border-radius: 14px;
  border: 1px solid var(--lw-border);

  padding: 16px 16px 14px;

  box-shadow: 0 0 24px rgba(0, 0, 0, 0.85);
}

.modal-box h3 {
  font-size: 1rem;
  margin-bottom: 6px;
}

.modal-sub {
  font-size: 0.8rem;
  color: var(--lw-text-soft);
  margin-bottom: 8px;
}

.modal-box * {
  pointer-events: auto;
}

/* ============================================================
   EDIT MODAL
============================================================ */
.edit-box {
  font-size: 0.8rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 8px;
}

.field span {
  color: var(--lw-text-soft);
}

.field input,
.field select,
.field textarea {
  padding: 5px 8px;
  font-size: 0.8rem;

  border-radius: 8px;
  border: 1px solid rgba(150, 210, 255, 0.5);
  background: rgba(4, 12, 24, 0.98);
  color: var(--lw-text);
}

.field textarea {
  resize: vertical;
  min-height: 60px;
}

/* ============================================================
   ADMIN PANEL
============================================================ */

.admin-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;

  max-width: 1100px;
  margin: 0 auto;

  padding: 8px 10px 12px;

  background: rgba(6, 14, 28, 0.97);
  border-top: 1px solid rgba(120, 180, 230, 0.4);

  border-radius: 16px 16px 0 0;

  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.9);
  z-index: 40;
}

.admin-panel.hidden {
  display: none;
}

.admin-handle {
  width: 40px;
  height: 3px;
  margin: 2px auto 6px;

  border-radius: 999px;
  background: rgba(160, 200, 240, 0.5);
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;

  margin-bottom: 6px;
}

.admin-label {
  font-size: 0.8rem;
  color: var(--lw-accent);
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

body.admin-mode .app-shell {
  padding-bottom: 110px;
}

/* ============================================================
   ADMIN LOGIN MODAL
============================================================ */

.admin-modal {
  position: fixed;
  inset: 0;

  z-index: 99999;

  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);

  display: flex;
  justify-content: center;
  align-items: center;
}

.admin-modal.hidden {
  display: none;
}

.admin-modal-content {
  width: 90%;
  max-width: 420px;

  padding: 25px 30px;
  border-radius: 18px;

  background: rgba(20, 40, 60, 0.55);
  border: 1px solid rgba(0, 180, 255, 0.3);
  backdrop-filter: blur(12px);

  box-shadow: 0 0 25px rgba(0, 180, 255, 0.35);
}

.admin-logo {
  width: 70px;
  height: 70px;
  border-radius: 12px;
  box-shadow: 0 0 15px rgba(0, 180, 255, 0.5);
}

.admin-modal-desc {
  margin: 15px 0;
  text-align: center;
  color: #d0eaff;
  opacity: 0.85;
}

.admin-input {
  width: 100%;
  padding: 12px;

  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);

  border: none;
  outline: none;

  font-size: 1rem;
  color: white;
}

.admin-eye {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);

  cursor: pointer;
  font-size: 1.1rem;
  color: #aadfff;
}

.admin-modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

/* ============================================================
   SHARE MODAL / HISTORY MODAL
============================================================ */

.share-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.history-list {
  max-height: 300px;
  overflow-y: auto;
}

/* ============================================================
   RESPONSIVE
============================================================ */

@media (min-width: 700px) {
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  }
}

@media (print) {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .lw-bg,
  .top-menu,
  .icon-actions,
  .admin-panel,
  .modal,
  .admin-modal {
    display: none !important;
  }

  .app-shell {
    max-width: 100%;
    padding: 0;
  }
}

/* ============================================================
   UTILITIES
============================================================ */

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* ============================================================
   FOOTER
============================================================ */

.footer {
  margin-top: 22px;
  padding: 18px 20px;
  border-radius: 16px;

  background: var(--lw-panel);
  border: 1px solid var(--lw-border);
  backdrop-filter: blur(16px);

  box-shadow:
    0 0 22px rgba(0, 0, 0, 0.7),
    0 0 14px rgba(69, 224, 255, 0.12);

  color: var(--lw-text-soft);
  font-size: 0.85rem;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
}

.footer-brand {
  font-size: 0.9rem;
  color: var(--lw-text);
}

.footer-project {
  font-size: 0.75rem;
  margin-top: -4px;
  color: rgb(21, 255, 0);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.8rem;
}

.footer-links a {
  color: var(--lw-text-soft);
  text-decoration: none;
  transition: 0.15s;
}

.footer-links a:hover {
  color: var(--lw-accent);
  text-shadow: 0 0 6px var(--lw-accent-soft);
}

.footer-links .sep {
  opacity: 0.6;
  color: var(--lw-text-soft);
}

/* ===================================================
   PAGE TABS
=================================================== */
.page-tabs {
  margin-top: 14px;
  padding: 8px;
  display: flex;
  justify-content: center;
  gap: 14px;

  border-radius: 14px;
  background: rgba(12, 20, 35, 0.75);
  border: 1px solid rgba(120, 190, 255, 0.35);
  backdrop-filter: blur(12px);
}

.page-tabs a {
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.9rem;

  color: var(--lw-text-soft);
  border: 1px solid rgba(130, 180, 240, 0.35);
  background: rgba(5, 15, 30, 0.85);

  transition: 0.2s;
}

.page-tabs a:hover {
  border-color: var(--lw-accent);
  color: var(--lw-text);
  box-shadow: 0 0 12px var(--lw-accent-soft);
}

.page-tabs a.active {
  background: var(--lw-accent);
  color: #041018;
  border-color: var(--lw-accent);
  box-shadow: 0 0 12px var(--lw-accent-soft);
}

.intro {
  margin-top: 14px;
  padding: 12px 14px;

  text-align: center;
  font-size: 0.9rem;
  color: var(--lw-text-soft);
}

/* -------------------------
   TOP BAR
------------------------- */
.top-bar {
  position: sticky;
  top: 8px;
  z-index: 20;
  padding: 10px 12px;

  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* BRAND */
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-logo-dot {
  width: 26px;
  height: 26px;
  border-radius: 999px;

  background:
    radial-gradient(circle at 30% 30%, #42e2ff, transparent 65%),
    radial-gradient(circle at 70% 70%, #ff4b91, transparent 65%);
  box-shadow: 0 0 18px #42e2ff88;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.brand-sub {
  font-size: 0.75rem;
  color: var(--lw-text-soft);
}

/* -------------------------
   TOP ACTIONS (search + buttons)
------------------------- */
.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Search bar wrapper - takes maximum available width */
.search-wrap {
  flex: 1;
  min-width: 0;
}

/* UNIFIED SEARCH BAR STYLING - Used across ALL pages */
.search-wrap input,
#search-input,
#search-ingredients,
#assistant-input {
  width: 100%;
  padding: 10px 16px;
  border-radius: 20px;

  border: 1px solid rgba(0, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);

  color: var(--lw-text);
  font-size: 0.95rem;

  outline: none;
  transition: 0.2s;
}

.search-wrap input::placeholder,
#search-input::placeholder,
#search-ingredients::placeholder,
#assistant-input::placeholder {
  color: #8bb;
}

.search-wrap input:focus,
#search-input:focus,
#search-ingredients:focus,
#assistant-input:focus {
  background: rgba(255, 255, 255, 0.12);
  border-color: #00dfff;
  box-shadow: 0 0 10px rgba(0, 200, 255, 0.3);
}

/* -------------------------
   ICON ACTIONS & BUTTONS
------------------------- */
.icon-actions {
  display: flex;
  gap: 4px;
}

.action-buttons-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;

  border-radius: 12px;
  padding: 6px 8px;
  min-width: 46px;

  background:
    radial-gradient(circle at 0 0, rgba(69, 224, 255, 0.2), transparent 55%),
    rgba(5, 15, 30, 0.9);

  border: 1px solid rgba(120, 180, 230, 0.4);
  color: var(--lw-text-soft);

  cursor: pointer;
  transition: 0.15s;
}

.icon-btn:hover {
  background: rgba(10, 25, 45, 0.96);
  border-color: var(--lw-accent);
  box-shadow: 0 0 12px var(--lw-accent-soft);
  color: var(--lw-text);
}

.icon-btn .icon {
  font-size: 1rem;
}

.icon-btn .label {
  font-size: 0.63rem;
  letter-spacing: 0.3px;
}