/* Service Modal Component Styles - Redesigned for Dashboard Theme */

/* Ensure all elements use border-box sizing */
.service-modal *,
.service-modal *::before,
.service-modal *::after {
  box-sizing: border-box;
}

:root {
  /* Service Modal specific variables - aligned with dashboard theme */
  --service-modal-bg: var(--dashboard-panel);
  --service-modal-border: var(--dashboard-border);
  --service-modal-text: var(--dashboard-text);
  --service-modal-text-secondary: var(--dashboard-text-secondary);
  --service-modal-accent: var(--dashboard-accent);
  --service-modal-success: var(--dashboard-success);
  --service-modal-warning: var(--dashboard-warning);
  --service-modal-danger: var(--dashboard-danger);
  --service-modal-info: var(--dashboard-info);
  
  /* Spacing - using dashboard spacing system */
  --service-space-xs: var(--space-xs);
  --service-space-sm: var(--space-sm);
  --service-space-md: var(--space-md);
  --service-space-lg: var(--space-lg);
  --service-space-xl: var(--space-xl);
  --service-space-2xl: var(--space-2xl);
  --service-space-3xl: var(--space-3xl);
  
  /* Border radius - using dashboard radius system */
  --service-radius-sm: var(--radius-sm);
  --service-radius: var(--radius-lg);
  --service-radius-lg: var(--radius-lg);
  
  /* Transitions - using dashboard transitions */
  --service-transition: var(--transition);
  --service-transition-slow: var(--transition-slow);
}

/* Service Modal Base */
.service-modal {
  visibility: hidden;
  opacity: 0;
  position: fixed;
  inset: 0;
  z-index: 2000;
  pointer-events: none;
}

.service-modal.show {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.service-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  opacity: 0;
  transition: opacity 0.42s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 2000;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.service-modal.show .service-modal-backdrop {
  opacity: 1;
}

/* Service Modal Form */
.service-modal-form {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(800px, 95vw);
  max-width: 800px;
  max-height: 90vh;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(91, 67, 234, 0.2);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  z-index: 2001;
  /* Scroll lives in .service-modal-content so header/actions stay pinned */
  overflow-y: hidden;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
  box-sizing: border-box;
  justify-content: flex-start;
  transition: none;
  opacity: 1;
}

@media (min-width: 769px) {
  .service-modal.show .service-modal-form {
    transform: translate(-50%, -50%);
    opacity: 1;
  }
}

/* Mobile Bottom Sheet Handle */
.service-modal-handle {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 24px;
  background: transparent;
  cursor: grab;
  z-index: 10;
  touch-action: none;
  user-select: none;
}

.service-modal-handle:active {
  cursor: grabbing;
}

.service-modal-handle-bar {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  background: var(--service-modal-text-secondary);
  border-radius: 2px;
  opacity: 0.6;
  transition: opacity 0.08s ease;
}

.service-modal-handle:hover .service-modal-handle-bar {
  opacity: 1;
}

/* Handle + header wrapper — on mobile sheet, this block is sticky so the handle stays with the title */
.service-modal-top {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}


/* Service Modal Header — single block: icon + title row + optional subline */
.service-modal-header {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: sticky;
  top: 0;
  z-index: 9;
  flex-shrink: 0;
  margin-bottom: var(--service-space-lg);
  padding: var(--service-space-lg) var(--service-space-xl) var(--service-space-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  background: var(--service-modal-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.service-modal-header-row {
  display: flex;
  align-items: flex-start;
  gap: var(--service-space-md);
  min-width: 0;
}

.service-modal-header-title-row {
  display: flex;
  align-items: center;
  gap: var(--service-space-sm);
  min-width: 0;
}

.service-modal-header-aside {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-inline-start: auto;
}

.service-modal-header-aside[hidden] {
  display: none !important;
}

/* Legacy alias — cached HTML may still use header-content */
.service-modal-header-content {
  display: flex;
  align-items: flex-start;
  gap: var(--service-space-lg);
  flex: 1;
  min-width: 0;
  overflow: visible;
}


.service-modal-icon {
  display: flex;
  align-items: center;
  color: var(--service-modal-accent);
  font-size: 22px;
}

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

.service-modal-icon img {
  width: 24px;
  height: 24px;
  display: block;
  object-fit: contain;
}

/* Icon via IconRenderer (category-icon-wrap) in modal header */
.service-modal-icon .category-icon-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.service-modal-icon .category-icon-tinted {
  position: absolute;
  inset: 0;
  background: var(--service-modal-accent);
  -webkit-mask-image: var(--icon-url);
  mask-image: var(--icon-url);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

.service-modal-icon .category-icon-css-fallback {
  font-size: 24px;
  color: var(--service-modal-accent);
  display: none;
}

.service-modal-icon .category-icon-css-fallback[style*="inline"] {
  display: inline-flex;
}

/* Monochrome mask renderer for custom SVG icons (inherits currentColor like Iconoir) */
.service-modal-icon .service-modal-icon-mask {
  width: 24px;
  height: 24px;
  display: block;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.service-modal-header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.service-modal-title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--service-modal-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.service-modal-subtitle {
  margin: 0;
  font-size: 0.6875rem;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.58);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Same row as subtitle — aligned like service-card quantity range (left in RTL) */
.service-modal-header-subline {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  min-width: 0;
  margin-top: 2px;
}

html[dir="rtl"] .service-modal-header-subline {
  flex-direction: row-reverse;
}

.service-modal-header-subline.is-range-only .service-modal-subtitle {
  display: none;
}

.service-modal-header-range {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.38);
  letter-spacing: 0.01em;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.service-modal-header-subline .service-modal-subtitle {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}

.service-modal-header-subline[hidden] {
  display: none !important;
}

.service-modal-header-hint {
  flex-shrink: 0;
  font-size: 0.6875rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.42);
  white-space: nowrap;
}

.service-modal-header-hint::before {
  content: '·';
  margin-inline: 0.35rem;
  opacity: 0.55;
}

.service-modal-header-subline .service-modal-header-hint:first-child::before,
.service-modal-header-subline.is-range-only .service-modal-header-hint::before {
  content: none;
  margin: 0;
}

.service-modal-header-right {
  display: flex;
  align-items: center;
  gap: var(--service-space-sm);
  margin-left: auto;
  flex-shrink: 0;
  flex-wrap: nowrap;
  min-width: fit-content;
}

/* Legacy — removed from markup; keep rule so cached HTML does not flash a pill */
.service-modal-header-price {
  display: none !important;
}

/* Stock Badge */
.service-modal-stock-badge {
  display: flex !important;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-xs, 10px);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  visibility: visible !important;
  opacity: 1 !important;
  flex-shrink: 0;
}

.service-modal-stock-badge.stock-in {
  background: rgba(16, 185, 129, 0.15);
  color: var(--service-modal-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.service-modal-stock-badge.stock-low {
  background: rgba(245, 158, 11, 0.15);
  color: var(--service-modal-warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.service-modal-stock-badge.stock-out {
  background: rgba(239, 68, 68, 0.15);
  color: var(--service-modal-danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.service-modal-stock-badge.stock-unlimited {
  background: rgba(91, 67, 234, 0.15);
  color: var(--service-modal-accent);
  border: 1px solid rgba(91, 67, 234, 0.3);
}

.stock-badge-text {
  font-size: inherit;
  font-weight: inherit;
}

/* Stock Alert */
.service-modal-stock-alert {
  margin: var(--service-space-lg) var(--service-space-2xl);
  padding: calc(var(--service-space-md) + 8px) calc(var(--service-space-lg) + 10px);
  border-radius: calc(var(--service-radius) + 4px);
  display: flex;
  align-items: center;
  gap: calc(var(--service-space-md) + 2px);
  position: relative;
  background: rgba(255, 206, 104, 0.06);
  border: 1px solid rgba(255, 206, 104, 0.12);
  color: rgba(255, 226, 170, 0.92);
}

.service-modal-stock-alert.stock-alert-low {
  background: rgba(255, 206, 104, 0.085);
  border-color: rgba(255, 206, 104, 0.16);
  color: rgba(255, 208, 130, 0.92);
}

.service-modal-stock-alert.stock-alert-out {
  color: rgba(255, 177, 177, 0.92);
  background: rgba(255, 138, 138, 0.08);
  border-color: rgba(255, 138, 138, 0.16);
}

.stock-alert-content {
  display: flex;
  align-items: center;
  gap: var(--service-space-md);
  width: 100%;
}

.stock-alert-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs, 10px);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: inherit;
}

.stock-alert-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.stock-alert-title {
  font-weight: 600;
  font-size: 0.82rem;
  opacity: 0.84;
  letter-spacing: 0.01em;
  text-transform: none;
}

.stock-alert-message {
  font-size: 0.8rem;
  opacity: 0.7;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.88);
}

.stock-alert-message strong {
  font-size: 0.85rem;
  font-weight: 700;
  color: inherit;
}


/* Service Modal Content */
.service-modal-content {
  display: flex;
  flex-direction: column;
  gap: var(--service-space-xl);
  /* auto basis: grow with content on desktop (form has no fixed height).
     min-height:0 + overflow allow shrink/scroll when form hits max-height. */
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: var(--service-space-2xl);
}


.service-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--service-space-2xl);
  align-items: start;
  min-height: 0;
  min-width: 0;
  overflow: visible;
}

/* Form Fields */
.service-modal-fields {
  display: flex;
  flex-direction: column;
  gap: var(--service-space-lg);
  min-width: 0;
  flex: 1;
  max-width: 100%;
  overflow: visible;
}

.service-modal-group {
  display: flex;
  flex-direction: column;
  gap: var(--service-space-sm);
}

.service-modal-label {
  display: flex;
  align-items: center;
  gap: var(--service-space-sm);
  color: var(--service-modal-text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
}

.service-modal-label-icon {
  width: 16px;
  height: 16px;
  color: var(--service-modal-accent);
}

.service-modal-group input,
.service-modal-group textarea,
.service-modal-group select,
.service-modal-group .service-modal-select {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(91, 67, 234, 0.2);
  color: var(--service-modal-text);
  border-radius: var(--service-radius-lg);
  padding: var(--service-space-md) var(--service-space-lg);
  font-size: 0.875rem;
  transition: all 0.2s ease;
  width: 100%;
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.service-modal-group input:focus,
.service-modal-group textarea:focus,
.service-modal-group select:focus {
  outline: none;
  border-color: var(--active-border);
  background: rgba(255, 255, 255, 0.04);
}

/* Input with clear button */
.service-modal-input-clear {
  position: relative;
  display: flex;
  align-items: center;
}

.service-modal-input-clear input {
  padding-right: 80px;
}

.service-modal-paste-btn {
  position: absolute;
  right: 40px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(91, 67, 234, 0.2);
  color: var(--service-modal-accent);
  cursor: pointer;
  padding: var(--service-space-xs);
  border-radius: var(--service-radius-sm);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  opacity: 0;
  visibility: hidden;
}

.service-modal-paste-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--active-border);
  color: var(--service-modal-accent);
  transform: translateY(-50%) scale(1.05);
}

.service-modal-paste-btn:active {
  transform: translateY(-50%) scale(0.95);
}

.service-modal-paste-btn svg {
  width: 14px;
  height: 14px;
}

.service-modal-clear-btn {
  position: absolute;
  right: var(--service-space-sm);
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--service-modal-text-secondary);
  cursor: pointer;
  padding: var(--service-space-xs);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.08s ease;
  opacity: 0;
  visibility: hidden;
}

.service-modal-clear-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--service-modal-text);
}

.service-modal-input-clear:focus-within .service-modal-paste-btn,
.service-modal-input-clear:hover .service-modal-paste-btn,
.service-modal-input-clear:focus-within .service-modal-clear-btn,
.service-modal-input-clear:hover .service-modal-clear-btn {
  opacity: 1;
  visibility: visible;
}

.service-modal-clear-btn svg {
  width: 14px;
  height: 14px;
}

/* Field Help */
.service-modal-field-help {
  color: var(--service-modal-text-secondary);
  font-size: 0.75rem;
  line-height: 1.4;
  margin-top: var(--service-space-xs);
}

/* Validation Message */
.service-modal-validation {
  font-size: 0.75rem;
  line-height: 1.4;
  margin-top: var(--service-space-xs);
  padding: var(--service-space-sm) var(--service-space-sm);
  border-radius: var(--service-radius-sm);
  transition: all 0.1s ease;
}

.validation-content {
  display: flex;
  align-items: center;
  gap: var(--service-space-xs);
}

.validation-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.validation-text {
  line-height: 1;
  padding-top: 2px;
}


.service-modal-validation.valid {
  color: var(--service-modal-success);
  background: rgba(38, 194, 129, 0.1);
  border: 1px solid rgba(38, 194, 129, 0.2);
}

.service-modal-validation.invalid {
  color: var(--service-modal-danger);
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Quantity Controls */
.service-modal-quantity-controls {
  display: flex;
  flex-direction: column;
  gap: var(--service-space-lg);
  width: 100%;
}

.service-modal-quantity-presets {
  display: flex;
  flex-wrap: wrap;
  gap: var(--service-space-sm);
  margin-top: var(--service-space-xs);
  margin-bottom: var(--service-space-md);
  padding-top: 10px;
  overflow-y: visible;
  scrollbar-width: thin;
  scrollbar-color: var(--service-modal-border) transparent;
}

.service-modal-quantity-presets::-webkit-scrollbar {
  width: 4px;
}

.service-modal-quantity-presets::-webkit-scrollbar-track {
  background: transparent;
}

.service-modal-quantity-presets::-webkit-scrollbar-thumb {
  background: var(--service-modal-border);
  border-radius: 2px;
}

.service-modal-quantity-presets::-webkit-scrollbar-thumb:hover {
  background: var(--service-modal-accent);
}

.service-modal-preset-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(91, 67, 234, 0.2);
  color: var(--service-modal-text-secondary);
  padding: var(--service-space-sm) var(--service-space-md) calc(var(--service-space-sm) + 3px);
  border-radius: var(--service-radius-lg);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--service-space-xs);
  min-width: 0;
  flex: 1;
  max-width: 80px;
  box-sizing: border-box;
  overflow: visible;
  white-space: nowrap;
}

.service-modal-preset-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--active-border);
  color: var(--service-modal-text);
}

