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

body {
  font-family: 'Segoe UI', sans-serif;
  background-color: #f7f7f7;
}

/* Main Container */
.account-container {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 20px 40px;
  max-width: 1100px;
  margin: 2rem auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(127, 68, 68, 0.05);
  min-height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 220px;
  background: #fafafa;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border-right: 1px solid #eee;
  position: sticky;
  top: 20px;
  align-self: flex-start;
}

.avatar {
  text-align: center;
  margin-bottom: 30px;
}

.avatar img {
  width: 100px;
  border-radius: 50%;
}

.avatar-img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid #ccc;
}

.nav-menu {
  list-style: none;
}

.nav-link {
  display: block;
  padding: 0.75rem 1rem;
  color: #333;
  text-decoration: none;
  border-radius: 5px;
  margin-bottom: 0.5rem;
  transition: background 0.2s ease;
  cursor: pointer;
}

.nav-link:hover,
.nav-link.active {
  background-color: #6a0dad;
  color: white;
  font-weight: 600;
}

.logout {
  display: block;
  padding: 0.75rem 1rem;
  color: red;
  text-decoration: none;
  margin-top: 20px;
}

/* Main Content */
.main-content {
  flex: 1;
  max-width: 100%;
  padding-right: 10px;
  height: 100vh;
  overflow-y: auto;
}

.tab {
  display: none;
  width: 100%;
    min-height: 100%;
  padding-bottom: 50px;
}

.tab.active {
  display: block;
}

.tab h2 {
  margin-bottom: 15px;
}

/* Table Styles */
.table {
  width: 100%;
  margin-top: 10px;
  margin-bottom: 20px;
  background-color: #fff;
  border-collapse: collapse;
  font-size: 16px;
}

.table th,
.table td {
  border: 1px solid #ccc !important;
  padding: 12px 15px;
  text-align: left;
  vertical-align: middle;
}

.table thead th {
  background-color: #f0f0f0;
  font-weight: bold;
}

.table-striped tbody tr:nth-of-type(odd) {
  background-color: #f9f9f9;
}

.table-striped tbody tr:hover {
  background-color: #f1f1f1;
}

.table td a.btn {
  font-size: 0.8rem;
  padding: 4px 8px;
  border: 1px solid #6a0dad;
  border-radius: 3px;
  color: #6a0dad;
  text-decoration: none;
  transition: background 0.2s ease;
}

.table td a.btn:hover {
  background-color: #620ba0;
  color: white;
}

/* Dashboard Summary */
.dashboard-summary {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
  justify-content: space-between;
}

.summary-box {
  flex: 1;
  background-color: #e9f2fb;
  border-left: 5px solid #6a0dad;
  color: #333;
  padding: 15px 20px;
  border-radius: 6px;
  text-align: center;
  font-size: 18px;
  transition: all 0.3s ease;
}

.summary-box:hover {
  background: #d8ebff;
}

.summary-box span {
  font-size: 14px;
  color: #777;
}

/* Orders */
.recent-orders {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.order-card {
  border-left: 5px solid #6a0dad;
  padding: 20px;
  background-color: #fff;
  box-shadow: 0 0 5px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.order-card p {
  margin: 6px 0;
  font-size: 14px;
  color: #333;
}

.order-product {
  display: flex;
  align-items: center;
  margin: 10px 0;
  padding-left: 10px;
  border-left: 3px solid #ccc;
}

.order-product img {
  height: 50px;
  width: auto;
  margin-right: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.order-card .btn {
  margin-top: 10px;
  font-size: 14px;
  padding: 6px 12px;
}

/* Scroll to Top Button */
#scrollToTopBtn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  background-color:#6a0dad;
  color: white;
  border: none;
  padding: 8px 12px;
  font-size: 14px;
  border-radius: 50px;
  cursor: pointer;
  display: none;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  transition: background 0.3s ease;
}

#scrollToTopBtn:hover {
  background-color: #a64dff;
}

/* Wishlist Section */
.wishlist-grid {
  padding: 0;
  margin: 0;
}

.wishlist-item {
  margin: 10px 0;
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 15px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  overflow: hidden;
  transition: box-shadow 0.3s ease, transform 0.2s ease;
  text-align: center;
}

.wishlist-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.wishlist-image {
  width: 120px;
  height: 160px;
  object-fit: cover;
  border-radius: 8px;
}

.wishlist-details {
  padding: 12px;
  flex-grow: 1;
}

.wishlist-details h4 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 5px;
  color: #111;
}

