:root {
  --bg-1: #ffffff;
  --bg-2: #ffffff;
  --card: #ffffff;
  --glass: rgba(11,17,32,0.03);
  --muted: rgba(11,17,32,0.6);
  --accent: #000000;
  --gold: #d4af37;
  --glass-border: rgba(11,17,32,0.06);
  --radius: 14px;
  --gap: 20px;
  --container: 1400px;
  --text-color: #0b1220;
  --touch: 48px;
}

/* Reset and base styles */
* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
}

html, body {
  height: 100%;
  width: 100%;
  overflow-x: hidden; /* Prevent horizontal scroll */
}

html {
  -webkit-text-size-adjust: 100%; /* Prevent font scaling in landscape */
}

body {
  font-family: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-1);
  color: var(--text-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding: 36px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100vh;
  position: relative;
}

/* Main container with proper width constraints */
.wrap { 
  width: 100%; 
  max-width: var(--container);
  position: relative;
  margin-top: 120px;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
  max-width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
  flex-shrink: 0;
}

.logo-mark {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: linear-gradient(180deg,#fff,#fbfbfb);
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--glass-border);
  box-shadow: 0 6px 18px rgba(11,17,32,0.04);
  flex: 0 0 auto;
}

.logo-mark .m {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  color: var(--gold);
  font-size: 18px;
}

.brand .title {
  font-family: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  font-size: 18px;
  margin: 0;
  color: var(--gold);
}

.brand .subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
  justify-content: flex-end;
}

.search-bar {
  background: #f7f7f8;
  border: 1px solid var(--glass-border);
  padding: 8px 10px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 400px;
}

.search-bar input {
  background: transparent;
  border: 0;
  outline: none;
  color: var(--muted);
  width: 100%;
  font-size: 14px;
  min-width: 0;
  max-width: 100%;
}

.badges {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

/* Badges */
.badge {
  background: #000;
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 8px 10px;
  border-radius: 999px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.badge svg {
  fill: #ffffff;
  width: 16px;
  height: 16px;
}

.badge .count {
  background: var(--gold);
  padding: 2px 8px;
  border-radius: 999px;
  color: #0b0b0b;
  font-weight: 700;
  font-size: 13px;
}

/* Page title */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
  max-width: 100%;
}

.page-title {
  font-family: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  font-weight: 600;
  font-size: clamp(24px, 5vw, 30px); /* Responsive font size */
  margin: 0;
  letter-spacing: 0.2px;
  color: var(--text-color);
  line-height: 1.2;
}

.page-sub {
  color: var(--muted);
  font-size: clamp(13px, 3vw, 14px);
  line-height: 1.4;
}

/* Main grid */
.content {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  align-items: start;
  width: 100%;
  max-width: 100%;
}

.panel {
  background: var(--card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 8px 30px rgba(11,17,32,0.04);
  width: 100%;
  max-width: 100%;
  overflow: hidden; /* Prevent content overflow */
}

/* Wishlist container */
.wishlist-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 100%;
}

.wishlist-item {
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  padding: 16px;
  transition: all 0.2s ease;
  display: flex;
  gap: 16px;
  align-items: center;
  width: 100%;
  max-width: 100%;
}

.wishlist-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.item-image {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  max-width: 100%;
}

.item-details {
  flex: 1;
  min-width: 0; /* Prevent flex item from overflowing */
  max-width: 100%;
}

.item-name {
  margin: 0 0 8px 0;
  font-size: clamp(15px, 4vw, 16px);
  font-weight: 600;
  color: #333;
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.3;
}

.item-price {
  margin: 0 0 4px 0;
  font-size: clamp(16px, 4vw, 18px);
  font-weight: bold;
  color: #d4af37;
  font-family: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.2;
}

.item-quantity {
  margin: 0 0 12px 0;
  font-size: clamp(13px, 3vw, 14px);
  color: #666;
  line-height: 1.3;
}

.item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 100%;
}

