/* ==========================================================================
   Tama Sushi Web App
   Structure: tokens, base, public views, ordering menu, cart, modals, admin,
   responsive rules.
   ========================================================================== */

/* 1. Design Tokens */
:root {
  --bg: #070b11;
  --bg-soft: #101720;
  --panel: rgba(18, 25, 35, 0.86);
  --panel-strong: rgba(12, 18, 26, 0.94);
  --gold: #d7b56d;
  --gold-soft: #f2d590;
  --text: #f7f0df;
  --muted: #aab2bd;
  --line: rgba(215, 181, 109, 0.22);
  --line-soft: rgba(255, 255, 255, 0.09);
  --danger: #e35d5d;
  --ok: #6fd08c;
  --blue: #69a7ff;
  --radius: 8px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  --shadow-soft: 0 14px 34px rgba(215, 181, 109, 0.18);
}

/* 2. Base */
* {
  box-sizing: border-box;
}

html {
  max-width: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  max-width: 100%;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  background:
    radial-gradient(circle at 20% 0%, #15202d 0, #070b11 42%, #05070b 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-shell,
.admin-shell,
.page-section,
.order-layout {
  width: 100%;
  overflow-x: hidden;
}

.app-shell,
.admin-shell {
  min-height: 100vh;
}

.view-section {
  display: none;
}

.view-section.active {
  display: block;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.brand-mark {
  color: var(--gold-soft);
  font-family: Georgia, serif;
  font-size: 44px;
  letter-spacing: 5px;
  text-shadow: 0 14px 40px rgba(215, 181, 109, 0.2);
}

.brand-logo {
  width: min(480px, 88vw);
  max-height: 310px;
  object-fit: contain;
  margin-bottom: 18px;
  filter: drop-shadow(0 18px 42px rgba(215, 181, 109, 0.2));
  transform-origin: center;
  animation: logoFloat 4.8s ease-in-out infinite;
}

.hero-logo-wrap {
  display: grid;
  place-items: center;
  margin-bottom: 30px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  border: 0;
  border-radius: var(--radius);
  padding: 13px 18px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: normal;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.primary {
  color: #15100a;
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  box-shadow: var(--shadow-soft);
}

.secondary {
  border: 1px solid var(--line);
  color: var(--gold-soft);
  background: transparent;
}

.hero .primary,
.hero .secondary {
  width: min(340px, 100%);
  min-height: 58px;
  padding: 16px 24px;
  border-radius: 10px;
  font-size: 17px;
  letter-spacing: 0.2px;
}

.hero .primary {
  box-shadow:
    0 16px 34px rgba(215, 181, 109, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.18) inset;
}

.hero .secondary {
  border-color: rgba(215, 181, 109, 0.45);
  background: rgba(215, 181, 109, 0.06);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}

.hero .secondary:hover {
  color: #15100a;
  background: linear-gradient(135deg, rgba(215, 181, 109, 0.92), var(--gold-soft));
}

.full {
  width: 100%;
}

.input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  outline: none;
  padding: 12px 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
}

.input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(215, 181, 109, 0.12);
}

select.input option {
  background: var(--bg-soft);
}

.icon-btn,
.close {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--gold-soft);
  background: rgba(255, 255, 255, 0.04);
  font-size: 22px;
}

.close {
  position: absolute;
  top: 14px;
  right: 14px;
}

.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 90;
  transform: translateX(-50%) translateY(-20px);
  border-radius: 999px;
  padding: 10px 16px;
  color: #15100a;
  background: var(--gold);
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 3. Public Shell */
.hero {
  position: relative;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 48px 22px 84px;
  text-align: center;
}

.hero.active {
  display: flex;
}

.hero h1,
.admin-login h1 {
  margin: 10px 0 16px;
  font-size: clamp(32px, 7vw, 72px);
}

.hero-copy {
  max-width: 620px;
  margin: 0 auto 28px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.hero-actions,
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}

.hero-actions {
  width: min(720px, 100%);
  margin-top: 0;
}

.hero footer {
  position: absolute;
  right: 18px;
  bottom: 28px;
  left: 18px;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
}

.page-section {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 18px 110px;
}

.section-head,
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.section-head > div {
  flex: 1;
}

.section-head h2,
.admin-header h1 {
  margin: 0;
  font-size: clamp(26px, 5vw, 44px);
}

/* 4. Visual Menu */
.menu-images {
  display: grid;
  gap: 22px;
}

.menu-images img,
.menu-img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  object-fit: contain;
  background: linear-gradient(135deg, #141d28, #0b1017);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.35);
}

.placeholder-img::after {
  content: "Coloca aqui la URL de la imagen del menu";
  display: grid;
  height: 100%;
  place-items: center;
  color: var(--muted);
}

.floating-order {
  display: none !important;
}

/* 5. Ordering Menu */
.order-layout {
  max-width: 1240px;
}

.catalog-tools {
  position: sticky;
  top: 0;
  z-index: 5;
  margin-bottom: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 14px;
  background: rgba(10, 15, 22, 0.82);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(14px);
}

.catalog-tools .input {
  height: 46px;
  background: rgba(255, 255, 255, 0.04);
}

.chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  max-height: none;
  padding: 12px 0 2px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  min-width: max-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  color: #d8deea;
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
  white-space: nowrap;
}