.wishlist-details p {
  font-size: 16px;
  margin: 4px 0;
  color: #5a008a;
  font-weight: 500;
}

/* Buttons */
.wishlist-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  justify-content: center;
}

.wishlist-actions .btn {
  flex: 1;
  font-size: 14px;
  padding: 8px 0;
  border-radius: 6px;
  color: white;
  font-weight: 500;
  text-decoration: none;
  text-align: center;
  transition: background-color 0.3s ease;
  display: inline-block;
  min-width: 120px; /* optional minimum width */
}


.btn-view {
  background-color:#6a0dad;
}

.btn-view:hover {
  background-color:#5d0b98;
}

.btn-remove {
  background-color: #dc3545;
}

.btn-remove:hover {
  background-color: #bd2130;
}

/* Address Form */
#address h2 {
  margin-bottom: 20px;
  font-size: 22px;
  color: #333;
}

#address form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  background: #fafafa;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

#address form label {
  font-weight: 600;
  font-size: 14px;
  color: #555;
}

#address form input {
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 15px;
  width: 100%;
  margin-top: 4px;
  margin-bottom: 10px;
  transition: all 0.3s ease;
}

#address form input:focus {
  border-color:#6a0dad;
  outline: none;
  background-color: #f3f9ff;
}

#address form button[type="submit"] {
  grid-column: span 2;
  padding: 12px;
  background-color: #6a0dad;
  color: #fff;
  border: none;
  font-size: 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

#address form button[type="submit"]:hover {
  background-color:#5e0b99;
}

/* Profile Form */
#profile form {
  background-color: #f9f9f9;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  max-width: 600px;
  margin-top: 20px;
}

#profile .form-group {
  margin-bottom: 15px;
}

#profile label {
  font-weight: 600;
  font-size: 14px;
  color: #333;
  display: block;
  margin-bottom: 5px;
}

#profile input {
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 15px;
  transition: border-color 0.3s ease;
}

#profile input:focus {
  border-color: #6a0dad;
  outline: none;
}

#profile .btn-primary {
  margin-top: 10px;
}

#profile .change-password {
  display: inline-block;
  margin-top: 20px;
  color: #6a0dad;
  text-decoration: none;
}

#profile .change-password:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
  .account-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    margin-bottom: 20px;
  }

  .main-content {
   flex: 1;
  max-height: 100vh;
  overflow-y: auto;
  }

  .wishlist-item {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .wishlist-image {
    width: 100%;
    height: auto;
  }

  .wishlist-actions {
    flex-direction: column;
    width: 100%;
  }
}


#password-form input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  margin-bottom: 10px;
}


#get-location-btn,
button[type="submit"] {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 12px;
  font-size: 14px;
  border: none;
  border-radius: 6px;
  background-color:  #6a0dad;
  color: white;
  cursor: pointer;
}

#get-location-btn:hover,
button[type="submit"]:hover {
  background-color:  #520986;
}


#toggle-password-form {
  display: inline-block;
  margin-top: 20px;
  padding: 10px 20px;
  background-color:  #6a0dad; /* Bootstrap primary blue */
  color: white;
  font-weight: 500;
  border-radius: 6px;
  text-decoration: none;
  transition: background-color 0.3s ease;
  font-size: 14px;
}

#toggle-password-form:hover {
  background-color:  #520589; /* Darker shade on hover */
  text-decoration: none;
}

#toggle-password-form:before {
  content: "🔐 ";
}