/* Buttons - Consolidated styles */
button, .btn, .move-to-cart-btn, .remove-btn, .wishlist-toggle, 
.item-actions button, .btn-ghost, .btn-cta, .checkout-btn {
  border-radius: 4px !important;
  font-family: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
  max-width: 100%;
}

.move-to-cart-btn, .remove-btn {
  padding: 10px 16px;
  font-size: clamp(13px, 3vw, 14px);
  min-height: 40px;
  flex: 1;
  min-width: 0;
}

.move-to-cart-btn {
  background: #d4af37;
  color: #000;
}

.move-to-cart-btn:hover {
  background: #b8941f;
}

.remove-btn {
  background: #f8f8f8;
  color: #666;
  border: 1px solid #e5e5e5;
}

.remove-btn:hover {
  background: #fff0f0;
  color: #d32f2f;
  border-color: #ffcdd2;
}

.btn-cta {
  background: var(--accent);
  color: #0b0b0b;
  border: 1px solid rgba(11,17,32,0.06);
  box-shadow: 0 6px 18px rgba(212,175,55,0.08);
  padding: 10px 12px;
}

.btn-ghost {
  color: var(--muted);
  background: transparent;
  border: 1px solid rgba(11,17,32,0.06);
  padding: 10px 12px;
}

/* Sidebar summary */
.sidebar .summary {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 100%;
}

.summary .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 100%;
}

.summary .total {
  font-family: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(18px, 4vw, 20px);
  color: var(--gold);
  line-height: 1.2;
}

.checkout-btn {
  display: block;
  margin-top: 10px;
  padding: 12px;
  background: #000000;
  color: #ffffff;
  text-align: center;
  font-weight: 700;
  width: 100%;
  min-height: var(--touch);
  font-size: clamp(14px, 3vw, 16px);
}

.empty, .empty-wishlist {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  border-radius: 12px;
  border: 1px dashed rgba(11,17,32,0.04);
  color: var(--muted);
  background: #fff;
  text-align: center;
  width: 100%;
  max-width: 100%;
}

/* Progress bar */
#wish-progress {
  height: 100%;
  width: 0;
  background: #000000;
  border-radius: 8px;
  transition: width .28s ease;
}

/* Wishlist button */
.wishlist-toggle {
  background: transparent;
  border: 0;
  padding: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #333;
  border-radius: 4px;
}

.wishlist-toggle .wish-icon {
  width: 20px;
  height: 20px;
  display: block;
  transition: transform .14s ease, color .18s ease;
  shape-rendering: geometricPrecision;
}

.wishlist-toggle .wish-icon path {
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  vector-effect: non-scaling-stroke;
}

.wishlist-toggle.wish-active {
  color: #e33333;
}

.wishlist-toggle.wish-active .wish-icon path {
  fill: currentColor;
  stroke: currentColor;
}

.wishlist-toggle:active {
  transform: scale(.96);
}

/* Utility */
.faint {
  color: var(--muted);
  font-size: clamp(12px, 3vw, 13px);
  line-height: 1.3;
}

/* Accessibility */
button:focus, a:focus, input:focus {
  outline: 3px solid rgba(212,175,55,0.18);
  outline-offset: 2px;
  border-radius: 8px;
}

/* =========================
   Responsive Breakpoints
   ========================= */

