/* RESET / BASE */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f3f4f7;
  color: #222;
}

/* PAGE BG WRAPPER (main menu) */
.page-bg {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 24px 16px;
}

/* SHELL */
.app-shell {
  display: flex;
  max-width: 1600px;
  width: 100%;
  min-height: 85vh;
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
}

/* SIDEBAR */
.sidebar {
  width: 320px;
  background: #fafafa;
  border-right: 1px solid #ececec;
  padding: 32px 20px;
}

.logo-area {
  margin-bottom: 28px;
}

.logo-area h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

/* CATEGORY LIST */
.category-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.category-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 18px;
  border-radius: 999px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1.05rem;
  text-align: left;
  transition: background 0.18s ease, color 0.18s ease, transform 0.1s;
}

.category-item:hover {
  background: #e9f7ef;
}

.category-item.active {
  background: #24b26b;
  color: #ffffff;
  transform: translateY(-1px);
}

.cat-icon {
  font-size: 1.3rem;
}

.cat-label {
  flex: 1;
}

/* MAIN CONTENT */
.main-content {
  flex: 1;
  padding: 32px 40px 40px;
  display: flex;
  flex-direction: column;
}

/* HEADER */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.main-header h2 {
  font-size: 2rem;
  font-weight: 700;
}

/* SEARCH BAR */
.search-bar {
  margin-top: 8px;
  max-width: 360px;
  height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-6px);
  transition: height 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

.search-bar.open {
  height: 40px;
  opacity: 1;
  transform: translateY(0);
}

.search-bar input {
  width: 100%;
  height: 40px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  padding: 0 14px;
  font-size: 0.9rem;
  outline: none;
}

.search-bar input:focus {
  border-color: #24b26b;
}

/* HEADER ICONS */
.header-icons {
  display: flex;
  gap: 16px;
  align-items: center;
}

.icon-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1.6rem;
  position: relative;
  text-decoration: none;
  color: inherit;
}

.cart-count {
  position: absolute;
  top: -4px;
  right: -10px;
  font-size: 0.8rem;
  background: #24b26b;
  color: #ffffff;
  border-radius: 999px;
  padding: 3px 7px;
  font-weight: 600;
}

/* ITEMS LIST */
.items-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding-right: 6px;
}

/* ITEM CARD */
.item-card {
  display: flex;
  align-items: stretch;
  gap: 18px;
  padding: 18px 22px;
  border-radius: 16px;
  border: 1px solid #eeeeee;
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.03);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.item-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
  border-color: #e0f2ea;
}

.item-image {
  width: 140px;
  height: 100px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
}

.item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.item-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.item-description {
  font-size: 0.98rem;
  color: #616161;
  margin-bottom: 10px;
  max-width: 700px;
}

.item-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.item-price {
  font-size: 1.05rem;
  font-weight: 600;
}

/* ACTION BUTTONS */
.item-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* AR BUTTON (outline) */
.ar-btn {
  padding: 9px 16px;
  font-size: 0.9rem;
  border-radius: 999px;
  border: 1px solid #24b26b;
  background: #ffffff;
  color: #24b26b;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.18s ease, color 0.18s ease,
              transform 0.1s, box-shadow 0.18s ease;
}

.ar-btn:hover {
  background: #e9f7ef;
  box-shadow: 0 0 0 1px rgba(36, 178, 107, 0.2);
  transform: translateY(-1px);
}

/* Add-to-cart button */
.add-btn {
  padding: 9px 20px;
  font-size: 0.98rem;
  border-radius: 999px;
  border: none;
  background: #24b26b;
  color: #ffffff;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.18s ease, transform 0.1s;
}

.add-btn:hover {
  background: #1f9b5f;
  transform: translateY(-1px);
}

/* SCROLLBAR */
.items-list::-webkit-scrollbar {
  width: 6px;
}
.items-list::-webkit-scrollbar-track {
  background: transparent;
}
.items-list::-webkit-scrollbar-thumb {
  background: #d3d7dd;
  border-radius: 999px;
}

/* AR MODAL */
.ar-modal {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.ar-modal.open {
  display: flex;
}

.ar-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.ar-modal-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  background: #ffffff;
  border-radius: 20px;
  padding: 18px 20px 24px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transform: translateY(10px);
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.ar-modal.open .ar-modal-content {
  opacity: 1;
  transform: translateY(0);
}

.ar-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.ar-close-btn {
  position: absolute;
  top: 10px;
  right: 14px;
  border: none;
  background: transparent;
  font-size: 1.6rem;
  cursor: pointer;
}

.ar-viewer {
  width: 100%;
  height: 360px;
  border-radius: 16px;
  overflow: hidden;
  background: #f3f4f7;
}

.ar-hint {
  margin-top: 4px;
  font-size: 0.9rem;
  color: #616161;
}

/* CART DRAWER */
.cart-drawer {
  position: fixed;
  top: 0;
  right: -380px;
  width: 380px;
  height: 100%;
  background: #ffffff;
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.16);
  padding: 24px;
  transition: right 0.3s ease;
  z-index: 120;
  display: flex;
  flex-direction: column;
}

.cart-drawer.open {
  right: 0;
}

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.cart-close-btn {
  font-size: 1.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
}

.cart-items {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
  flex: 1;
  overflow-y: auto;
}

/* Cart item */
.cart-item {
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
}