@media (max-width: 768px) {
  /* collapse layout to a single column */
  .account-container {
    display: block !important;
  }
  /* hide the in-page sidebar (we use the right drawer instead) */
  .account-container .sidebar {
    display: none !important;
  }
}

/* =============== MOBILE POLISH ONLY =============== */
@media (max-width: 768px) {
  /* container + content spacing */
  .account-container {
    display: block !important;
    padding: 12px 12px;
    margin: 12px auto;
    max-width: 100%;
    border-radius: 10px;
    min-height: auto;         /* remove tall empty space */
    overflow: visible;
    background: #fff;
  }
  .main-content {
    flex: 1;
    max-height: none;
    overflow: visible;
    padding: 0 4px;
  }

  /* page titles */
  .tab h2 {
    font-size: 1.25rem;
    margin: 10px 6px 14px;
  }

  /* dashboard summary → neat grid */
  .dashboard-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 18px;
  }
  .summary-box {
    padding: 12px;
    font-size: 16px;
  }

  /* orders cards: remove odd left offset, keep buttons tidy */
  .order-card {
    border-radius: 10px;
    padding: 16px;
    gap: 8px;
  }
  .order-card .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    margin: 10px 0 0 0; /* no large left margin */
    padding: 8px 12px;
    font-size: 14px;
  }
  .order-product {
    padding-left: 0;          /* no extra left bar on mobile */
    border-left: 0;
    margin: 8px 0;
  }

  /* wishlist: centered card with full-width image and full-width buttons */
  .wishlist-grid {
    display: grid;
    gap: 12px;
  }
  .wishlist-item {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 12px;
    border-radius: 10px;
  }
  .wishlist-image {
    width: 100%;
    max-width: 360px;
    height: auto;
    border-radius: 8px;
  }
  .wishlist-details {
    padding: 8px 0 0;
  }
  .wishlist-actions {
    width: 100%;
    gap: 8px;
    margin-top: 10px;
    flex-direction: column;
  }
  .wishlist-actions .btn {
    width: 100%;
    min-width: unset;
    padding: 10px 12px;
    border-radius: 8px;
  }

  /* tables: make them scroll horizontally instead of overflowing */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .table {
    min-width: 600px;  /* keeps columns readable; wrapper scrolls */
  }

  /* address / profile forms → single column, tighter spacing */
  #address form {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 16px;
  }
  #address form button[type="submit"] {
    grid-column: auto;
  }
  #profile form {
    margin: 10px 0;
    padding: 16px;
  }
}

/* very small phones: 1-column dashboard grid */
@media (max-width: 480px) {
  .dashboard-summary { grid-template-columns: 1fr; }
}
/* MOBILE ONLY: use the drawer instead of in-page sidebar */
@media (max-width: 768px) {
  .account-container { display: block !important; }
  .account-container .sidebar { display: none !important; }
}

/* =========================
   MOBILE-ONLY POLISH (≤768)
   ========================= */