.service-modal-preset-btn.active {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--active-border);
  color: var(--service-modal-accent);
}

.preset-value {
  font-weight: 600;
  font-size: 0.875rem;
}

.preset-label {
  font-size: 0.7rem;
  opacity: 0.8;
  line-height: 1.25;
}

/* Quantity Input with Stepper */
.service-modal-quantity-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.service-modal-quantity-input-wrapper input {
  padding-right: 50px;
}

/* Minimal Quantity Stepper - Global Style */
.quantity-stepper,
.service-modal-quantity-stepper {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 1px;
  z-index: 1;
}

.quantity-stepper button,
.service-modal-quantity-stepper button,
.qty-btn,
.service-modal-qty-btn {
  width: 20px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: color 0.15s ease;
  padding: 0;
  margin: 0;
}

.quantity-stepper button:hover,
.service-modal-quantity-stepper button:hover,
.qty-btn:hover,
.service-modal-qty-btn:hover {
  color: rgba(255, 255, 255, 0.8);
}

.quantity-stepper button:active,
.service-modal-quantity-stepper button:active,
.qty-btn:active,
.service-modal-qty-btn:active {
  color: rgba(255, 255, 255, 1);
}

.quantity-stepper button svg,
.service-modal-quantity-stepper button svg,
.qty-btn svg,
.service-modal-qty-btn svg {
  width: 10px;
  height: 10px;
  stroke-width: 2.5;
}

/* Package Presets */
.service-modal-package-presets {
  display: flex;
  flex-wrap: wrap;
  gap: var(--service-space-sm);
  margin-top: var(--service-space-xs);
  margin-bottom: var(--service-space-md);
  overflow: visible;
  scrollbar-width: thin;
  scrollbar-color: var(--service-modal-border) transparent;
}

/* Account services — desktop package cards in a tidy grid */
@media (min-width: 769px) {
  .service-modal-package-presets.is-account-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--service-space-md);
    flex-wrap: unset;
    overflow: visible;
    margin-top: var(--service-space-sm);
  }

  .service-modal-package-presets.is-account-grid.is-account-grid--single {
    grid-template-columns: minmax(0, min(240px, 100%));
    width: fit-content;
    max-width: 100%;
  }

  .service-modal-package-presets.is-account-grid .service-modal-package-preset-btn {
    width: 100%;
    min-width: 0;
    max-width: none;
    flex: unset;
    white-space: normal;
    padding: var(--service-space-md) var(--service-space-lg);
    min-height: 76px;
    justify-content: center;
    align-items: center;
    gap: var(--service-space-xs);
    background: rgba(255, 255, 255, 0.03);
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  }

  .service-modal-package-presets.is-account-grid .service-modal-package-preset-btn .preset-name {
    font-size: 0.8125rem;
    line-height: 1.35;
    word-break: break-word;
    text-wrap: balance;
  }

  .service-modal-package-presets.is-account-grid .service-modal-package-preset-btn .preset-price {
    font-size: 0.75rem;
    margin-top: 2px;
  }

  .service-modal-package-presets.is-account-grid .service-modal-package-preset-btn.has-discount .preset-price {
    flex-direction: column;
    gap: 2px;
  }

  .service-modal-package-presets.is-account-grid .service-modal-package-preset-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--active-border);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  }

  .service-modal-package-presets.is-account-grid .service-modal-package-preset-btn.active {
    background: rgba(91, 67, 234, 0.1);
    border-color: var(--service-modal-accent);
    box-shadow: 0 0 0 1px rgba(91, 67, 234, 0.28);
    color: var(--service-modal-text);
  }

  .service-modal-package-presets.is-account-grid .service-modal-package-preset-btn.active .preset-name {
    color: var(--service-modal-accent);
  }

  .service-modal-package-presets.is-account-grid .service-modal-package-preset-btn .discount-badge {
    top: 6px;
    right: auto;
    inset-inline-end: 6px;
    font-size: 0.5625rem;
    padding: 2px 5px;
  }
}

.service-modal-package-presets::-webkit-scrollbar {
  width: 4px;
}

.service-modal-package-presets::-webkit-scrollbar-track {
  background: transparent;
}

.service-modal-package-presets::-webkit-scrollbar-thumb {
  background: var(--service-modal-border);
  border-radius: 2px;
}

.service-modal-package-presets::-webkit-scrollbar-thumb:hover {
  background: var(--service-modal-accent);
}

/* Selected package description (per-package admin text) */
.service-modal-package-description {
  margin-top: calc(-1 * var(--service-space-xs));
  margin-bottom: var(--service-space-md);
  padding: var(--service-space-sm) var(--service-space-md);
  border-radius: var(--service-radius-lg);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(91, 67, 234, 0.15);
}

