:root {
  --bg: #1a1a1a;
  --bg-lighter: #2a2a2a;
  --border: #3a3a3a;
  --text: #ffffff;
  --text-light: #999999;
  --primary: #ff9500;
}

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;500;600;700&display=swap');

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

html, body {
  width: 100%;
  height: 100%;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  font-weight: 300;
}

#app {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* ===== LOADING ===== */
.loading {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  gap: 20px;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ===== MAIN APP ===== */
.app {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding-bottom: 60px;
}

/* ===== PAGES ===== */
.pages-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.page {
  display: none;
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.page.active {
  display: flex;
  flex-direction: column;
}

.page-header {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text);
}

.page-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
}

/* ===== HEADER ===== */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header__logo {
  font-size: 20px;
  font-weight: 700;
}

.header__search {
  background: none;
  border: none;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
}

/* ===== SEARCH ===== */
.search-bar {
  display: none;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.search-input {
  flex: 1;
  background: var(--bg-lighter);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
}

.search-input::placeholder {
  color: var(--text-light);
}

.search-close {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 18px;
}

/* ===== MAIN ===== */
.main {
  flex: 1;
  padding: 16px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.catalog {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

/* ===== PRODUCT CARD ===== */
.product-card {
  background: var(--bg-lighter);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s;
  overflow: hidden;
}

.product-card:active {
  background: var(--border);
  transform: scale(0.98);
}

.product-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  min-height: 100px;
}

.product-icon {
  width: 100%;
  height: 100px;
  object-fit: contain;
  background: var(--bg);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  flex: 1;
}

.product-icon img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.product-wishlist {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  transition: transform 0.2s;
}

.product-wishlist:active {
  transform: scale(1.2);
}

.product-name {
  font-weight: 500;
  font-size: 13px;
  color: var(--text);
  line-height: 1.3;
}

.product-desc {
  font-size: 11px;
  color: var(--text-light);
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.product-price {
  font-weight: 600;
  color: var(--primary);
  font-size: 13px;
  letter-spacing: 0.5px;
}

.product-actions {
  display: flex;
  gap: 4px;
}

.product-btn {
  background: var(--border);
  border: none;
  color: var(--text);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.2s;
}

.product-btn:active {
  background: var(--primary);
}

.btn-add {
  flex: 1;
  background: var(--primary);
  color: black;
  font-weight: 600;
}

.qty-display {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--border);
  border-radius: 6px;
  font-size: 12px;
}

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: var(--bg-lighter);
  border-top: 1px solid var(--border);
  z-index: 100;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 24px;
  flex: 1;
  height: 100%;
  transition: color 0.2s;
  position: relative;
}

.nav-btn.active {
  color: var(--primary);
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  0% {
    transform: translateY(10px);
    opacity: 0.5;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.nav-label {
  font-size: 10px;
  color: inherit;
}

.badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--primary);
  color: black;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  min-width: 22px;
}

.profile-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff9500, #ffb84d);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: black;
}

/* ===== MODAL ===== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: flex-end;
  z-index: 200;
  overflow-y: auto;
}

.modal__content {
  background: var(--bg);
  width: 100%;
  border-radius: 16px 16px 0 0;
  padding: 20px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal__content--center {
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

/* ===== PRODUCT DETAIL FULLSCREEN ===== */
.product-detail-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  z-index: 150;
  overflow: hidden;
}

.product-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  z-index: 10;
  position: relative;
  flex-shrink: 0;
}

.product-detail-share {
  background: none;
  border: none;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
}