@media (max-width: 768px) {
  /* Layout */
  .account-container {
    display: block !important;
    max-width: 100%;
    margin: 12px auto;
    padding: 12px;
    border-radius: 10px;
    box-shadow: none;           /* softer on small screens */
    min-height: auto;
    overflow: visible;
    background: #fff;
  }
  /* Use the right drawer on mobile; hide the page sidebar */
  .account-container .sidebar { display: none !important; }

  .main-content {
    flex: 1;
    max-height: none;
    overflow: visible;
    padding: 0;                 /* tighter edges */
  }

  /* Headings */
  .tab h2 {
    font-size: 1.25rem;
    margin: 8px 4px 14px;
    line-height: 1.2;
  }

  /* Dashboard summary as tidy grid */
  .dashboard-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 0 2px 16px;
  }
  .summary-box {
    padding: 12px;
    font-size: 16px;
    border-radius: 10px;
  }
  .summary-box span { font-size: 13px; }

  /* Order cards */
  .recent-orders,
  #orders .order-card { width: 100%; }
  .order-card {
    border-radius: 12px;
    padding: 14px;
    gap: 8px;
    margin: 10px 2px 14px;
  }
  .order-product {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
    padding-left: 0;            /* remove left bar on mobile */
    border-left: 0;
  }
  .order-product img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
  }

  /* “View Order” / action buttons – right aligned, no giant margins */
  .view-order-btn,
  .btn-order-right {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px !important;
    margin: 8px 0 0 auto !important; /* pushes to the right neatly */
    border-radius: 8px !important;
    text-decoration: none;
    white-space: nowrap;
  }

  /* Wishlist */
  .wishlist-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 0 2px;
  }
  .wishlist-item {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 12px;
    border-radius: 12px;
    margin: 0;
  }
  .wishlist-image {
    width: 100%;
    max-width: 360px;
    height: auto;
    border-radius: 10px;
  }
  .wishlist-details { padding: 10px 0 0; }
  .wishlist-details h4 { font-size: 18px; margin: 6px 0; }
  .wishlist-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin-top: 10px;
  }
  .wishlist-actions .btn {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    min-width: 0;
  }

  /* Address & Profile forms → single column */
  #address form {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
    border-radius: 10px;
  }
  #address form button[type="submit"] { grid-column: auto; }
  #profile form {
    margin: 10px 0;
    padding: 14px;
    border-radius: 10px;
  }

  /* Tables (if you add any later): make them scroll instead of overflowing */
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { min-width: 600px; } /* wrapper will scroll horizontally */

  /* General spacing/typography tweaks */
  .tab p { margin: 6px 2px; font-size: 14px; }
}

/* very small phones */
@media (max-width: 480px) {
  .dashboard-summary { grid-template-columns: 1fr; }
}
/* --- HARD FIX: footer overlapping / inner scroll (MOBILE ONLY) --- */
@media (max-width: 768px) {
  /* Let the page (not the tab) scroll */
  .main-content {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  /* The container should grow with content and not clip anything */
  .account-container {
    min-height: 0 !important;
    overflow: visible !important;
    margin-bottom: 80px; /* space before footer */
    background: #fff;    /* ensure footer text can't ghost through */
    position: relative;
    z-index: 2;
  }

  /* Make sure cards are above footer */
  .tab,
  .order-card,
  .wishlist-item {
    position: relative;
    z-index: 2;
  }
}

/* Optional extra safety even on tablet widths */
@media (max-width: 900px) {
  .main-content { height: auto !important; overflow: visible !important; }
  .account-container { min-height: 0 !important; overflow: visible !important; }
}
/* ===== MOBILE: 2-up wishlist grid (≤768px) ===== */
@media (max-width: 768px) {
  #wishlist .wishlist-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
    padding: 0 4px !important;
  }

  #wishlist .wishlist-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    padding: 10px !important;
    margin: 0 !important;
    border-radius: 10px !important;
  }

  /* Images fill the card cell neatly */
  #wishlist .wishlist-image {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 3 / 4;          /* keeps consistent card height */
    object-fit: cover;
    border-radius: 8px;
  }

  #wishlist .wishlist-details { padding-top: 8px !important; }
  #wishlist .wishlist-details h4 { font-size: 16px !important; }
  #wishlist .wishlist-details p  { font-size: 14px !important; }

  /* Buttons side-by-side inside each card */
  #wishlist .wishlist-actions {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    margin-top: 8px !important;
  }
  #wishlist .wishlist-actions .btn {
    width: 100% !important;
    padding: 9px 10px !important;
    border-radius: 8px !important;
  }
}

/* (optional) super-small phones → fall back to 1-up */
@media (max-width: 380px) {
  #wishlist .wishlist-grid { grid-template-columns: 1fr !important; }
}