.service-modal-package-description-text {
  margin: 0;
  color: var(--service-modal-text-secondary);
  font-size: 0.8125rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.service-modal-bundle-recipe {
  margin-top: var(--service-space-sm);
}

.service-modal-bundle-recipe-title {
  margin: 0 0 var(--service-space-xs);
  color: var(--service-modal-text-primary);
  font-size: 0.8125rem;
  font-weight: 600;
}

.service-modal-bundle-recipe-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.service-modal-bundle-recipe-list li {
  position: relative;
  padding-right: 1.1rem;
  color: var(--service-modal-text-secondary);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.service-modal-bundle-recipe-list li::before {
  content: '•';
  position: absolute;
  right: 0;
  color: var(--service-modal-accent);
  font-weight: 700;
}

.service-modal-bundle-recipe-note {
  margin: var(--service-space-sm) 0 0;
  color: var(--service-modal-text-muted, var(--service-modal-text-secondary));
  font-size: 0.75rem;
  line-height: 1.4;
  opacity: 0.85;
}

.service-modal-bundle-summary {
  margin: var(--service-space-xs) 0 var(--service-space-sm);
  padding-top: var(--service-space-xs);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.service-modal-bundle-recipe-list--compact li {
  font-size: 0.75rem;
}

.service-modal-package-preset-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(91, 67, 234, 0.2);
  color: var(--service-modal-text-secondary);
  padding: var(--service-space-sm) var(--service-space-md);
  border-radius: var(--service-radius-lg);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 60px;
  flex: 0 1 auto;
  max-width: none;
  box-sizing: border-box;
  overflow: visible;
  white-space: nowrap;
  width: fit-content;
}

.service-modal-package-preset-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--active-border);
  color: var(--service-modal-text);
}

.service-modal-package-preset-btn.active {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--active-border);
  color: var(--service-modal-accent);
}

/* Package preset button with discount - maintain consistency */
.service-modal-package-preset-btn.has-discount {
  /* Keep same styling as normal buttons for consistency */
}

.service-modal-package-preset-btn.has-discount .preset-price {
  /* Ensure discount prices are properly aligned */
  flex-direction: row;
  align-items: center;
  justify-content: center;
}

.preset-name {
  font-weight: 600;
  font-size: 0.8rem;
}

.preset-price {
  font-size: 0.7rem;
  opacity: 0.8;
  color: var(--service-modal-success);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  line-height: 1.2;
}

/* Discount price styling for package presets */
.preset-price .original-price {
  text-decoration: line-through;
  color: var(--service-modal-text-secondary);
  font-size: 0.65rem;
  opacity: 0.6;
  font-weight: 400;
  order: 1;
}

.preset-price .discount-price {
  color: var(--service-modal-success);
  font-size: 0.7rem;
  opacity: 1;
  font-weight: 600;
  order: 2;
}

/* When there's no discount, keep the single price centered */
.preset-price:not(:has(.original-price)) {
  justify-content: center;
}

/* Quantity Slider */
.service-modal-quantity-slider {
  margin-top: var(--service-space-sm);
  width: 100%;
  position: relative;
}

.service-modal-quantity-slider input[type="range"] {
  width: 99.25%;
  height: 6px;
  background: var(--service-modal-border);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  display: block;
}

.service-modal-quantity-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: var(--service-modal-accent);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.08s ease;
}

.service-modal-quantity-slider input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.service-modal-slider-labels {
  display: flex;
  justify-content: space-between;
  margin-top: var(--service-space-xs);
  font-size: 0.75rem;
  color: var(--service-modal-text-secondary);
}

/* Select Wrapper */
.service-modal-select-wrapper {
  position: relative;
}

.service-modal-select-wrapper select {
  padding-right: 40px;
  -webkit-appearance: none;
  appearance: none;
}

.service-modal-select-arrow {
  position: absolute;
  right: var(--service-space-md);
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--service-modal-text-secondary);
  pointer-events: none;
}

/* Order Summary */
.service-modal-summary {
  background: transparent;
  border: none;
  border-radius: var(--service-radius-lg);
  padding: 0;
  position: sticky;
  top: var(--service-space-lg);
  min-width: 0;
  flex-shrink: 0;
  max-width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--service-space-lg);
}

/* Order Card - New Design */
.service-modal-order-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(91, 67, 234, 0.2);
  border-radius: var(--service-radius-lg);
  padding: var(--service-space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--service-space-md);
  position: relative;
}

.service-modal-order-header {
  margin-bottom: var(--service-space-xs);
}

.service-modal-order-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--service-modal-text);
}

.service-modal-order-content {
  display: flex;
  flex-direction: column;
  gap: var(--service-space-md);
}

.service-modal-order-service {
  display: flex;
  flex-direction: column;
  gap: var(--service-space-xs);
  padding-bottom: var(--service-space-md);
  border-bottom: none;
  position: relative;
}

.service-modal-order-service::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0.5px;
  background: rgba(255, 255, 255, 0.04);
}

.service-modal-order-service-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--service-modal-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.service-modal-order-service-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--service-modal-text);
}

.service-modal-order-details {
  display: flex;
  flex-direction: column;
  gap: var(--service-space-sm);
}

.service-modal-order-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
}

.service-modal-order-label {
  color: var(--service-modal-text-secondary);
  font-weight: 500;
}

.service-modal-order-value {
  color: var(--service-modal-text);
  font-weight: 600;
  transition: opacity 200ms ease;
}

.service-modal-order-value.updating {
  opacity: 0.6;
}

.service-modal-order-price-breakdown {
  display: flex;
  flex-direction: column;
  gap: var(--service-space-xs);
  padding-top: var(--service-space-sm);
  margin-top: var(--service-space-sm);
  border-top: none;
  font-size: 0.8125rem;
  position: relative;
  transition: opacity 200ms ease;
}

.service-modal-order-price-breakdown::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0.5px;
  background: rgba(255, 255, 255, 0.04);
}

.service-modal-order-row.discount-row .service-modal-order-label {
  color: var(--service-modal-success, #10b981);
}

.service-modal-order-row.discount-row .service-modal-order-value.discount-value {
  color: var(--service-modal-success, #10b981);
  font-weight: 600;
  transition: opacity 200ms ease;
}

.service-modal-order-row.discount-row .service-modal-order-value.discount-value.updating {
  opacity: 0.6;
}

/* Per-unit price row - subtle styling */
.service-modal-per-unit-row {
  font-size: 0.75rem;
}

.service-modal-per-unit-label {
  color: var(--service-modal-text-secondary);
  font-weight: 400;
}

.service-modal-per-unit-value {
  color: var(--service-modal-text-secondary);
  font-weight: 500;
  transition: opacity 200ms ease;
}

.service-modal-per-unit-value.updating {
  opacity: 0.6;
}

.service-modal-order-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--service-space-md);
  margin-top: var(--service-space-md);
  border-top: none;
  position: relative;
}

.service-modal-order-total::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0.5px;
  background: rgba(255, 255, 255, 0.06);
}

.service-modal-order-total-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--service-modal-text);
}

.service-modal-order-total-amount {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--service-modal-accent);
  transition: opacity 200ms ease;
}

.service-modal-order-total-amount.updating {
  opacity: 0.6;
}

/* Collapsible order summary (phase 0 — mobile collapsed, desktop expanded via JS) */
.service-modal-order-disclosure {
  margin: 0;
}

.service-modal-order-disclosure-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--service-space-md);
  list-style: none;
  cursor: pointer;
  padding: 0;
  margin: 0;
  user-select: none;
}

.service-modal-order-disclosure-summary::-webkit-details-marker {
  display: none;
}

.service-modal-order-disclosure-leading {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--service-space-xs);
  min-width: 0;
  flex: 1;
}

.service-modal-order-disclosure-action {
  display: inline-flex;
  align-items: center;
  gap: var(--service-space-xs);
}

.service-modal-order-disclosure-hint {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--service-modal-accent);
}

.service-modal-order-disclosure-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--service-radius-sm);
  background: rgba(91, 67, 234, 0.12);
  border: 1px solid rgba(91, 67, 234, 0.28);
  color: var(--service-modal-accent);
  flex-shrink: 0;
  transition: transform 0.2s ease, background 0.15s ease;
}

.service-modal-order-disclosure-chevron svg {
  width: 16px;
  height: 16px;
}

.service-modal-order-disclosure-total {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--service-modal-accent);
  flex-shrink: 0;
  transition: opacity 200ms ease;
}

.service-modal-order-disclosure-total.updating {
  opacity: 0.6;
}

.service-modal-order-disclosure[open] .service-modal-order-disclosure-chevron {
  transform: rotate(180deg);
}

@media (min-width: 769px) {
  .service-modal-order-disclosure-summary {
    cursor: default;
    pointer-events: none;
    padding: 0;
    margin: 0 0 var(--service-space-xs);
    background: transparent;
    border: none;
  }

  .service-modal-order-disclosure-leading {
    flex-direction: row;
    align-items: center;
    gap: var(--service-space-sm);
  }

  .service-modal-order-disclosure-action {
    display: none;
  }

  .service-modal-order-disclosure-hint {
    display: none;
  }

  .service-modal-order-disclosure-total {
    display: none;
  }

  .service-modal-order-disclosure .service-modal-order-content {
    padding-top: 0;
  }
}

