/* MobileParts — user cabinet styles (leptos SPA at /app/…).
   Reuses the slate/green tokens defined in auth.css (loaded together). */

/* ----- shell ----- */

.cab {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.cab__navbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 58px;
  padding: 0.55rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 30;
}

.cab__navbar-spacer {
  flex: 1;
}

.cab__nav-cta a {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  transition: border-color 0.15s ease;
}

.cab__nav-cta a:hover {
  border-color: var(--muted);
}

.cab__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.cab__brand::before {
  content: "";
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--dark);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2322C55E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='16' height='16' rx='2'/%3E%3Crect x='9' y='9' width='6' height='6'/%3E%3Cpath d='M9 1v3M15 1v3M9 20v3M15 20v3M20 9h3M20 14h3M1 9h3M1 14h3'/%3E%3C/svg%3E");
  background-size: 70%;
  background-position: center;
  background-repeat: no-repeat;
}

.cab__avatar-btn {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
  display: inline-flex;
}

.cab__body {
  display: flex;
  flex: 1;
  align-items: stretch;
}

.cab__sidebar {
  width: 264px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 1.2rem 1rem;
  border-right: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 58px;
  height: calc(100vh - 58px);
  overflow-y: auto;
}

/* ----- profile block (top of the sidebar) ----- */

.cab__profile {
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.cab__profile-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  background: none;
  border: 0;
  font: inherit;
  text-align: left;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease;
}

.cab__profile-btn:hover {
  background: var(--light);
}

.cab__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--dark);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cab__profile-meta {
  min-width: 0;
}

.cab__profile-name {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cab__profile-email {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ----- nav ----- */

.cab__nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.cab__nav-item a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.93rem;
  font-weight: 500;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.cab__nav-item a:hover {
  background: var(--light);
  color: var(--text);
}

.cab__nav-item svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
}

li.cab__nav-item--active a {
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 600;
}

/* ----- sign out (bottom of the sidebar) ----- */

.cab__signout {
  margin-top: auto;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}

.cab__signout .auth__link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
}

.cab__signout .auth__link-btn:hover {
  color: var(--text);
}

.cab__signout svg {
  width: 17px;
  height: 17px;
}

/* ----- content ----- */

.cab__content {
  flex: 1;
  min-width: 0;
  padding: 1.8rem 2.4rem;
}

.cab__page-head {
  margin-bottom: 1.6rem;
}

.cab__crumbs {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.cab__crumbs a {
  color: var(--muted);
}

.cab__crumbs a:hover {
  color: var(--text);
  text-decoration: underline;
}

.cab__title {
  font-size: 1.55rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.cab__subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 0.3rem;
}

.cab__loading {
  color: var(--muted);
  padding: 2rem;
}

/* ----- empty state ----- */

.cab__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.7rem;
  padding: 3.5rem 1.5rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.cab__empty-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--light);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cab__empty-icon svg {
  width: 24px;
  height: 24px;
}

.cab__empty-title {
  font-weight: 700;
  font-size: 1.05rem;
}

.cab__empty-text {
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 400px;
}

/* ----- buttons ----- */

.cab__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.05rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.93rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

a.cab__btn {
  text-decoration: none;
}

.cab__btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.cab__btn--green {
  background: var(--green);
  color: #052e16;
}

.cab__btn--green:hover:not(:disabled) {
  background: #16a34a;
}

.cab__btn--outline {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.cab__btn--outline:hover:not(:disabled) {
  border-color: var(--muted);
}

/* ----- settings modal ----- */

.cab-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.cab-modal__scrim {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: rgb(15 23 42 / 0.45);
  cursor: default;
}

.cab-modal__card {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cab-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cab-modal__title {
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.cab-modal__close {
  border: 0;
  background: var(--light);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cab-modal__close svg {
  width: 16px;
  height: 16px;
}

.cab-modal__close:hover {
  color: var(--text);
}

.cab-modal__tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  background: var(--light);
  border-radius: 10px;
  padding: 0.3rem;
}

.cab-modal__tab {
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
}

.cab-modal__tab--active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.08);
}

.cab-modal__stub {
  padding: 1rem 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* ----- mobile ----- */

.cab__topbar {
  display: none;
}

.cab__burger {
  display: none;
  border: 0;
  background: none;
  padding: 0.3rem;
  cursor: pointer;
  color: var(--text);
}

.cab__burger svg {
  width: 22px;
  height: 22px;
}

.cab__scrim {
  display: none;
}

@media (max-width: 900px) {
  .cab__navbar {
    gap: 0.8rem;
    padding: 0.55rem 1rem;
  }

  .cab__burger {
    display: inline-flex;
  }

  /* the primary CTA lives in the drawer on small screens */
  .cab__nav-cta {
    display: none;
  }

  .cab__scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgb(15 23 42 / 0.4);
    border: 0;
    padding: 0;
    cursor: default;
  }

  .cab__sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    top: 0;
    height: 100vh;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .cab__sidebar--open {
    transform: none;
    box-shadow: 0 10px 40px rgb(15 23 42 / 0.2);
  }

  .cab__content {
    padding: 1.4rem 1rem;
  }

  .cab-modal {
    padding: 0.75rem;
    align-items: flex-end;
  }
}

/* ----- listings ----- */

.cab__page-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

.cab__tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}

