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

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: #0a0a0a;
  color: #f0f0f0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 40px;
  line-height: 1.5;
}

body.has-bottom-bar {
  padding-bottom: 110px;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  max-width: 1200px;
  width: 100%;
  background: #111;
  border-radius: 32px;
  padding: 32px 48px 48px;
  border: 1px solid #222;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
  margin-bottom: 24px;
}

.container--narrow {
  max-width: 900px;
}

.container--auth {
  max-width: 480px;
  padding: 40px 48px;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 20px;
  flex-wrap: wrap;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-logo {
  display: block;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  padding: 0;
  border: none;
  background: #141414;
}

.header-photo {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #2a2a2a;
  transition: border-color 0.2s;
}

.header-photo:hover {
  border-color: #f5c518;
}

.header-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.logo-circle {
  background: #f5c518;
  border-radius: 36px;
  padding: 3px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: #000;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  flex-shrink: 0;
  white-space: nowrap;
  height: 44px;
}

.search-center {
  flex: 1;
  max-width: 500px;
  min-width: 180px;
  position: relative;
}

.search-center input {
  width: 100%;
  padding: 12px 20px 12px 48px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 30px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-center input::placeholder {
  color: #666;
}

.search-center input:focus {
  border-color: #f5c518;
}

.search-center .search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: #666;
  font-size: 1rem;
  pointer-events: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.back-link {
  color: #888;
  font-size: 0.95rem;
  transition: color 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.back-link:hover {
  color: #f5c518;
}

.user-profile {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 6px 14px 6px 8px;
  border-radius: 30px;
  transition: background 0.2s;
}

.user-profile:hover {
  background: #1a1a1a;
}

.user-profile .avatar {
  width: 40px;
  height: 40px;
  background: #2a2a2a;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f5c518;
  font-size: 1.1rem;
  border: 2px solid #f5c518;
}

.user-profile .user-name {
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
}

.btn-link {
  background: transparent;
  border: none;
  color: #888;
  cursor: pointer;
  font: inherit;
  padding: 6px 10px;
  border-radius: 20px;
  transition: color 0.2s, background 0.2s;
}

.btn-link:hover {
  color: #f5c518;
  background: #1a1a1a;
}

.cart-icon {
  position: relative;
  color: #f5c518;
  font-size: 1.4rem;
  padding: 8px;
  border-radius: 50%;
  transition: background 0.2s;
}

.cart-icon:hover {
  background: #1a1a1a;
}

.cart-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #f5c518;
  color: #000;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 30px;
  min-width: 20px;
  text-align: center;
}

.cart-badge:empty {
  display: none;
}

/* Subheader & banner */
.subheader {
  margin: 8px 0 12px;
}

.subheader h2 {
  font-size: 2.2rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.subheader p {
  color: #888;
  font-size: 1.05rem;
  margin-top: 4px;
}

.banner {
  background: #1a1a1a;
  border-radius: 16px;
  padding: 16px 24px;
  margin: 20px 0 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #2a2a2a;
  gap: 16px;
}

.banner-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.banner-left .logo-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
}

.banner-left .logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.banner-left .banner-text {
  font-size: 0.9rem;
  color: #aaa;
  line-height: 1.4;
}

.banner-left .banner-text strong {
  color: #fff;
  font-weight: 600;
}

.section-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 20px;
}

.page-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 24px;
}

.page-title i {
  color: #f5c518;
  margin-right: 12px;
}

/* Catalog grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.product-card {
  background: #1a1a1a;
  border-radius: 16px;
  padding: 20px 24px;
  border: 1px solid #2a2a2a;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  transition: border-color 0.2s, transform 0.2s;
}

.product-card:hover {
  border-color: #f5c518;
  transform: translateY(-2px);
}

.product-row {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 16px;
  min-width: 0;
}

.product-photo {
  width: 70px;
  height: 70px;
  flex-shrink: 0;
  background: #2a2a2a;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  border: 1px solid #333;
}

.product-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-photo i {
  font-size: 1.6rem;
  color: #444;
}

.product-info {
  flex: 1;
  min-width: 0;
}

.product-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
}

.product-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.product-price {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f5c518;
}

.product-price-old {
  font-size: 0.85rem;
  color: #666;
  text-decoration: line-through;
}

.badge-discount {
  background: #e74c3c;
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.stock-label {
  font-size: 0.8rem;
  color: #888;
}

.product-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0a0a0a;
  border-radius: 30px;
  padding: 4px 10px;
  border: 1px solid #2a2a2a;
}

.qty-control button {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.qty-control button:hover {
  background: #2a2a2a;
}

.qty-control span {
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  min-width: 24px;
  text-align: center;
}

.btn-add,
.btn-primary,
.btn-checkout,
.btn-pay,
.btn-submit {
  background: #f5c518;
  border: none;
  border-radius: 30px;
  padding: 10px 24px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #000;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.btn-add:hover,
.btn-primary:hover,
.btn-checkout:hover,
.btn-pay:hover,
.btn-submit:hover {
  background: #ffe066;
  transform: scale(1.03);
}

.btn-add:active,
.btn-primary:active,
.btn-checkout:active,
.btn-pay:active,
.btn-submit:active {
  transform: scale(0.97);
}

button:disabled,
.btn-add:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* Cart */
.cart-item {
  background: #1a1a1a;
  border-radius: 16px;
  padding: 16px 20px;
  border: 1px solid #2a2a2a;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 12px;
  transition: border-color 0.2s;
}