@media (max-width: 768px) {
  /* Single outer frame — summary row uses fill/divider, not a second box */
  .service-modal-form.is-mobile-sheet .service-modal-order-card {
    padding: 0;
    overflow: hidden;
  }

  .service-modal-order-disclosure-summary {
    padding: var(--service-space-md) var(--service-space-lg);
    margin: 0;
    border: none;
    border-radius: 0;
    background: rgba(91, 67, 234, 0.06);
    transition: background 0.15s ease;
  }

  .service-modal-order-disclosure-summary:hover {
    background: rgba(91, 67, 234, 0.1);
  }

  .service-modal-order-disclosure[open] .service-modal-order-disclosure-summary {
    margin-bottom: 0;
    border-bottom: 1px solid rgba(91, 67, 234, 0.18);
    background: rgba(91, 67, 234, 0.04);
  }

  .service-modal-order-disclosure .service-modal-order-content {
    padding: var(--service-space-md) var(--service-space-lg);
  }

  .service-modal-order-disclosure-action {
    padding: 2px 0;
  }

  /* Total lives on the collapsed summary row — avoid duplicate inside expanded body */
  .service-modal-form.is-mobile-sheet .service-modal-order-disclosure .service-modal-order-total {
    display: none;
  }

  /* Guest + single gateway: CTA already shows Zarinpal */
  .service-modal-payment-card.is-compact-external-pay {
    padding: 0;
    border: none;
    background: transparent;
    gap: 0;
    margin: 0;
  }

  .service-modal-payment-card.is-compact-external-pay .service-modal-pay-tabs-wrap,
  .service-modal-payment-card.is-compact-external-pay .service-modal-gateway-content,
  .service-modal-payment-card.is-compact-external-pay .service-modal-gateway-header,
  .service-modal-payment-card.is-compact-external-pay .service-modal-gateway-options {
    display: none !important;
  }

  .service-modal-summary:has(.service-modal-payment-card.is-compact-external-pay) {
    gap: var(--service-space-md);
  }
}

.service-modal-payment-card.is-guest-single-gateway {
  display: none !important;
}

/* Payment Card - New Design */
.service-modal-payment-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(91, 67, 234, 0.2);
  border-radius: var(--service-radius-lg);
  padding: var(--service-space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--service-space-lg);
}

/* Payment tabs — wallet + gateway (minimal segmented row) */
.service-modal-pay-tabs-wrap {
  position: relative;
}

.service-modal-pay-tabs-wrap.is-scroll-fade::before,
.service-modal-pay-tabs-wrap.is-scroll-fade::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 14px;
  z-index: 1;
  pointer-events: none;
}

.service-modal-pay-tabs-wrap.is-scroll-fade::before {
  inset-inline-start: 0;
  border-radius: var(--service-radius-lg) 0 0 var(--service-radius-lg);
  background: linear-gradient(to right, var(--service-modal-bg), transparent);
}

.service-modal-pay-tabs-wrap.is-scroll-fade::after {
  inset-inline-end: 0;
  border-radius: 0 var(--service-radius-lg) var(--service-radius-lg) 0;
  background: linear-gradient(to left, var(--service-modal-bg), transparent);
}

.service-modal-pay-tabs-wrap.is-scroll-fade .service-modal-pay-tab {
  flex: 0 0 auto;
  min-width: 88px;
}

.service-modal-pay-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  border-radius: var(--service-radius-lg);
  background: rgba(255, 255, 255, 0.04);
  overflow-x: auto;
  scrollbar-width: none;
}

.service-modal-pay-tabs::-webkit-scrollbar {
  display: none;
}

#serviceModalGatewayTabs {
  display: contents;
}

.service-modal-payment-method-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.service-modal-pay-tab {
  flex: 1 1 0;
  min-width: 0;
  cursor: pointer;
}

.service-modal-pay-tab input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.service-modal-pay-tab > span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 10px;
  border-radius: var(--service-radius);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--service-modal-text-secondary);
}

.service-modal-pay-tab img {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  object-fit: contain;
  border-radius: var(--service-radius-sm);
}

.service-modal-pay-tab input:checked + span {
  background: rgba(91, 67, 234, 0.15);
  color: var(--service-modal-accent);
}

.service-modal-gateway-options--merged {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  margin: -1px;
  padding: 0;
  border: 0;
}

.service-modal-gateway-hint {
  margin: 0;
  padding: 0 var(--service-space-xs);
  font-size: 0.75rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.48);
}

.service-modal-gateway-content:has(.service-modal-gateway-hint:not([hidden])) {
  padding-top: var(--service-space-xs);
}

/* Payment Content Sections */
.service-modal-payment-content {
  display: flex;
  flex-direction: column;
  gap: var(--service-space-md);
}

/* Wallet Compact Design */
.service-modal-wallet-compact {
  display: flex;
  flex-direction: column;
  gap: var(--service-space-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(91, 67, 234, 0.2);
  border-radius: var(--service-radius-lg);
  padding: var(--service-space-lg);
}

.service-modal-wallet-compact-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--service-space-md);
}

.service-modal-wallet-compact-info {
  display: flex;
  align-items: center;
  gap: var(--service-space-md);
  flex: 1;
  min-width: 0;
}

.service-modal-wallet-compact-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(91, 67, 234, 0.2);
  border-radius: var(--service-radius);
  color: var(--service-modal-accent);
  flex-shrink: 0;
}

.service-modal-wallet-compact-icon svg {
  width: 20px;
  height: 20px;
}

.service-modal-wallet-compact-text {
  display: flex;
  flex-direction: column;
  gap: var(--service-space-xs);
  flex: 1;
  min-width: 0;
}

.service-modal-wallet-compact-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--service-modal-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.service-modal-wallet-compact-amount {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--service-modal-text);
  line-height: 1.2;
}

.service-modal-wallet-compact-status {
  flex-shrink: 0;
}

.service-modal-wallet-status-badge {
  padding: var(--service-space-xs) var(--service-space-sm);
  border-radius: var(--service-radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: var(--service-space-xs);
}

.service-modal-wallet-status-badge.sufficient {
  background: rgba(38, 194, 129, 0.15);
  color: var(--service-modal-success);
  border: 1px solid rgba(38, 194, 129, 0.3);
}

.service-modal-wallet-status-badge.insufficient {
  background: rgba(245, 158, 11, 0.15);
  color: var(--service-modal-warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.service-modal-wallet-badge-text {
  font-size: 0.6875rem;
}

.service-modal-wallet-compact-remaining {
  display: flex;
  align-items: center;
  gap: var(--service-space-sm);
  padding-top: var(--service-space-sm);
  margin-top: var(--service-space-sm);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.875rem;
}

.service-modal-wallet-remaining-label {
  color: var(--service-modal-text-secondary);
  font-weight: 500;
}

.service-modal-wallet-remaining-amount {
  color: var(--service-modal-accent);
  font-weight: 700;
  font-size: 1rem;
  text-align: right;
}

.service-modal-wallet-compact-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--service-space-sm);
  padding: var(--service-space-sm) var(--service-space-md);
  background: rgba(91, 67, 234, 0.04);
  border: 1px solid rgba(91, 67, 234, 0.1);
  border-radius: var(--service-radius);
  color: var(--service-modal-accent);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.875rem;
  font-weight: 600;
  width: 100%;
}

.service-modal-wallet-compact-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--active-border);
  color: var(--service-modal-accent);
  transform: translateY(-1px);
}

.service-modal-wallet-compact-btn:active {
  transform: translateY(0);
}

.service-modal-wallet-compact-btn svg {
  width: 16px;
  height: 16px;
}

/* Gateway Content Header */
.service-modal-gateway-header {
  margin-bottom: var(--service-space-xs);
}

.service-modal-gateway-title {
  margin: 0 0 var(--service-space-xs) 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--service-modal-text);
}

/* OLD STYLES REMOVED - Replaced with new structure */
/* Old wallet-section, summary-section, payment-section, and payment-option styles have been removed */
/* New styles are in: .service-modal-order-card, .service-modal-payment-card, .service-modal-wallet-compact, etc. */

/* Status Badges */
.service-modal-status-badge {
  padding: var(--service-space-xs) var(--service-space-sm);
  border-radius: var(--service-radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: var(--service-space-xs);
  position: relative;
}

.service-modal-badge-text {
  flex: 1;
}

.service-modal-quick-topup-btn {    background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 50%;
  color: var(--service-modal-warning);
  width: 18px;
  height: 18px;
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.08s 
ease;
  display: flex
;
  align-items: center;
  justify-content: center;
  line-height: 1;
  text-align: center;
  vertical-align: middle;
}


.service-modal-quick-topup-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
}


.service-modal-status-badge.sufficient {
  background: rgba(38, 194, 129, 0.15);
  color: var(--service-modal-success);
  border: 1px solid rgba(38, 194, 129, 0.2);
}

.service-modal-status-badge.available {
  background: rgba(59, 130, 246, 0.15);
  color: var(--service-modal-info);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.service-modal-status-badge.insufficient {
  background: rgba(245, 158, 11, 0.15);
  color: var(--service-modal-warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Wallet Warning */
.service-modal-wallet-warning {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--service-space-sm);
  padding: var(--service-space-sm) var(--service-space-sm);
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--service-radius-lg);
  margin-top: var(--service-space-sm);
  font-size: 0.75rem;
  color: var(--service-modal-warning);
}

.service-modal-quick-topup-warning-btn {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 50%;
  color: var(--service-modal-warning);
  width: 18px;
  height: 18px;
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.08s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  text-align: center;
  vertical-align: middle;
}

.service-modal-quick-topup-warning-btn:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: rgba(245, 158, 11, 0.5);
}