.chip.active {
  color: #15100a;
  background: var(--gold);
  box-shadow: 0 10px 24px rgba(215, 181, 109, 0.18);
}

.order-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: start;
  gap: 20px;
}

.products {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
}

.menu-section {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018));
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.22);
}

.menu-section::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.72;
}

.menu-section-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 18px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(215, 181, 109, 0.16);
  padding-bottom: 14px;
}

.menu-section-head h3 {
  margin: 3px 0 6px;
  color: #fff3d3;
  font-family: Georgia, serif;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 700;
}

.menu-section-head p {
  max-width: 640px;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.section-kicker {
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1.7px;
  text-transform: uppercase;
}

.section-count {
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--gold-soft);
  background: rgba(215, 181, 109, 0.07);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.section-products {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.product-card,
.cart-panel,
.modal-card,
.stats-grid article,
.order-card,
.login-card,
.success-card {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.product-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  align-items: center;
  gap: 14px;
  min-height: 108px;
  padding: 15px;
  border-color: rgba(255, 255, 255, 0.075);
  background: rgba(8, 12, 18, 0.62);
  box-shadow: none;
  animation: rise 0.28s ease;
}

.product-card:hover {
  border-color: rgba(215, 181, 109, 0.36);
  background: rgba(14, 20, 29, 0.78);
}

.product-copy {
  min-width: 0;
}

.product-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}

.product-card h4 {
  margin: 0;
  color: #fff;
  font-size: 17px;
  font-weight: 850;
  line-height: 1.2;
}

.product-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.42;
}

.price {
  color: var(--gold-soft);
  font-size: 17px;
  font-weight: 900;
  white-space: nowrap;
}

.add-btn {
  position: relative;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(215, 181, 109, 0.42);
  border-radius: 50%;
  color: transparent;
  background: rgba(215, 181, 109, 0.1);
  font-size: 0;
}

.add-btn::before,
.add-btn::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 2px;
  background: var(--gold-soft);
  transform: translate(-50%, -50%);
}

.add-btn::before {
  width: 15px;
  height: 2px;
}

.add-btn::after {
  width: 2px;
  height: 15px;
}

.add-btn:hover {
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  transform: translateY(-1px);
}

.add-btn:hover::before,
.add-btn:hover::after {
  background: #15100a;
}

/* 6. Cart */
.cart-panel {
  position: sticky;
  top: 118px;
  height: max-content;
  padding: 16px;
  border-color: rgba(215, 181, 109, 0.16);
  background: rgba(12, 18, 26, 0.9);
}

.cart-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(215, 181, 109, 0.14);
  padding-bottom: 12px;
}

.cart-head h3 {
  margin: 0;
  color: #fff3d3;
  font-family: Georgia, serif;
}

.cart-items {
  display: grid;
  gap: 12px;
  max-height: 48vh;
  margin: 14px 0;
  overflow: auto;
}

.cart-item {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 12px;
}

.cart-row-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.qty {
  display: flex;
  align-items: center;
  gap: 7px;
}

.qty button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--gold-soft);
  background: transparent;
}

.comment-input {
  margin-top: 8px;
  font-size: 13px;
}

.remove {
  border: 0;
  padding: 6px 0;
  color: var(--danger);
  background: none;
}

.cart-total {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding-top: 12px;
}

.mobile-cart-bar {
  display: none;
  position: fixed;
  right: 14px;
  bottom: 14px;
  left: 14px;
  z-index: 30;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: #15100a;
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  font-weight: 900;
}

.mobile-cart-bar.is-visible {
  display: flex;
}

/* 7. Forms, Modals, Confirmation */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.68);
}

.modal-card {
  position: relative;
  width: min(720px, 100%);
  max-height: 92vh;
  overflow: auto;
  padding: 22px;
}

.modal-card.side {
  width: min(430px, 100%);
  height: 100%;
  max-height: none;
  margin-left: auto;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}

.address-fields {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 1fr;
  gap: 14px;
}

.full-field {
  grid-column: 1 / -1;
}