/* Review modal */
.review-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: none;
  align-items: center; justify-content: center;
  z-index: 2000;
}
.review-modal.open { display: flex; }
.review-dialog {
  width: min(520px, 92vw);
  background: #fff;
  border-radius: 12px;
  padding: 18px 18px 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  position: relative;
}
.review-close {
  position: absolute; top: 8px; right: 10px;
  border: none; background: transparent; font-size: 24px; cursor: pointer;
}
.review-title { margin: 4px 0 12px; font-size: 18px; }
.review-label { display:block; margin: 12px 0 6px; font-weight:600; }
.review-text {
  width: 100%; min-height: 110px; resize: vertical;
  border: 1px solid #ddd; border-radius: 10px; padding: 10px; font-size: 14px;
}
.review-actions { display:flex; gap:10px; justify-content:flex-end; margin-top: 12px; }

/* Star picker */
.star-picker {
  display: inline-flex; gap: 4px; margin: 8px 0 6px;
}
.star-picker input { display: none; }
.star-picker label {
  font-size: 26px; cursor: pointer; color: #ccc; user-select: none;
  transition: transform .1s ease;
}
.star-picker label:hover { transform: scale(1.06); }

/* Fill stars when selected */
.star-picker input:checked ~ label { color: #ccc; } /* base */
.star-picker input#star1:checked ~ label:nth-last-of-type(n+5),
.star-picker.s1 label:nth-of-type(-n+1),
#star1:checked + label { color: #ffb400; }
.star-picker input#star2:checked ~ label:nth-last-of-type(n+4),
.star-picker.s2 label:nth-of-type(-n+2) { color: #ffb400; }
.star-picker input#star3:checked ~ label:nth-last-of-type(n+3),
.star-picker.s3 label:nth-of-type(-n+3) { color: #ffb400; }
.star-picker input#star4:checked ~ label:nth-last-of-type(n+2),
.star-picker.s4 label:nth-of-type(-n+4) { color: #ffb400; }
.star-picker input#star5:checked ~ label:nth-last-of-type(n+1),
.star-picker.s5 label:nth-of-type(-n+5) { color: #ffb400; }

/* Buttons reuse your theme */
.review-dialog .btn.btn-primary { background:#6a0dad; color:#fff; border: 1px solid #6a0dad; }
.review-dialog .btn.btn-light { background:#f4f4f4; color:#333; border: 1px solid #ddd; }


.star-picker {
  display: inline-flex;
  flex-direction: row-reverse;   /* visual order left→right while DOM is 5..1 */
  gap: 4px;
}
.star-picker input { display: none; }
.star-picker label {
  font-size: 26px;
  cursor: pointer;
  color: #ccc;
  user-select: none;
  line-height: 1;
}

/* Hover: fill this and all to its left (via ~ because of row-reverse) */
.star-picker label:hover,
.star-picker label:hover ~ label { color: #ffb400; }

/* Checked: fill chosen and all to its left */
.star-picker input:checked ~ label { color: #ffb400; }
/* Limit modal height and allow scrolling inside */
.cancel-modal .modal-dialog {
  max-height: 90vh;         /* never exceed viewport height */
  display: flex;
  flex-direction: column;
}

.cancel-modal .modal-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.cancel-modal .modal-body {
  overflow-y: auto;         /* enable scrolling */
  max-height: calc(90vh - 120px); /* adjust for header+footer height */
  padding-right: 10px;      /* prevent scrollbar overlap */
}

/* Optional: smooth scroll on focus */
.cancel-modal input,
.cancel-modal textarea {
  scroll-margin-top: 80px;
}
/* --- Cancel/Refund modal: make content scrollable --- */
#cancel-modal .review-dialog {
  /* limit to viewport and allow scrolling inside */
  max-height: 90vh;
  overflow-y: auto;
}

/* (nice) keep header/buttons visible while the form scrolls */
#cancel-modal .review-dialog {
  display: flex;
  flex-direction: column;
}
#cancel-modal form {
  overflow-y: auto;
  max-height: calc(90vh - 70px); /* subtract title + close button area */
  padding-right: 8px;            /* avoid scrollbar overlap */
}
@media (max-width: 768px) {
  #cancel-modal .review-dialog { max-height: 92vh; }
  #cancel-modal form { max-height: calc(92vh - 70px); }
}