/* Form Actions - Sticky at bottom */
.service-modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: var(--service-space-sm);
  flex-shrink: 0;
  padding: var(--service-space-lg) var(--service-space-xl);
  padding-bottom: calc(var(--service-space-lg) + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  position: sticky;
  bottom: 0;
  background: var(--service-modal-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10;
  margin-top: auto;
}

/* Action buttons - Scoped to service modal only */
.service-modal .action-btn,
.service-modal-form .action-btn,
.service-modal-actions .action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--service-space-sm);
  flex: 1;
  min-width: 0;
  padding: var(--service-space-md) var(--service-space-2xl);
  border: none;
  border-radius: var(--radius);
  font-size: var(--text-sm, 0.875rem);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition, all 0.08s ease);
  min-height: 44px;
}

.service-modal .action-btn.primary,
.service-modal-form .action-btn.primary,
.service-modal-actions .action-btn.primary {
  background: rgba(91, 67, 234, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.service-modal .action-btn.primary:hover,
.service-modal-form .action-btn.primary:hover,
.service-modal-actions .action-btn.primary:hover {
  background: rgba(91, 67, 234, 0.9);
  border-color: rgba(255, 255, 255, 0.15);
}

.service-modal .action-btn.secondary,
.service-modal-form .action-btn.secondary,
.service-modal-actions .action-btn.secondary {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--service-modal-text);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.service-modal .action-btn.secondary:hover,
.service-modal-form .action-btn.secondary:hover,
.service-modal-actions .action-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

.service-modal .action-btn.disabled,
.service-modal-form .action-btn.disabled,
.service-modal-actions .action-btn.disabled {
  background: rgba(255, 255, 255, 0.02);
  color: var(--service-modal-text-secondary);
  cursor: not-allowed;
  opacity: 0.6;
  border: 1px solid var(--accent);
}

.action-btn.disabled:hover {
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--accent);
}

.action-btn svg {
  width: 16px;
  height: 16px;
}

/* Minimal Button Structure */
.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
}

.action-btn .btn-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-btn .btn-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
}

.action-btn .btn-label {
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.action-btn .btn-meta {
  font-weight: 400;
  font-size: 0.8125rem;
  line-height: 1.4;
  opacity: 0.85;
  letter-spacing: 0.01em;
}

/* Payment buttons: stack label + price (long IRT amounts stay readable) */
.action-btn.payment-gateway,
.action-btn.payment-wallet {
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
}

.action-btn .btn-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.125rem;
  min-width: 0;
  flex: 1 1 auto;
  line-height: 1.25;
  text-align: center;
}

.action-btn .btn-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.2rem 0.35rem;
  max-width: 100%;
}

.action-btn .btn-meta-price {
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: -0.02em;
  opacity: 1;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.action-btn .btn-meta-gateway {
  font-weight: 400;
  font-size: 0.6875rem;
  opacity: 0.75;
  white-space: nowrap;
  flex-shrink: 0;
}

.service-modal-actions .action-btn.primary {
  flex: 1 1 auto;
  min-width: 0;
}

.service-modal-actions .action-btn.secondary {
  flex: 0 0 auto;
  min-width: 44px;
  padding-inline: var(--service-space-md);
}

.service-modal-actions .action-btn.primary .btn-label {
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.service-modal-actions .action-btn.primary .btn-meta-gateway {
  display: block;
  margin-top: 1px;
}

@media (max-width: 768px) {
  .service-modal-actions {
    padding: var(--service-space-md) var(--service-space-lg);
    padding-bottom: calc(var(--service-space-md) + env(safe-area-inset-bottom, 0px));
    gap: var(--service-space-sm);
  }

  .service-modal-actions .action-btn.secondary .btn-cancel-text {
    display: none;
  }

  .service-modal-actions .action-btn.secondary {
    min-width: 48px;
    padding: var(--service-space-md);
  }

  .service-modal-actions .action-btn.primary {
    flex: 1 1 0;
  }

  .service-modal-field-help {
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* Payment Type Specific Icon Styles */
.action-btn.payment-wallet .btn-icon svg {
  color: rgba(255, 255, 255, 0.95);
}

.action-btn.payment-gateway .btn-icon svg {
  color: rgba(255, 255, 255, 0.95);
}

.action-btn.payment-select .btn-icon svg {
  color: rgba(255, 255, 255, 0.7);
}

.action-btn.disabled .btn-icon svg {
  color: rgba(255, 255, 255, 0.5);
}

.action-btn.disabled .btn-label {
  opacity: 0.7;
}

.action-btn.disabled .btn-meta {
  opacity: 0.6;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .action-btn {
    gap: 6px;
  }
  
  .action-btn .btn-icon {
    width: 16px;
    height: 16px;
  }
  
  .action-btn .btn-label {
    font-size: 0.8125rem;
  }
  
  .action-btn .btn-meta {
    font-size: 0.75rem;
  }

  .action-btn .btn-meta-price {
    font-size: 0.6875rem;
  }

  .action-btn.payment-gateway,
  .action-btn.payment-wallet {
    padding: 0.5rem 0.5rem;
  }
}

/* Action Button Loading State */
.action-btn.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.85;
  color: transparent;
}

.action-btn.loading .btn-icon,
.action-btn.loading .btn-label,
.action-btn.loading .btn-meta {
  opacity: 0;
}

.action-btn.loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  animation: buttonSpinner 1.2s ease-in-out infinite;
  top: 50%;
  left: 50%;
  margin-left: -9px;
  margin-top: -9px;
}

/* Hide native spin buttons */
.service-modal-group input[type="number"]::-webkit-outer-spin-button,
.service-modal-group input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.service-modal-group input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Responsive Design */
@media (min-width: 1400px) {
  .service-modal-form {
    width: min(900px, 95vw);
    max-width: 900px;
  }
  
  .service-modal-grid {
    gap: var(--service-space-3xl);
  }
}

@media (max-width: 1200px) {
  .service-modal-form {
    width: min(700px, 95vw);
    max-width: 700px;
  }
}

@media (max-width: 1024px) {
  .service-modal-grid {
    grid-template-columns: 1fr;
    gap: var(--service-space-xl);
  }
  
  .service-modal-form {
    width: min(600px, 95vw);
    max-width: 600px;
    padding: var(--service-space-xl);
  }
  
  .service-modal-fields {
    order: 1;
  }
  
  .service-modal-summary {
    order: 2;
    position: static;
  }
}

/* iPad Mini and similar devices */
@media (max-width: 820px) and (min-width: 768px) {
  .service-modal-form {
    width: min(90vw, 700px);
    max-width: 700px;
    padding: var(--service-space-lg);
  }
  
  .service-modal-grid {
    gap: var(--service-space-lg);
  }
}

/* Specific fix for iPad Mini (768px) */
@media (max-width: 768px) and (min-width: 750px) {
  .service-modal-form {
    width: min(95vw, 750px);
    max-width: 750px;
    padding: var(--service-space-md);
    margin: 0 auto;
  }
  
  .service-modal-grid {
    gap: var(--service-space-md);
  }
  
  .service-modal-fields {
    min-width: 0;
    overflow: hidden;
  }
  
  .service-modal-summary {
    min-width: 0;
    overflow: hidden;
  }
}

@media (max-width: 768px) {
  /* Mobile: no parent fade — only backdrop + sheet move (avoids overlay flash) */
  .service-modal {
    opacity: 1;
    transition: none;
  }

  .service-modal:not(.show) {
    visibility: hidden;
    pointer-events: none;
  }

  .service-modal.show {
    visibility: visible;
    pointer-events: auto;
  }

  /* Bottom sheet — closed when .show absent; slides up when .show added (one paint, then transition) */
  .service-modal-form.is-mobile-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    max-width: 100%;
    height: min(85vh, 100dvh);
    max-height: min(85vh, 100dvh);
    border-radius: var(--service-radius-lg) var(--service-radius-lg) 0 0;
    padding: 0;
    overflow-y: hidden;
    overflow-x: hidden;
    background: var(--service-modal-bg);
    transform: translate3d(0, 100%, 0);
    transition: transform 0.52s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }

  .service-modal:not(.show) .service-modal-form.is-mobile-sheet {
    transition: none;
  }

  .service-modal.show .service-modal-form.is-mobile-sheet:not(.bottom-sheet-collapsed):not(.bottom-sheet-dismissed) {
    transform: translate3d(0, 0, 0);
  }

  @media (prefers-reduced-motion: reduce) {
    .service-modal-form.is-mobile-sheet,
    .service-modal-backdrop {
      transition: none !important;
    }
    .service-modal.show .service-modal-form.is-mobile-sheet {
      transform: translate3d(0, 0, 0);
    }
  }
  
  .service-modal-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    height: 28px;
    flex-shrink: 0;
    background: transparent;
  }

  .service-modal-handle-bar {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
  }

  .service-modal-top {
    position: sticky;
    top: 0;
    z-index: 12;
    background: var(--service-modal-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--service-radius-lg) var(--service-radius-lg) 0 0;
    overflow: hidden;
    /* Single paint layer for handle + header (avoid double bg on .service-modal-header) */
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.04);
  }
  
  .service-modal-form.is-mobile-sheet.bottom-sheet-collapsed {
    transform: translate3d(0, calc(100% - 120px), 0);
  }

  .service-modal-form.is-mobile-sheet.bottom-sheet-dismissed {
    transform: translate3d(0, 100%, 0);
  }

  .service-modal-header {
    gap: var(--service-space-sm);
    position: static;
    margin-bottom: 0;
    z-index: auto;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: none;
    box-shadow: none;
    padding: var(--service-space-lg) var(--service-space-lg) var(--service-space-md);
  }

  .service-modal-header-row {
    gap: var(--service-space-md);
  }

  .service-modal-header-text {
    min-width: 0;
    flex: 1;
  }
  
  .service-modal-title {
    font-size: 1.0625rem;
  }

  .service-modal-header-subline .service-modal-subtitle {
    -webkit-line-clamp: 1;
  }

  .service-modal-header-range {
    font-size: 0.6875rem;
  }
  
  .service-modal-stock-badge {
    font-size: 0.7rem;
    padding: 3px 8px;
  }
  
  .service-modal-stock-alert {
    margin: var(--service-space-md) var(--service-space-lg);
    padding: var(--service-space-sm) var(--service-space-md);
  }
  
  .stock-alert-icon {
    width: 18px;
    height: 18px;
  }
  
  .stock-alert-title {
    font-size: 0.8125rem;
  }
  
  .stock-alert-message {
    font-size: 0.75rem;
  }
  
  .service-modal-icon svg {
    width: 20px;
    height: 20px;
  }
  
  .service-modal-title {
    font-size: 1.125rem;
  }
  
  .service-modal-subtitle {
    font-size: 0.8rem;
  }
  
  .service-modal-selected-content {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--service-space-md);
  }
  
  .service-modal-selected-info {
    gap: var(--service-space-md);
  }
  
  /* Order Summary - Mobile Layout */
  .service-modal-order-service {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--service-space-sm);
    padding-bottom: var(--service-space-sm);
  }
  
  .service-modal-order-service-label {
    font-size: 0.7rem;
    margin-bottom: 0;
  }
  
  .service-modal-order-service-name {
    font-size: 0.875rem;
    text-align: right;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  .service-modal-quantity-presets,
  .service-modal-package-presets {
    gap: var(--service-space-md);
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    padding-top: 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--service-modal-border) transparent;
    /* Align chip row with inputs/labels — no extra horizontal inset */
    padding: 8px 0 var(--service-space-xs);
    margin-left: 0;
    margin-right: 0;
    max-height: none;
    -webkit-overflow-scrolling: touch;
    scroll-padding-inline: 0 var(--service-space-sm);
  }
  
  .service-modal-quantity-presets::-webkit-scrollbar,
  .service-modal-package-presets::-webkit-scrollbar {
    height: 4px;
    width: 0;
  }
  
  .service-modal-quantity-presets::-webkit-scrollbar-track,
  .service-modal-package-presets::-webkit-scrollbar-track {
    background: transparent;
  }
  
  .service-modal-quantity-presets::-webkit-scrollbar-thumb,
  .service-modal-package-presets::-webkit-scrollbar-thumb {
    background: var(--service-modal-border);
    border-radius: 2px;
  }
  
  .service-modal-quantity-presets::-webkit-scrollbar-thumb:hover,
  .service-modal-package-presets::-webkit-scrollbar-thumb:hover {
    background: var(--service-modal-accent);
  }
  
  .service-modal-preset-btn,
  .service-modal-package-preset-btn {
    flex-shrink: 0;
    min-width: 88px;
    max-width: none;
    padding: 8px var(--service-space-lg) calc(8px + var(--service-space-xs));
    font-size: 0.7rem;
    position: relative;
    overflow: visible;
    width: fit-content;
    min-height: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--service-space-xs);
  }
  
  .service-modal-wallet-section {
    padding: var(--service-space-md);
  }
  
  .service-modal-wallet-header {
    gap: var(--service-space-sm);
  }
  
  .service-modal-wallet-main {
    gap: var(--service-space-sm);
  }
  
  .service-modal-wallet-icon-wrapper {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }
  
  .service-modal-wallet-icon {
    width: 20px;
    height: 20px;
  }
  
  .service-modal-wallet-amount {
    font-size: 1.6rem;
  }
  
  .service-modal-wallet-status {
    position: static;
    margin-left: auto;
    padding: 4px var(--service-space-xs);
  }
  
  .wallet-status-indicator {
    width: 6px;
    height: 6px;
  }
  
  .wallet-status-text {
    font-size: 0.65rem;
  }
  
  .service-modal-wallet-actions {
    margin-top: 8px;
  }
  
  .service-modal-wallet-btn {
    width: 100%;
    max-width: none;
    min-height: 44px;
    padding: 14px 18px;
  }
  
  .service-modal-payment-options {
    gap: var(--service-space-sm);
  }
  
  .service-modal-payment-option {
    padding: var(--service-space-md);
  }
  
  .service-modal-payment-content {
    gap: var(--service-space-md);
  }
  
  .service-modal-payment-icon-wrapper {
    width: 40px;
    height: 40px;
  }
  
  .service-modal-payment-icon {
    width: 20px;
    height: 20px;
  }
  
  .service-modal-header {
    padding: var(--service-space-lg) var(--service-space-xl) var(--service-space-md) var(--service-space-xl);
  }
  
  .service-modal-content {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: var(--service-space-lg) var(--service-space-xl);
  }

  .service-modal-grid {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--service-space-xl);
    min-height: auto;
    overflow: visible;
    width: 100%;
  }

  .service-modal-fields {
    flex: 0 0 auto;
    min-height: auto;
    overflow: visible;
    width: 100%;
  }

  .service-modal-summary {
    position: static;
    flex: 0 0 auto;
    min-height: auto;
    overflow: hidden;
    width: 100%;
  }

  .service-modal-actions {
    position: relative;
    bottom: auto;
    flex-shrink: 0;
    margin-top: 0;
  }
}