.cab__tab {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.cab__tab:hover {
  border-color: var(--muted);
}

.cab__tab--active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-dark);
}

.cab__table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.cab__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 760px;
}

.cab__table th {
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.cab__table td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.cab__table tr:last-child td {
  border-bottom: none;
}

.cab__part {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 240px;
}

.cab__thumb {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--light);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.cab__thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.cab__thumb--empty svg {
  width: 20px;
  height: 20px;
}

.cab__part-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.cab__part-title {
  font-weight: 600;
}

.cab__part-sub {
  font-size: 0.78rem;
  color: var(--muted);
}

.cab__badge {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
}

.cab__badge--active {
  background: var(--green-soft);
  color: var(--green-dark);
}

.cab__badge--draft {
  background: var(--light);
  color: var(--muted);
}

.cab__badge--archived {
  background: #fef3c7;
  color: #92400e;
}

.cab__row-actions {
  display: flex;
  gap: 0.3rem;
}

.cab__icon-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.cab__icon-btn svg {
  width: 15px;
  height: 15px;
}

.cab__icon-btn:hover {
  border-color: var(--muted);
  color: var(--text);
}

.cab__icon-btn--danger:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* ----- wizard ----- */

.cab__steps {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.84rem;
  color: var(--muted);
}

.cab__step {
  font-weight: 600;
}

.cab__step--active {
  color: var(--green-dark);
}

.cab__wizard-step {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.cab__dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 2.2rem 1rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.cab__dropzone:hover {
  border-color: var(--green);
  background: rgb(34 197 94 / 0.04);
}

.cab__file-input {
  display: none;
}

.cab__dropzone-title {
  font-weight: 700;
}

.cab__dropzone-sub {
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 420px;
}

.cab__dropzone-note {
  font-size: 0.82rem;
  color: var(--muted);
}

.cab__thumbs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cab__thumb-item {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}

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

.cab__thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: rgb(15 23 42 / 0.7);
  color: #fff;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cab__grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.cab__wiz-title {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  background: var(--light);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
}

.cab__wiz-title-value {
  font-weight: 700;
}

.cab__wizard-foot {
  display: flex;
  justify-content: flex-end;
}

.cab__wizard-foot-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  width: 100%;
  flex-wrap: wrap;
}

.cab__wizard-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .cab__grid2 {
    grid-template-columns: 1fr;
  }

  .cab__page-actions {
    justify-content: stretch;
  }

  .cab__page-actions .cab__btn {
    width: 100%;
    justify-content: center;
  }
}

/* ----- cart ----- */

.cab__cart {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.2rem;
  align-items: start;
}

.cab__cart-lines {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cab__cart-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}

.cab__cart-seller {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 0.6rem;
}

.cab__cart-line {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--border);
}

.cab__cart-line-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
  min-width: 0;
}

.cab__cart-line-title {
  font-weight: 600;
  font-size: 0.92rem;
}

.cab__cart-line-title:hover {
  text-decoration: underline;
}

.cab__qty {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.cab__qty-num {
  min-width: 1.4rem;
  text-align: center;
  font-weight: 600;
}

.cab__cart-line-sum {
  font-weight: 700;
  min-width: 96px;
  text-align: right;
}

.cab__cart-total {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  position: sticky;
  top: 74px;
}

.cab__cart-total-row {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0;
}

.cab__cart-total-row--sum {
  color: var(--text);
  font-weight: 800;
  font-size: 1.15rem;
}

/* ----- favorites ----- */

.cab__fav-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.cab__fav-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.cab__fav-img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  background: var(--light);
}

.cab__fav-body {
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: flex-start;
}

.cab__fav-title {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
}

.cab__fav-title:hover {
  text-decoration: underline;
}

.cab__fav-price {
  font-weight: 800;
}

.cab__fav-foot {
  margin-top: auto;
  padding: 0.7rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

@media (max-width: 900px) {
  .cab__cart {
    grid-template-columns: 1fr;
  }

  .cab__cart-total {
    position: sticky;
    bottom: 0;
  }

  .cab__fav-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .cab__cart-line-sum {
    display: none;
  }
}