.summary {
  display: grid;
  gap: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.summary strong {
  color: var(--text);
}

.summary-box {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(255, 255, 255, 0.025);
}

.confirmation {
  display: none;
  min-height: 100vh;
  place-items: center;
}

.confirmation.active {
  display: grid;
}

.success-card,
.login-card {
  width: min(520px, 100%);
  padding: 28px;
  text-align: center;
}

/* 8. Admin */
.admin-shell {
  padding: 22px;
}

.admin-login {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.admin-panel {
  max-width: 1280px;
  margin: 0 auto;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stats-grid article {
  padding: 16px;
}

.stats-grid span {
  display: block;
  color: var(--muted);
}

.stats-grid strong {
  color: var(--gold-soft);
  font-size: 30px;
}

.admin-filters {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1.3fr auto;
  gap: 10px;
  margin-bottom: 16px;
}

.orders-list {
  display: grid;
  gap: 10px;
}

.order-card {
  border-left: 4px solid var(--gold);
  padding: 14px;
}

.order-card.new-flash {
  animation: flash 1.4s ease 3;
}

.order-main {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
}

.order-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.order-title h3 {
  margin: 0;
}

.order-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 14px;
}

.order-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.status-select {
  max-width: 190px;
}

.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
}

.st-nuevo {
  color: var(--gold-soft);
  background: rgba(215, 181, 109, 0.22);
}

.st-en-preparacion {
  color: #ffd666;
  background: rgba(255, 214, 102, 0.18);
}

.st-listo-para-recoger {
  color: #9cf2b5;
  background: rgba(125, 231, 154, 0.18);
}

.st-enviado {
  color: #9fc5ff;
  background: rgba(105, 167, 255, 0.18);
}

.st-completado {
  color: var(--ok);
  background: rgba(111, 208, 140, 0.2);
}

.st-cancelado {
  color: #ff9b9b;
  background: rgba(227, 93, 93, 0.2);
}

.new-order-alert {
  position: sticky;
  top: 10px;
  z-index: 20;
  margin-bottom: 12px;
  border-radius: var(--radius);
  padding: 12px 16px;
  color: #15100a;
  background: var(--gold);
  font-weight: 900;
  text-align: center;
}

/* 9. Animations */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes flash {
  50% {
    box-shadow: 0 0 0 4px rgba(215, 181, 109, 0.35);
  }
}

@keyframes logoFloat {
  0%,
  100% {
    transform: translateY(0) scale(1);
    filter: drop-shadow(0 18px 42px rgba(215, 181, 109, 0.18));
  }

  50% {
    transform: translateY(-8px) scale(1.015);
    filter: drop-shadow(0 24px 52px rgba(215, 181, 109, 0.32));
  }
}

@media (prefers-reduced-motion: reduce) {
  .brand-logo {
    animation: none;
  }
}

/* 10. Responsive */
@media (max-width: 1100px) {
  .order-grid {
    grid-template-columns: minmax(0, 1fr) 330px;
  }

  .section-products {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .brand-mark {
    font-size: 34px;
  }

  .page-section {
    padding-right: 16px;
    padding-bottom: 96px;
    padding-left: 16px;
  }

  .order-grid {
    grid-template-columns: 1fr;
  }

  .desktop-cart {
    display: none;
  }

  .catalog-tools,
  .menu-section {
    width: 100%;
    margin-right: 0;
    margin-left: 0;
  }

  .menu-section {
    padding: 16px;
  }

  .menu-section-head {
    grid-template-columns: 1fr;
  }

  .section-count {
    justify-self: start;
  }

  .product-card {
    width: 100%;
    min-width: 0;
    min-height: auto;
  }

  .form-grid,
  .address-fields,
  .stats-grid,
  .admin-filters {
    grid-template-columns: 1fr;
  }

  .admin-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .order-meta {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .hero {
    padding: 40px 16px 84px;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .section-head {
    align-items: flex-start;
  }

  .menu-images img,
  .menu-img {
    height: auto;
    min-height: auto;
  }

  .catalog-tools {
    margin-right: 0;
    margin-left: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    padding: 12px;
  }

  .chip {
    width: auto;
    padding: 10px 14px;
    line-height: 1.15;
    text-align: center;
  }

  .menu-section {
    margin-right: 0;
    margin-left: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    padding: 15px;
  }

  .menu-section-head h3 {
    font-size: 27px;
  }

  .menu-section-head p {
    font-size: 15px;
  }

  .section-count {
    display: none;
  }

  .product-card {
    grid-template-columns: minmax(0, 1fr) 36px;
    align-items: center;
    gap: 11px;
    padding: 11px;
  }

  .product-title-row {
    display: block;
  }

  .product-card h4 {
    overflow-wrap: anywhere;
    font-size: 15.5px;
  }

  .product-card p {
    display: -webkit-box;
    overflow: hidden;
    font-size: 12.5px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  .product-card .price {
    display: block;
    margin-top: 5px;
    font-size: 16px;
  }

  .add-btn {
    width: 34px;
    height: 34px;
  }

  .mobile-cart-bar {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }

  .modal-card {
    padding: 18px;
  }

  .order-main,
  .order-meta {
    grid-template-columns: 1fr;
  }

  .order-actions {
    justify-content: flex-start;
  }
}

/* Corrección carga de imágenes */
.menu-image-box {
  width: 100%;
}
.menu-image-box .image-error-msg {
  display: none;
  min-height: 220px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  place-items: center;
  padding: 22px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  text-align: center;
}
.menu-image-box.image-error .image-error-msg {
  display: grid;
}
