/* Storage management — per-product media (Maui parity) + optional PWA data buckets.
   Dark row/surface colors use Maui literal Gray600 (#404040) — not remapped --dz-gray-600. */

.dz-stmgmt {
  --dz-stmgmt-top-offset: 12px;
  position: relative;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  isolation: isolate;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.dz-stmgmt__wash {
  position: absolute;
  top: calc(-1 * var(--dz-stmgmt-top-offset));
  left: 0;
  right: 0;
  width: auto;
  height: calc(var(--dz-stmgmt-top-offset) + 280px);
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(93, 24, 159, 0.30) 0%,
    rgba(93, 24, 159, 0.16) 42%,
    rgba(93, 24, 159, 0.05) 72%,
    transparent 100%
  );
}

@media (prefers-color-scheme: dark) {
  .dz-stmgmt__wash {
    background: linear-gradient(
      180deg,
      rgba(159, 88, 225, 0.22) 0%,
      rgba(159, 88, 225, 0.10) 45%,
      transparent 100%
    );
  }
}

.dz-stmgmt__header {
  position: relative;
  z-index: 5;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  width: min(calc(100% - 40px), 440px);
  max-width: 440px;
  margin: 0 auto 8px;
  padding: 0;
  border-radius: 30px;
  background: var(--dz-primary, #350066);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--dz-primary) 30%, transparent);
  box-sizing: border-box;
  direction: rtl;
}

@media (min-width: 900px) {
  .dz-stmgmt__header {
    width: calc(100% - 32px);
    max-width: none;
    margin-left: 16px;
    margin-right: 16px;
  }
}

@media (prefers-color-scheme: dark) {
  .dz-stmgmt__header {
    background: var(--dz-secondary, #8A2BE2);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  }
}

.dz-stmgmt__header-title {
  grid-column: 2;
  margin: 0;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.4;
  padding-bottom: 2px;
}

.dz-stmgmt__back {
  grid-column: 3;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  padding: 0;
}

.dz-stmgmt__back:disabled {
  opacity: 0.5;
  cursor: default;
}

.dz-stmgmt__back .dz-ico {
  width: 22px;
  height: 22px;
}

.dz-stmgmt__header-spacer {
  grid-column: 1;
  width: 40px;
  height: 40px;
}

.dz-stmgmt__scroll {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: min(calc(100% - 20px), 440px);
  max-width: 440px;
  margin: 0 auto;
  /* Clear the bottom fade (~56px) so the quota line can sit above «انتخاب همه». */
  /* Fade clearance only — safe-area lives on .dz-stmgmt__actions (single inset). */
  padding: 0 0 64px;
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  transform: scaleX(-1);
}

.dz-stmgmt__scroll > * {
  transform: scaleX(-1);
}

@media (min-width: 900px) {
  .dz-stmgmt__scroll {
    width: calc(100% - 32px);
    max-width: none;
    margin-left: 16px;
    margin-right: 16px;
  }
}

.dz-stmgmt__info {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 8px;
  padding: 12px 10px;
  border-radius: 12px;
  border: 1px solid #E8DFF5;
  background: #F0EDF5;
  box-sizing: border-box;
}

.dz-stmgmt__info-ico {
  flex: 0 0 auto;
  color: var(--dz-primary, #350066);
  margin-top: 1px;
}

.dz-stmgmt__info-ico .dz-ico {
  width: 20px;
  height: 20px;
}

.dz-stmgmt__info-text {
  margin: 0;
  font-size: 12px;
  line-height: 1.65;
  color: #404040; /* Maui Gray600 */
}

.dz-stmgmt__total {
  margin: 0 0 8px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  box-sizing: border-box;
}

.dz-stmgmt__total-label {
  color: #404040; /* Maui Gray600 */
}

.dz-stmgmt__total-value {
  color: #5D189F; /* Maui PrimaryDark */
}

.dz-stmgmt__list {
  flex: 0 0 auto;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dz-stmgmt__loading,
.dz-stmgmt__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 160px;
  padding: 24px 16px;
  text-align: center;
  color: #919191; /* Maui Gray400 */
  font-size: 14px;
}

.dz-stmgmt__empty-ico .dz-ico {
  width: 40px;
  height: 40px;
  color: #acacac; /* Maui Gray300 */
}

.dz-stmgmt__row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 98%;
  min-height: 84px;
  margin: 0 4px 0 0;
  padding: 10px 12px 10px 8px;
  border: 0;
  border-radius: 12px;
  background: #fff;
  text-align: right;
  font-family: inherit;
  cursor: pointer;
  box-sizing: border-box;
  direction: rtl;
}

.dz-stmgmt__row:disabled {
  cursor: default;
  opacity: 0.7;
}

.dz-stmgmt__row.is-on {
  outline: 1px solid color-mix(in srgb, #350066 35%, transparent);
}

.dz-stmgmt__check {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 36px;
  pointer-events: none;
}

.dz-stmgmt__check input {
  width: 18px;
  height: 18px;
  accent-color: #350066;
}

.dz-stmgmt__thumb {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 10px;
  object-fit: cover;
  background: #f0edf5;
}

.dz-stmgmt__thumb.is-placeholder {
  display: grid;
  place-items: center;
  color: #5d189f;
}

.dz-stmgmt__thumb.is-placeholder .dz-ico {
  width: 24px;
  height: 24px;
}

.dz-stmgmt__thumb.is-bucket {
  color: #6e6e6e;
  background: #f2f2f2;
}

.dz-stmgmt__row-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-start;
}

.dz-stmgmt__row-kicker {
  font-size: 11px;
  font-weight: 600;
  color: #350066;
  opacity: 0.8;
  line-height: 1.2;
}

.dz-stmgmt__row-title {
  font-size: 14px;
  font-weight: 700;
  color: #5D189F; /* Maui PrimaryDark */
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.dz-stmgmt__row-meta {
  font-size: 12px;
  color: #6E6E6E; /* Maui Gray500 */
  line-height: 1.35;
}

/* Local fade above actions (shell fade disabled on this route) */
.dz-stmgmt__bottom {
  position: relative;
  z-index: 5;
  flex: 0 0 auto;
  width: min(calc(100% - 20px), 440px);
  max-width: 440px;
  margin: 0 auto;
  box-sizing: border-box;
}

@media (min-width: 900px) {
  .dz-stmgmt__bottom {
    width: calc(100% - 32px);
    max-width: none;
    margin-left: 16px;
    margin-right: 16px;
  }
}

.dz-stmgmt__fade {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 56px;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(
    to top,
    var(--dz-background, #f2f3f7) 0%,
    color-mix(in srgb, var(--dz-background, #f2f3f7) 55%, transparent) 55%,
    transparent 100%
  );
}

.dz-stmgmt__actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 8px 0 calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--dz-background, #f2f3f7);
  box-sizing: border-box;
}

.dz-stmgmt__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 10px 16px;
  border: 0;
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.dz-stmgmt__btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.dz-stmgmt__btn--muted {
  background: #E1E1E1; /* Maui Gray100 */
  color: #5D189F; /* PrimaryDark */
}

.dz-stmgmt__btn--primary {
  background: #350066; /* Primary */
  color: #fff;
}

.dz-stmgmt__quota {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  margin: 12px 0 4px;
  padding: 10px 8px;
  font-size: 11px;
  text-align: center;
  color: #919191;
  line-height: 1.5;
}

@media (prefers-color-scheme: dark) {
  .dz-stmgmt__info {
    border-color: #3D2858;
    background: #2C1B42;
  }

  .dz-stmgmt__info-ico {
    color: #9f58e1; /* SecondaryDark */
  }

  .dz-stmgmt__info-text {
    color: #acacac; /* Gray300 */
  }

  .dz-stmgmt__total {
    background: #404040; /* Gray600 literal */
  }

  .dz-stmgmt__total-label {
    color: #acacac; /* Gray300 */
  }

  .dz-stmgmt__total-value {
    color: #fff;
  }

  .dz-stmgmt__row {
    background: #404040; /* Gray600 literal */
  }

  .dz-stmgmt__row.is-on {
    outline-color: color-mix(in srgb, #8A2BE2 50%, transparent);
  }

  .dz-stmgmt__row-kicker {
    color: #9f58e1;
    opacity: 0.9;
  }

  .dz-stmgmt__row-title {
    color: #fff;
  }

  .dz-stmgmt__row-meta {
    color: #acacac; /* Gray300 */
  }

  .dz-stmgmt__thumb {
    background: #2c1b42;
  }

  .dz-stmgmt__thumb.is-placeholder {
    color: #9f58e1;
  }

  .dz-stmgmt__thumb.is-bucket {
    background: #333;
    color: #acacac;
  }

  .dz-stmgmt__check input {
    accent-color: #8A2BE2;
  }

  .dz-stmgmt__fade {
    background: linear-gradient(
      to top,
      var(--dz-background, #121212) 0%,
      color-mix(in srgb, var(--dz-background, #121212) 55%, transparent) 55%,
      transparent 100%
    );
  }

  .dz-stmgmt__actions {
    background: var(--dz-background, #121212);
  }

  .dz-stmgmt__btn--muted {
    background: #6E6E6E; /* Gray500 literal */
    color: #fff;
  }

  .dz-stmgmt__btn--primary {
    background: #9f58e1; /* SecondaryDark */
  }

  .dz-stmgmt__empty-ico .dz-ico {
    color: #6E6E6E; /* Gray500 */
  }

  .dz-stmgmt__empty,
  .dz-stmgmt__loading {
    color: #acacac; /* Gray300 */
  }

  .dz-stmgmt__quota {
    color: #acacac;
  }
}