.cart-item:hover {
  border-color: #f5c518;
}

.cart-item-photo {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  background: #2a2a2a;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #333;
}

.cart-item-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
}

.cart-item-name {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
}

.cart-item-price {
  font-size: 1rem;
  font-weight: 700;
  color: #f5c518;
  margin-top: 4px;
}

.cart-item-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-remove {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 68, 68, 0.08);
  border: 1px solid rgba(255, 68, 68, 0.35);
  color: #ff8a80;
  padding: 10px 16px;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
  font-weight: 600;
  flex-shrink: 0;
}

.btn-remove:hover {
  border-color: #ff4444;
  color: #fff;
  background: #ff4444;
}

.cart-summary {
  background: #1a1a1a;
  border-radius: 16px;
  padding: 20px 24px;
  border: 1px solid #2a2a2a;
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.cart-summary .total-label {
  color: #888;
  font-size: 1rem;
}

.cart-summary .total-price {
  font-size: 1.8rem;
  font-weight: 700;
  color: #f5c518;
}

.btn-checkout {
  padding: 14px 40px;
  font-size: 1rem;
  font-weight: 700;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #666;
}

.empty-state i {
  font-size: 4rem;
  color: #2a2a2a;
  margin-bottom: 16px;
}

.empty-state h3 {
  color: #888;
  font-size: 1.3rem;
  margin-bottom: 8px;
}

/* Checkout */
.checkout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.order-summary {
  background: #1a1a1a;
  border-radius: 16px;
  padding: 24px;
  border: 1px solid #2a2a2a;
}

.order-summary h3 {
  font-size: 1.1rem;
  color: #fff;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.order-summary h3 i {
  color: #f5c518;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #2a2a2a;
  font-size: 0.9rem;
  gap: 12px;
}

.summary-item--editable {
  flex-wrap: wrap;
  gap: 8px 12px;
}

.summary-item__main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.summary-item__remove {
  flex-shrink: 0;
}

.summary-item .item-name {
  color: #aaa;
}

.summary-item .item-price {
  color: #f5c518;
  font-weight: 600;
  white-space: nowrap;
}

.btn-remove-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 68, 68, 0.08);
  border: 1px solid rgba(255, 68, 68, 0.35);
  color: #ff8a80;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-remove-line:hover {
  background: #ff4444;
  border-color: #ff4444;
  color: #fff;
}

.summary-total {
  display: flex;
  justify-content: space-between;
  padding: 16px 0 8px;
  font-size: 1.2rem;
  font-weight: 700;
  border-top: 2px solid #f5c518;
  margin-top: 8px;
}

.summary-total .total-price {
  color: #f5c518;
}

.mp-note {
  margin-top: 16px;
  padding: 14px 16px;
  background: #0a0a0a;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  color: #888;
  font-size: 0.9rem;
}

.mp-note i {
  color: #009ee3;
  margin-right: 8px;
}

.btn-pay {
  width: 100%;
  padding: 16px;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 12px;
  margin-top: 16px;
}