@media (max-width: 480px) {
  .service-modal-form {
    width: 100%;
    max-width: 100%;
   }
  
  .service-modal-header {
    gap: var(--service-space-sm);
  }
  
  .service-modal-header-content {
    gap: var(--service-space-sm);
  }
  

  
  .service-modal-icon svg {
    width: 18px;
    height: 18px;
  }
  
  .service-modal-title {
    font-size: 1rem;
  }
  
  .service-modal-subtitle {
    font-size: 0.75rem;
  }
  
  .service-modal-paste-btn {
    width: 24px;
    height: 24px;
    right: 36px;
  }
  
  .service-modal-paste-btn svg {
    width: 12px;
    height: 12px;
  }
  
  .service-modal-input-clear input {
    padding-right: 70px;
  }
  
  .service-modal-quantity-presets,
  .service-modal-package-presets {
    gap: var(--service-space-sm);
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: thin;
    scrollbar-color: var(--service-modal-border) transparent;
    padding: 6px 0 3px;
    max-height: none;
    -webkit-overflow-scrolling: touch;
    scroll-padding-inline: 0 var(--service-space-sm);
  }
  
  .service-modal-quantity-presets::-webkit-scrollbar,
  .service-modal-package-presets::-webkit-scrollbar {
    height: 3px;
    width: 0;
  }
  
  .service-modal-quantity-presets::-webkit-scrollbar-track,
  .service-modal-package-presets::-webkit-scrollbar-track {
    background: transparent;
  }
  
  .service-modal-quantity-presets::-webkit-scrollbar-thumb,
  .service-modal-package-presets::-webkit-scrollbar-thumb {
    background: var(--service-modal-border);
    border-radius: 2px;
  }
  
  .service-modal-quantity-presets::-webkit-scrollbar-thumb:hover,
  .service-modal-package-presets::-webkit-scrollbar-thumb:hover {
    background: var(--service-modal-accent);
  }
  
  .service-modal-preset-btn,
  .service-modal-package-preset-btn {
    flex-shrink: 0;
    min-width: 80px;
    max-width: none;
    padding: 7px var(--service-space-md) calc(7px + var(--service-space-xs));
    font-size: 0.65rem;
    position: relative;
    overflow: visible;
    width: fit-content;
    min-height: 42px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--service-space-xs);
  }
  
  .service-modal-wallet-status {
    gap: 4px;
  }
  
  .wallet-status-indicator {
    width: 5px;
    height: 5px;
  }
  
  .wallet-status-text {
    font-size: 0.6rem;
  }
  
  .preset-value {
    font-size: 0.7rem;
    font-weight: 600;
  }
  
  .preset-label {
    font-size: 0.6rem;
    opacity: 0.8;
    line-height: 1.25;
  }
  
  /* Responsive discount price styling for mobile */
  .preset-price {
    gap: 4px;
    font-size: 0.65rem;
  }
  
  .preset-price .original-price {
    font-size: 0.6rem;
  }
  
  .preset-price .discount-price {
    font-size: 0.65rem;
  }
}

/* Payment Gateway Selection Styles */
.service-modal-gateway-selection {
  margin-top: var(--service-space-lg);
  padding: var(--service-space-lg);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(91, 67, 234, 0.2);
  border-radius: var(--service-radius-lg);
}


.service-modal-gateway-header {
  margin-bottom: var(--service-space-lg);
  text-align: center;
}

.service-modal-gateway-title {
  margin: 0 0 var(--service-space-sm) 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--service-modal-text);
}

.service-modal-gateway-subtitle {
  margin: 0;
  font-size: 0.875rem;
  color: var(--service-modal-text-secondary);
  opacity: 0.8;
}