/* Tablet / small desktop */
@media (max-width: 1024px) {
  body { 
    padding: 28px 16px; 
  }
  
  .content {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .search-bar {
    min-width: 0;
    max-width: 100%;
    flex: 1 1 auto;
  }
  
  .page-title {
    font-size: 26px;
  }
  
  .header-actions {
    width: 100%;
    justify-content: space-between;
  }
  
  .site-header {
    align-items: center;
  }
  
  .wishlist-item {
    padding: 14px;
  }
  
  .logo-mark {
    width: 48px;
    height: 48px;
  }
  
  .brand .title {
    font-size: 16px;
  }
}

/* Mobile landscape / small tablet */
@media (max-width: 768px) {
  body { 
    padding: 20px 12px; 
  }
  
  .site-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  .header-actions {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
    order: 2;
  }
  
  .search-bar {
    min-width: 0;
    padding: 8px;
    border-radius: 10px;
    flex: 1;
    max-width: none;
  }
  
  .search-bar input {
    font-size: 16px; /* Better for mobile zoom */
  }
  
  .badges {
    margin-left: 0;
    flex-shrink: 0;
  }
  
  .page-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .page-title {
    font-size: 22px;
  }
  
  .panel {
    padding: 14px;
  }
  
  .wishlist-item {
    flex-direction: row;
    align-items: center;
    padding: 12px;
  }
  
  .item-details {
    align-items: flex-start;
  }
  
  .item-actions {
    margin-top: 8px;
  }
  
  .item-actions button {
    padding: 10px 12px;
    font-size: 14px;
  }
  
  /* Sidebar adjustments */
  .sidebar .summary {
    gap: 10px;
  }
  
  .summary .total {
    font-size: 18px;
  }
  
  .checkout-btn {
    width: 100%;
  }
}

/* Mobile portrait */
@media (max-width: 600px) {
  body { 
    padding: 16px 12px; 
  }
  
  .wrap {
    padding: 0;
  }
  
  .wishlist-item {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    padding: 16px;
  }
  
  .item-image {
    width: 100%;
    height: 140px;
    margin: 0 auto;
  }
  
  .item-details {
    text-align: center;
  }
  
  .item-actions {
    justify-content: center;
    margin-top: 12px;
  }
  
  .move-to-cart-btn, .remove-btn {
    flex: 1;
    min-width: 120px;
  }
}

/* Small phones */
@media (max-width: 420px) {
  body { 
    padding: 12px 8px; 
  }
  
  .wishlist-item {
    padding: 12px;
  }
  
  .item-image {
    height: 120px;
  }
  
  .item-actions {
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }
  
  .move-to-cart-btn, .remove-btn {
    width: 100%;
    display: block;
    padding: 12px;
  }
  
  .search-bar {
    min-width: 0;
    width: 100%;
  }
  
  .badge .count {
    font-size: 12px;
    padding: 3px 7px;
  }
  
  .brand {
    gap: 10px;
  }
  
  .logo-mark {
    width: 44px;
    height: 44px;
  }
  
  .page-title {
    font-size: 20px;
  }
  
  .item-name {
    font-size: 15px;
  }
  
  .item-price {
    font-size: 16px;
  }
}

/* Extra small devices and zoom prevention */
@media (max-width: 360px) {
  body { 
    padding: 10px 6px; 
  }
  
  .header-actions {
    flex-wrap: wrap;
  }
  
  .search-bar {
    order: 2;
    width: 100%;
    margin-top: 8px;
  }
  
  .badges {
    margin-left: 0;
  }
  
  .item-actions button {
    font-size: 13px;
    padding: 10px;
  }
  
  /* Prevent horizontal scroll on very small screens */
  html, body {
    overflow-x: hidden;
    position: relative;
  }
  
  .wrap {
    width: 100vw;
    max-width: 100vw;
    padding: 0 6px;
  }
}

/* High DPI and zoom specific fixes */
@media (max-width: 480px) {
  /* Ensure inputs are readable when zoomed */
  input, button, select, textarea {
    font-size: 16px !important; /* Prevents iOS zoom on focus */
  }
  
  /* Prevent horizontal scroll */
  body {
    width: 100%;
    overflow-x: hidden;
  }
  
  .wrap, .site-header, .content, .panel {
    max-width: 100%;
    overflow-x: hidden;
  }
}

/* Print styles */
@media print {
  .badges, .search-bar, .item-actions {
    display: none !important;
  }
}