.cart-item-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.cart-item-name {
  font-weight: 600;
}

.cart-item-price {
  font-size: 0.95rem;
  color: #555;
}

.cart-item-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.qty-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.qty-btn {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid #d0d0d0;
  background: #ffffff;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-item-qty {
  font-size: 0.95rem;
  font-weight: 600;
  color: #24b26b;
}

.cart-item-subtotal {
  font-size: 0.95rem;
  font-weight: 600;
}

.remove-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  color: #c0392b;
}

/* Cart summary */
.cart-summary {
  border-top: 1px solid #eee;
  padding-top: 12px;
  margin-top: 8px;
}

.cart-summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.96rem;
}

.checkout-btn {
  margin-top: 10px;
  width: 100%;
  padding: 10px 16px;
  border-radius: 999px;
  border: none;
  background: #111827;
  color: #ffffff;
  cursor: pointer;
  font-size: 0.98rem;
  font-weight: 500;
  transition: background 0.18s ease, transform 0.1s;
}

.checkout-btn:hover {
  background: #020617;
  transform: translateY(-1px);
}

/* CHECKOUT MODAL */
.checkout-modal {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 130;
}

.checkout-modal.open {
  display: flex;
}

.checkout-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.checkout-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 18px;
  padding: 20px 22px 22px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.checkout-modal.open .checkout-content {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.checkout-close-btn {
  position: absolute;
  top: 10px;
  right: 14px;
  border: none;
  background: transparent;
  font-size: 1.6rem;
  cursor: pointer;
}

.checkout-total {
  margin-top: 6px;
  margin-bottom: 12px;
  font-weight: 600;
}

.checkout-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
}

.checkout-form label {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
  gap: 4px;
}

.checkout-form input,
.checkout-form select {
  border-radius: 8px;
  border: 1px solid #d1d5db;
  padding: 8px 10px;
  font-size: 0.9rem;
  outline: none;
}

.checkout-form input:focus,
.checkout-form select:focus {
  border-color: #24b26b;
}

#checkoutPayBtn {
  margin-top: 4px;
  padding: 9px 16px;
  border-radius: 999px;
  border: none;
  background: #24b26b;
  color: #ffffff;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.18s ease, transform 0.1s;
}

#checkoutPayBtn:hover {
  background: #1f9b5f;
  transform: translateY(-1px);
}

.checkout-note {
  font-size: 0.8rem;
  color: #6b7280;
}

/* PROFILE PAGE (separate) */
.profile-page-bg {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 24px 16px;
  background: radial-gradient(circle at top left, #e0f7ec 0, #f3f4f7 50%, #f3f4f7 100%);
}

.profile-shell {
  width: 100%;
  max-width: 520px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
  padding: 18px 18px 24px;
  display: flex;
  flex-direction: column;
}

.profile-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.back-btn {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: inherit;
  font-size: 1.1rem;
}

.profile-page-title {
  font-size: 1.3rem;
  font-weight: 600;
}

.profile-main {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Hero card */
.profile-hero-card {
  background: linear-gradient(135deg, #24b26b, #16a34a);
  border-radius: 18px;
  padding: 16px 16px 14px;
  color: #ffffff;
}

.profile-hero-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.profile-avatar-lg {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  background: rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.6rem;
}

.profile-hero-name {
  font-size: 1.3rem;
  font-weight: 600;
}

.profile-hero-email {
  font-size: 0.9rem;
  opacity: 0.9;
}

/* Hero stats */
.profile-hero-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.profile-meta-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  font-size: 0.8rem;
}

.meta-label {
  opacity: 0.9;
}

.meta-value {
  font-weight: 600;
  font-size: 0.95rem;
}

/* sections */
.profile-section {
  background: #ffffff;
}

.profile-section-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 6px;
  padding: 0 2px;
}

.profile-list {
  border-radius: 14px;
  background: #f9fafb;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.profile-list-item {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background 0.15s ease;
}

.profile-list-item:not(:last-child) {
  border-bottom: 1px solid #e5e7eb;
}

.profile-list-item:hover {
  background: #edf5f0;
}

.profile-item-title {
  font-size: 0.94rem;
  font-weight: 500;
}

.profile-item-sub {
  font-size: 0.82rem;
  color: #6b7280;
}

.profile-item-arrow {
  font-size: 1.2rem;
  color: #9ca3af;
}

/* Full logout button */
.profile-logout-btn-full {
  margin-top: 4px;
  padding: 10px 16px;
  width: 100%;
  border-radius: 999px;
  border: 1px solid #ef4444;
  color: #ef4444;
  background: #fff1f2;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.18s ease, color 0.18s ease, transform 0.1s;
}

.profile-logout-btn-full:hover {
  background: #ef4444;
  color: #ffffff;
  transform: translateY(-1px);
}

/* RESPONSIVE */
@media (max-width: 900px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #ececec;
    padding: 16px 16px 12px;
  }

  .category-list {
    flex-direction: row;
    overflow-x: auto;
  }

  .main-content {
    padding: 24px 16px 24px;
  }

  .item-card {
    flex-direction: column;
  }

  .item-image {
    width: 100%;
    height: 180px;
  }

  .cart-drawer {
    width: 90%;
  }

  .checkout-content {
    max-width: 90%;
  }

  .profile-shell {
    max-width: 100%;
  }

  .ar-viewer {
    height: 320px;
  }
}