.service-modal-gateway-options {
  display: flex;
  flex-direction: column;
  gap: var(--service-space-sm);
  margin-bottom: var(--service-space-lg);
}

.service-modal-gateway-option {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: var(--service-space-md);
  border-radius: var(--service-radius-lg);
  transition: all 0.2s ease;
  border: 1px solid rgba(91, 67, 234, 0.2);
  background: rgba(255, 255, 255, 0.02);
  position: relative;
}

.service-modal-gateway-option:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--active-border);
}

.service-modal-gateway-option input[type="radio"] {
  display: none;
}

.service-modal-gateway-option:has(input[type="radio"]:checked) {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--active-border);
}

.service-modal-gateway-content {
  display: flex;
  align-items: center;
  gap: var(--service-space-md);
  width: 100%;
  color: var(--service-modal-text);
}

.service-modal-gateway-icon {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(91, 67, 234, 0.2);
  border-radius: var(--service-radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.service-modal-gateway-option:has(input[type="radio"]:checked) .service-modal-gateway-icon {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--active-border);
}

.service-modal-gateway-icon svg {
  width: 20px;
  height: 20px;
  color: var(--service-modal-text-secondary);
  transition: all 0.08s ease;
}

.service-modal-gateway-option:has(input[type="radio"]:checked) .service-modal-gateway-icon svg {
  color: var(--service-modal-accent);
}

/* Icon via IconRenderer (category-icon-wrap structure) */
.service-modal-gateway-icon .category-icon-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.service-modal-gateway-icon .category-icon-tinted {
  position: absolute;
  inset: 0;
  background: var(--service-modal-text-secondary);
  -webkit-mask-image: var(--icon-url);
  mask-image: var(--icon-url);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  transition: all 0.08s ease;
}

.service-modal-gateway-option:has(input[type="radio"]:checked) .service-modal-gateway-icon .category-icon-tinted {
  background: var(--service-modal-accent);
}

.service-modal-gateway-icon .category-icon-css-fallback {
  font-size: 20px;
  color: var(--service-modal-text-secondary);
  display: none;
}

.service-modal-gateway-icon .category-icon-css-fallback[style*="inline"] {
  display: inline-flex;
}

.service-modal-gateway-option:has(input[type="radio"]:checked) .service-modal-gateway-icon .category-icon-css-fallback {
  color: var(--service-modal-accent);
}

.service-modal-gateway-icon .gateway-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--service-radius-sm);
}

.service-modal-gateway-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--service-radius-sm);
}

.service-modal-gateway-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.service-modal-gateway-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--service-modal-text);
}

.service-modal-gateway-desc {
  font-size: 0.75rem;
  color: var(--service-modal-text-secondary);
  opacity: 0.8;
}

.tab-badge {
  margin-inline-start: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1.15;
  font-weight: 500;
  border: 0;
  white-space: nowrap;
}

.tab-badge.tab-badge--lowfee {
  color: var(--service-modal-success);
  background: rgba(38, 194, 129, 0.10);
  box-shadow: inset 0 0 0 1px rgba(38, 194, 129, 0.25);
}