/* Auth */
body.auth-page {
  justify-content: center;
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo p {
  color: #666;
  font-size: 0.95rem;
}

.auth-form .form-group {
  margin-bottom: 18px;
}

.auth-form label {
  display: block;
  color: #888;
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.auth-form input {
  width: 100%;
  padding: 14px 18px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  color: #fff;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.auth-form input:focus {
  border-color: #f5c518;
}

.auth-form .btn-submit {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  margin-top: 8px;
}

.back-home {
  text-align: center;
  margin-top: 20px;
}

.back-home a {
  color: #666;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.back-home a:hover {
  color: #f5c518;
}

/* Payment wait / success */
.status-card {
  text-align: center;
  padding: 40px 20px;
}

.status-card .spinner {
  width: 56px;
  height: 56px;
  border: 4px solid #2a2a2a;
  border-top-color: #f5c518;
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.status-card.success i {
  font-size: 4rem;
  color: #6ee7a0;
  margin-bottom: 16px;
}

.status-card h1 {
  font-size: 1.8rem;
  margin-bottom: 12px;
}

.status-card p {
  color: #888;
  margin-bottom: 24px;
}

.hint {
  color: #666;
  font-size: 0.9rem;
}

.cart-toast {
  background: rgba(245, 197, 24, 0.12);
  border: 1px solid rgba(245, 197, 24, 0.35);
  color: #f5c518;
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 16px;
  font-weight: 600;
}

.error {
  color: #ff8a80;
  background: rgba(255, 68, 68, 0.08);
  border: 1px solid rgba(255, 68, 68, 0.25);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

/* Footer */
.site-footer {
  max-width: 1200px;
  width: 100%;
  padding: 20px 48px;
  background: #111;
  border-radius: 32px;
  border: 1px solid #222;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  color: #666;
  font-size: 0.9rem;
}

.site-footer--narrow {
  max-width: 900px;
}

.site-footer .footer-links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.site-footer .footer-links a {
  color: #888;
  transition: color 0.2s;
}

.site-footer .footer-links a:hover {
  color: #f5c518;
}

.site-footer .footer-copy {
  color: #555;
  font-size: 0.85rem;
}

.site-footer--auth {
  max-width: 480px;
  justify-content: center;
  text-align: center;
}

.hidden {
  display: none !important;
}

/* Home — machine picker */
.home-current {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.home-current p {
  color: #aaa;
  margin: 0;
}

.home-current strong {
  color: #fff;
}

.machine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.machine-card {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 16px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.2s, transform 0.2s;
}

.machine-card:hover {
  border-color: #f5c518;
  transform: translateY(-2px);
}

.machine-card__id {
  font-size: 0.8rem;
  color: #666;
  font-weight: 600;
}

.machine-card__name {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.machine-card__address {
  font-size: 0.85rem;
  color: #888;
  line-height: 1.4;
}

.machine-card__cta {
  margin-top: 8px;
  font-size: 0.9rem;
  color: #f5c518;
  font-weight: 600;
}

.home-qr-hint {
  margin-top: 28px;
  text-align: center;
  color: #666;
  font-size: 0.9rem;
}

.home-qr-hint i {
  color: #f5c518;
  margin-right: 8px;
}

/* Fixed bottom bar — cart + pay */
.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.85) 28%, #0a0a0a 100%);
  pointer-events: none;
}

.bottom-bar__inner {
  pointer-events: auto;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #161616;
  border: 1px solid #2a2a2a;
  border-radius: 20px;
  padding: 12px 14px 12px 16px;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.55);
}

.bottom-bar__cart {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  color: #fff;
}

.bottom-bar__cart-icon {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f5c518;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.bottom-bar__badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #f5c518;
  color: #000;
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bottom-bar__cart-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.bottom-bar__cart-text strong {
  font-size: 0.95rem;
  font-weight: 700;
}

.bottom-bar__cart-text small {
  color: #888;
  font-size: 0.8rem;
}

.bottom-bar__pay {
  flex-shrink: 0;
  background: #f5c518;
  color: #000;
  font-weight: 800;
  font-size: 1rem;
  border-radius: 30px;
  padding: 14px 28px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s, transform 0.15s;
}

.bottom-bar__pay:hover {
  background: #ffe066;
  transform: scale(1.03);
}

.bottom-bar__pay:active {
  transform: scale(0.97);
}

@media (max-width: 1024px) {
  .container {
    padding: 28px 24px 36px;
  }

  .subheader h2 {
    font-size: 1.8rem;
  }

  .search-center {
    max-width: 350px;
  }

  .site-footer {
    padding: 16px 24px;
  }
}

@media (max-width: 820px) {
  .container {
    padding: 20px 16px 24px;
  }

  .header {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .search-center {
    max-width: 100%;
    order: 3;
  }

  .header-right {
    justify-content: flex-end;
    width: 100%;
  }

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

  .subheader h2 {
    font-size: 1.5rem;
  }

  .banner {
    flex-wrap: wrap;
  }

  .cart-item {
    flex-wrap: wrap;
  }

  .cart-item-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 8px;
  }

  .cart-summary {
    flex-direction: column;
    text-align: center;
  }

  .btn-checkout {
    width: 100%;
  }

  .site-footer {
    flex-direction: column;
    text-align: center;
    padding: 16px 20px;
  }

  .site-footer .footer-links {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  body {
    padding: 12px 10px 24px;
  }

  .container {
    padding: 14px 12px 18px;
    border-radius: 20px;
  }

  .brand-logo {
    width: 60px;
    height: 60px;
  }

  .header-photo {
    width: 40px;
    height: 40px;
  }

  .logo-circle {
    font-size: 0.85rem;
    padding: 2px 12px;
    height: 38px;
  }

  .subheader h2 {
    font-size: 1.2rem;
  }

  .product-card {
    flex-wrap: wrap;
    padding: 14px 16px;
  }

  .product-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 10px;
    flex-wrap: wrap;
  }

  .product-photo {
    width: 56px;
    height: 56px;
  }

  .btn-add {
    padding: 8px 16px;
    font-size: 0.8rem;
  }
}