.product-detail-image {
  position: relative;
  width: 100%;
  height: 280px;
  background: var(--bg-lighter);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.product-detail-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.product-detail-wishlist {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.product-detail-wishlist:active {
  background: var(--primary);
  transform: scale(1.1);
}

.product-detail-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-bottom: 120px;
}

.product-detail-content {
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.product-detail-content h2 {
  font-size: 24px;
  font-weight: 400;
  color: var(--text);
  margin: 0;
  line-height: 1.2;
}

.product-detail-price {
  font-size: 28px;
  font-weight: 600;
  color: var(--primary);
  margin: 0;
}

.product-detail-description {
  font-size: 14px;
  color: var(--text-light);
  line-height: 1.6;
  margin: 0;
}

.product-detail-specs {
  padding: 16px;
  background: var(--bg-lighter);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.spec-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.spec-row:last-child {
  border-bottom: none;
}

.spec-label {
  color: var(--text-light);
  font-size: 13px;
}

.spec-value {
  color: var(--text);
  font-weight: 500;
  font-size: 13px;
}

.product-detail-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  z-index: 100;
  flex-wrap: wrap;
}

.btn-large {
  flex: 1;
  min-width: 150px;
}

.quantity-control {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-lighter);
  border-radius: 8px;
  padding: 8px;
  min-width: 140px;
}

.quantity-control .btn-qty {
  flex: 1;
  padding: 10px;
  background: var(--border);
  border: none;
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
}

.quantity-control input {
  flex: 2;
  background: none;
  border: none;
  color: var(--text);
  text-align: center;
  font-size: 16px;
  font-weight: 600;
}

.quantity-control input::-webkit-outer-spin-button,
.quantity-control input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}

.modal__header h2 {
  font-size: 18px;
}

.modal__close {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 24px;
  cursor: pointer;
}

.modal__empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}

.favorites-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 20px;
  text-align: center;
  min-height: 500px;
}

.empty-icon {
  font-size: 80px;
  animation: float 3s ease-in-out infinite;
  font-weight: 300;
  letter-spacing: 2px;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
}

.favorites-empty h3 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin: 20px 0 0 0;
}

.favorites-empty p {
  font-size: 14px;
  color: var(--text-light);
  line-height: 1.6;
  max-width: 300px;
  margin: 0;
}

/* ===== CART ===== */
.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: var(--bg-lighter);
  border-radius: 8px;
  margin-bottom: 8px;
}

.cart-summary {
  background: var(--bg-lighter);
  padding: 16px;
  border-radius: 8px;
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cart-summary > div {
  display: flex;
  justify-content: space-between;
}

.btn {
  padding: 12px;
  background: var(--bg-lighter);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s;
}

.btn-primary {
  background: var(--primary);
  border: none;
  color: black;
}

.btn-remove {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 14px;
}

/* ===== CHECKOUT ===== */
#checkoutForm {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#checkoutForm input,
#checkoutForm textarea {
  background: var(--bg-lighter);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
}

#checkoutForm textarea {
  resize: vertical;
  min-height: 80px;
}

/* ===== PROFILE ===== */
.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff9500, #ffb84d);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: black;
  margin: 20px auto;
}

.profile-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 20px;
}

.profile-item {
  padding: 16px;
  background: var(--bg-lighter);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.profile-item:active {
  background: var(--border);
}

/* ===== ORDERS ===== */
.order-card {
  display: flex;
  justify-content: space-between;
  padding: 12px;
  background: var(--bg-lighter);
  border-radius: 8px;
  margin-bottom: 8px;
}

/* ===== LANGUAGE ===== */
.languages-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.language-item {
  padding: 16px;
  background: var(--bg-lighter);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.language-item:active {
  background: var(--primary);
  color: black;
}

/* ===== SUPPORT ===== */
.support-channels {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.support-channel {
  padding: 16px;
  background: var(--bg-lighter);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.2s;
}

.support-channel:active {
  background: var(--border);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  .catalog {
    grid-template-columns: repeat(2, 1fr);
  }

  .product-card {
    padding: 10px;
  }

  .modal__content {
    border-radius: 12px;
  }

  .product-detail-image {
    height: 240px;
  }

  .product-detail-content {
    padding: 16px 12px;
  }

  .product-detail-footer {
    flex-direction: column;
    gap: 10px;
    padding: 10px 12px;
  }

  .quantity-control {
    min-width: auto;
    flex: 1;
  }

  .btn-large {
    min-width: auto;
    width: 100%;
  }

  .product-detail-header {
    padding: 12px;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .product-detail-image {
    height: 320px;
  }

  .product-detail-footer {
    padding: 14px;
  }
}

@media (min-width: 769px) {
  .product-detail-fullscreen {
    max-width: 600px;
    margin: 0 auto;
  }

  .product-detail-image {
    height: 360px;
  }
}