.tab-badge.tab-badge--suggested {
  color: var(--service-modal-primary, #5b43ea);
  background: rgba(91, 67, 234, 0.10);
  box-shadow: inset 0 0 0 1px rgba(91, 67, 234, 0.22);
}

.service-modal-gateway-status {
  display: flex;
  align-items: center;
  margin-left: var(--service-space-sm);
  flex-shrink: 0;
}

.service-modal-gateway-badge {
  padding: var(--service-space-xs) var(--service-space-sm);
  border-radius: var(--service-radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: var(--service-space-xs);
}

.service-modal-gateway-badge.available {
  background: rgba(38, 194, 129, 0.15);
  color: var(--service-modal-success);
  border: 1px solid rgba(38, 194, 129, 0.2);
}

.service-modal-gateway-badge.unavailable {
  background: rgba(245, 158, 11, 0.15);
  color: var(--service-modal-warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.service-modal-gateway-actions {
  display: flex;
  justify-content: center;
  padding-top: var(--service-space-md);
  border-top: 1px solid var(--service-modal-border);
}

.service-modal-gateway-back-btn {
  display: flex;
  align-items: center;
  gap: var(--service-space-sm);
  padding: var(--service-space-sm) var(--service-space-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(91, 67, 234, 0.2);
  border-radius: var(--service-radius-lg);
  color: var(--service-modal-text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.875rem;
  font-weight: 500;
}

.service-modal-gateway-back-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--active-border);
  color: var(--service-modal-text);
}

.service-modal-gateway-back-btn svg {
  width: 16px;
  height: 16px;
}

/* Mobile responsive for gateway selection */
@media (max-width: 768px) {
  .service-modal-gateway-selection {
    padding: var(--service-space-md);
  }
  
  .service-modal-gateway-options {
    gap: var(--service-space-xs);
  }
  
  .service-modal-gateway-option {
    padding: var(--service-space-sm);
  }
  
  .service-modal-gateway-content {
    gap: var(--service-space-sm);
  }
  
  .service-modal-gateway-icon {
    width: 36px;
    height: 36px;
  }
  
  .service-modal-gateway-icon svg {
    width: 18px;
    height: 18px;
  }
  
  .service-modal-gateway-icon .gateway-logo,
  .service-modal-gateway-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
  
  .service-modal-gateway-name {
    font-size: 0.8rem;
  }
  
  .service-modal-gateway-desc {
    font-size: 0.7rem;
  }
  
  .service-modal-gateway-back-btn {
    width: 100%;
    justify-content: center;
  }
}

/* Desktop specific adjustments */
@media (min-width: 1024px) {
  .service-modal-preset-btn {
    min-width: 70px;
    max-width: 90px;
    padding: var(--service-space-sm) var(--service-space-lg) calc(var(--service-space-sm) + 3px);
    font-size: 0.8rem;
  }
  
  .preset-value {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
  }
  
  .preset-label {
    font-size: 0.7rem;
    opacity: 0.8;
    line-height: 1.25;
  }
  
  .service-modal-wallet-actions {
    flex-direction: row;
    gap: var(--service-space-sm);
  }
  
  .service-modal-wallet-btn {
    flex: 1;
    width: 50%;
    justify-content: center;
  }
  
  .service-modal-payment-option {
    padding: var(--service-space-sm);
  }
  
  .service-modal-payment-content {
    gap: var(--service-space-sm);
  }
  
  .service-modal-payment-icon-wrapper {
    width: 36px;
    height: 36px;
  }
  
  .service-modal-payment-icon {
    width: 18px;
    height: 18px;
  }
  
  .service-modal-gateway-options {
    gap: var(--service-space-sm);
  }
  
  .service-modal-gateway-option {
    padding: var(--service-space-sm);
  }
  
  .service-modal-gateway-content {
    gap: var(--service-space-sm);
  }
}


/* Discount Badge for Preset Buttons */
.service-modal-preset-btn .discount-badge {
  position: absolute;
  top: -6px;
  right: 2px;
  background: #ff8419;
  color: white;
  font-size: 0.6rem;
  font-weight: 600;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  box-shadow: 0 2px 4px rgba(38, 194, 129, 0.3);
}

.service-modal-package-preset-btn .discount-badge {
  position: absolute;
  top: -6px;
  right: 2px;
  background: #ff8419;
  color: white;
  font-size: 0.6rem;
  font-weight: 600;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  box-shadow: 0 2px 4px rgba(38, 194, 129, 0.3);
  z-index: 10;
}

/* Discount Price Display */
.service-modal-inline-price.has-discount .inline-price-value {
  display: flex;
  align-items: center;
  gap: 4px;
}

.discount-price-original {
  text-decoration: line-through;
  color: var(--service-modal-text-secondary);
  font-size: 0.8em;
  opacity: 0.7;
}

.discount-percentage {
  color: #ff8419;
  font-weight: 500;
  font-size: 0.8em;
}

/* Mobile discount badge adjustments */
@media (max-width: 768px) {
  .service-modal-preset-btn .discount-badge,
  .service-modal-package-preset-btn .discount-badge {
    right: -2px;
    z-index: 10;
  }
}

@media (max-width: 480px) {
  .service-modal-preset-btn .discount-badge,
  .service-modal-package-preset-btn .discount-badge {
    font-size: 0.45rem;
    top: -3px;
    right: -1px;
    z-index: 10;
  }
}

/* Custom quantity panel — collapsed until «مقدار دلخواه» chip (hybrid) */
.service-modal-custom-amount {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.28s ease, opacity 0.2s ease, margin 0.2s ease, padding 0.2s ease;
}

.service-modal-custom-amount.is-open {
  margin-top: var(--service-space-md);
  padding-top: var(--service-space-md);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  max-height: 320px;
  opacity: 1;
}

.service-modal-group.is-custom-quantity-open .service-modal-custom-amount.is-open {
  max-height: 420px;
}

.service-modal-custom-amount.is-collapsed:not(.is-open) {
  visibility: hidden;
}

/* آخرین chip — مقدار دلخواه */
.service-modal-preset-btn--custom {
  border-style: dashed;
  border-color: rgba(91, 67, 234, 0.35);
  background: rgba(91, 67, 234, 0.04);
  color: var(--service-modal-text-secondary);
}

.service-modal-preset-btn--custom:hover {
  border-color: var(--active-border, var(--service-modal-accent));
  background: rgba(91, 67, 234, 0.1);
  color: var(--service-modal-text);
}

.service-modal-preset-btn--custom.active {
  border-style: solid;
  border-color: var(--active-border, var(--service-modal-accent));
  background: rgba(91, 67, 234, 0.12);
  color: var(--service-modal-accent);
}

.service-modal-preset-btn--custom .preset-value--custom {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.service-modal-preset-btn--custom .preset-value--custom svg {
  width: 14px;
  height: 14px;
  opacity: 0.9;
}

.service-modal-preset-btn--custom .preset-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  line-height: 1.2;
}

.service-modal-preset-btn--custom .preset-range-hint {
  display: block;
  font-size: 0.58rem;
  font-weight: 400;
  opacity: 0.55;
  font-variant-numeric: tabular-nums;
}

.service-modal-custom-amount-title {
  margin-bottom: var(--service-space-md);
}

.custom-amount-label {
  font-size: 0.8rem;
  color: var(--service-modal-text-secondary);
  font-weight: 500;
  opacity: 0.8;
}

/* Collapsible Slider */
.service-modal-quantity-slider {
  transition: all 0.3s ease;
  overflow: hidden;
}

.service-modal-quantity-slider.collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
}

.service-modal-quantity-slider.expanded {
  max-height: 100px;
  opacity: 1;
  margin-top: var(--service-space-md);
}

/* Inline Estimated Price */
.service-modal-inline-price {
  display: flex;
  align-items: center;
  gap: var(--service-space-sm);
  margin-top: var(--service-space-sm);
  padding: var(--service-space-sm) var(--service-space-md);
  border-radius: var(--service-radius-lg);
  background: rgba(91, 67, 234, 0.08);
  border: 1px solid rgba(91, 67, 234, 0.15);
  color: var(--service-modal-text);
  font-size: 0.875rem;
  transition: all 0.15s ease;
}

.service-modal-inline-price:hover {
  background: rgba(91, 67, 234, 0.12);
  border-color: rgba(91, 67, 234, 0.25);
}

.service-modal-inline-price .inline-price-icon {
  width: 16px;
  height: 16px;
  color: var(--service-modal-accent);
  opacity: 0.9;
}

.service-modal-inline-price .inline-price-label {
  font-size: 0.8rem;
  color: var(--service-modal-text-secondary);
  font-weight: 500;
}

.service-modal-inline-price .inline-price-value {
  margin-inline-start: auto;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--service-modal-accent);
  transition: all 0.3s ease;
}

/* Price typing animation */
.service-modal-inline-price.updating .inline-price-value {
  animation: priceTyping 1.2s ease-out;
}

.service-modal-inline-price.updating .inline-price-icon {
  animation: priceIconBounce 1.2s ease-out;
}

/* Typing effect animation */
@keyframes priceTyping {
  0% {
    opacity: 0;
    transform: translateX(-10px);
  }
  20% {
    opacity: 0.3;
    transform: translateX(-5px);
  }
  40% {
    opacity: 0.6;
    transform: translateX(0);
  }
  60% {
    opacity: 0.8;
    transform: translateX(2px);
  }
  80% {
    opacity: 0.9;
    transform: translateX(0);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Icon bounce animation */
@keyframes priceIconBounce {
  0% {
    transform: translateY(0) scale(1);
    color: var(--service-modal-accent);
  }
  25% {
    transform: translateY(-3px) scale(1.1);
    color: var(--service-modal-success);
  }
  50% {
    transform: translateY(0) scale(1);
    color: var(--service-modal-warning);
  }
  75% {
    transform: translateY(-2px) scale(1.05);
    color: var(--service-modal-success);
  }
  100% {
    transform: translateY(0) scale(1);
    color: var(--service-modal-accent);
  }
}

/* Container shimmer effect */
.service-modal-inline-price.updating {
  position: relative;
  overflow: hidden;
}

.service-modal-inline-price.updating::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: shimmer 1.2s ease-out;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Service Modal Loading State */
.service-modal.loading .service-modal-content {
  position: relative;
  min-height: 300px;
}
 .service-modal.loading .service-modal-header-row,
 .service-modal.loading .service-modal-header-content,
 .service-modal.loading .service-modal-header-right,
 .service-modal.loading .service-modal-icon {
   visibility: hidden;
 }

.service-modal-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--service-space-lg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  border-radius: var(--service-radius-lg);
}

.service-modal-loader-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(91, 67, 234, 0.2);
  border-top-color: var(--service-modal-accent);
  border-radius: 50%;
  animation: serviceModalSpinner 1.5s ease-in-out infinite;
}

.service-modal-loader-text {
  color: var(--service-modal-text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0.9;
}

@keyframes serviceModalSpinner {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Button Loading State */
.order-btn.loading,
.mobile-cta-btn.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.8;
}

.order-btn.loading::after,
.mobile-cta-btn.loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  animation: buttonSpinner 1.2s ease-in-out infinite;
  top: 50%;
  left: 50%;
  margin-left: -9px;
  margin-top: -9px;
}

.order-btn.loading svg,
.mobile-cta-btn.loading svg {
  opacity: 0;
}

@keyframes buttonSpinner {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* === SMM Custom Inputs (Custom Comments / Mentions / Subscriptions) === */
.service-modal-comments-list-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin: 6px 0 8px;
}

.service-modal-comments-list-toolbar::before {
  content: attr(data-prefix);
  font-size: 12px;
  color: var(--service-modal-text-secondary, #6b7280);
  font-weight: 500;
}

.service-modal-comments-counter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--service-modal-text-secondary, #6b7280);
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--service-modal-border, rgba(0, 0, 0, 0.08));
  padding: 4px 12px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  margin-inline-start: auto;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.service-modal-comments-counter.is-mismatch {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.10);
  border-color: rgba(220, 38, 38, 0.30);
}

.service-modal-comments-counter.is-match {
  color: #16a34a;
  background: rgba(22, 163, 74, 0.10);
  border-color: rgba(22, 163, 74, 0.30);
}

.service-modal-comments-counter.is-match::after {
  content: "✓";
  font-size: 11px;
  font-weight: 700;
}

#serviceModalCommentsList,
#serviceModalUsernamesList,
#serviceModalHashtagsList {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  padding: 12px 14px;
  border: 1px solid var(--service-modal-border, rgba(0, 0, 0, 0.12));
  border-radius: 10px;
  background: var(--service-modal-bg, #fff);
  color: var(--service-modal-text, inherit);
  resize: vertical;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

#serviceModalCommentsList:focus,
#serviceModalUsernamesList:focus,
#serviceModalHashtagsList:focus {
  outline: none;
  border-color: var(--service-modal-accent, #6366f1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

#serviceModalCommentsListGroup .service-modal-validation {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 8px;
  line-height: 1.4;
}

#serviceModalUsernamesListGroup .service-modal-validation {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 8px;
  line-height: 1.4;
}

#serviceModalHashtagsListGroup .service-modal-validation {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 8px;
  line-height: 1.4;
}

#serviceModalCommentsListGroup .service-modal-validation.warn {
  background: rgba(234, 179, 8, 0.10);
  border: 1px solid rgba(234, 179, 8, 0.30);
  color: #a16207;
}

#serviceModalUsernamesListGroup .service-modal-validation.warn {
  background: rgba(234, 179, 8, 0.10);
  border: 1px solid rgba(234, 179, 8, 0.30);
  color: #a16207;
}

#serviceModalCommentsListGroup .service-modal-validation.error {
  background: rgba(220, 38, 38, 0.10);
  border: 1px solid rgba(220, 38, 38, 0.30);
  color: #b91c1c;
}

#serviceModalUsernamesListGroup .service-modal-validation.error {
  background: rgba(220, 38, 38, 0.10);
  border: 1px solid rgba(220, 38, 38, 0.30);
  color: #b91c1c;
}

#serviceModalHashtagsListGroup .service-modal-validation.warn {
  background: rgba(234, 179, 8, 0.10);
  border: 1px solid rgba(234, 179, 8, 0.30);
  color: #a16207;
}

#serviceModalHashtagsListGroup .service-modal-validation.error {
  background: rgba(220, 38, 38, 0.10);
  border: 1px solid rgba(220, 38, 38, 0.30);
  color: #b91c1c;
}

[dir="rtl"] #serviceModalCommentsListHelp,
[lang="fa"] #serviceModalCommentsListHelp {
  text-align: right;
}

[dir="rtl"] #serviceModalUsernamesListHelp,
[lang="fa"] #serviceModalUsernamesListHelp {
  text-align: right;
}

[dir="rtl"] #serviceModalHashtagsListHelp,
[lang="fa"] #serviceModalHashtagsListHelp {
  text-align: right;
}

[dir="rtl"] #serviceModalMediaUrlHelp,
[lang="fa"] #serviceModalMediaUrlHelp {
  text-align: right;
}

[dir="rtl"] #serviceModalAnswerNumberHelp,
[lang="fa"] #serviceModalAnswerNumberHelp {
  text-align: right;
}

.service-modal-sub-minmax-auto {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}
.service-modal-sub-minmax-auto-value {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--service-modal-text, #fff);
}
.service-modal-sub-minmax-auto-hint {
    font-size: 0.8rem;
    color: var(--service-modal-text-muted, rgba(255, 255, 255, 0.55));
    line-height: 1.4;
}

.service-modal-min-max-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.service-modal-min-max-row input {
  flex: 1;
  min-width: 0;
}

.service-modal-min-max-sep {
  color: var(--service-modal-text-secondary, #6b7280);
  font-weight: 600;
}
