/* ============================================================
   DIPON STUDIO NEXT-GEN — Modals, Toasts & Overlays
   ============================================================ */

/* Toast Container */
.toast-wrap {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  background: rgba(16, 18, 26, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: auto;
}

.toast.toast-success {
  border-color: rgba(16, 185, 129, 0.4);
  color: #a7f3d0;
}

.toast.toast-error {
  border-color: rgba(244, 63, 94, 0.4);
  color: #fecdd3;
}

.toast.toast-warning {
  border-color: rgba(245, 158, 11, 0.5);
  color: #fcd34d;
}

.toast.toast-info {
  border-color: rgba(212, 169, 106, 0.4);
  color: #fde68a;
}

.toast.fade-out {
  opacity: 0;
  transform: translateY(8px);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Modal Backdrop */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 5, 8, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalScaleIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalScaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
}

.modal-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: transparent;
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  padding: 4px;
  border-radius: var(--radius-xs);
  transition: color 0.15s;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 70vh;
  overflow-y: auto;
}

/* Shortcuts List */
.shortcuts-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shortcut-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.76rem;
}

.shortcut-desc {
  color: var(--text-secondary);
}

.kbd-group {
  display: flex;
  gap: 4px;
}

.kbd {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  padding: 2px 6px;
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* ============================================================
   Cashier Billing Modal Styles
   ============================================================ */
.modal-box.modal-lg {
  max-width: 620px;
}

.billing-tabs {
  display: flex;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 4px;
}

.billing-tab {
  flex: 1;
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.billing-tab.active {
  background: var(--bg-surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.billing-table-wrap {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(15, 23, 42, 0.4);
}

.billing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.billing-table th {
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  font-weight: 600;
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.billing-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

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

.billing-table .num-cell {
  text-align: right;
  font-family: var(--font-mono);
}

.qty-pill {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.7rem;
}

.unit-price-inp {
  width: 80px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 3px 6px;
  text-align: right;
}

.unit-price-inp:focus {
  border-color: var(--accent);
  outline: none;
}

.billing-calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.billing-field-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.billing-field-lbl {
  font-size: 0.68rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.billing-inp-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  padding: 4px 8px;
  gap: 6px;
}

.billing-inp-wrap span {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.billing-inp-wrap input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 600;
  outline: none;
}

.change-amount {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 800;
  color: #10b981;
}

.billing-grand-total-card {
  background: linear-gradient(135deg, rgba(212, 169, 106, 0.12) 0%, rgba(15, 23, 42, 0.8) 100%);
  border: 1px solid rgba(212, 169, 106, 0.4);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.grand-total-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.grand-total-lbl {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.grand-total-sub {
  font-size: 0.66rem;
  color: var(--text-muted);
}

.grand-total-val {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  text-shadow: 0 0 16px rgba(212, 169, 106, 0.3);
}

.billing-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-top: 4px;
}

.btn-whatsapp-send {
  background: #128c7e;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(18, 140, 126, 0.35);
  transition: all 0.15s ease;
}

.btn-whatsapp-send:hover {
  background: #25d366;
  color: #0b0f19;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.45);
  transform: translateY(-1px);
}

.btn-copy-slip {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.78rem;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-copy-slip:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-subtle);
  transform: translateY(-1px);
}

/* ============================================================
   AI Studio Modal Styles (Background, Suits, Enhancer)
   ============================================================ */
.modal-box.modal-xl {
  max-width: 880px;
  width: 95%;
}

.ai-studio-body {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  padding: 16px 20px;
  max-height: 78vh;
  overflow: hidden;
}

@media (max-width: 768px) {
  .ai-studio-body {
    grid-template-columns: 1fr;
    max-height: 85vh;
    overflow-y: auto;
  }
}

.ai-controls-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding-right: 6px;
  max-height: 68vh;
}

.ai-tabs-nav {
  display: flex;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}

.ai-tab-btn {
  flex: 1;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  text-align: center;
}

.ai-tab-btn.act {
  background: var(--bg-surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.ai-section-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-sec-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

/* Background Chips */
.bg-chips-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bg-preset-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-left: 3.5px solid #d32f2f;
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.bg-preset-chip:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(2px);
}

.bg-preset-chip.selected {
  background: rgba(212, 169, 106, 0.1);
  border-color: var(--accent);
  border-left-width: 4px;
}

.chip-color-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.chip-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.chip-info b {
  font-size: 0.74rem;
  color: var(--text-primary);
}

.chip-info small {
  font-size: 0.62rem;
  color: var(--text-muted);
}

.custom-color-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.input-with-color {
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-with-color input[type="color"] {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-xs);
  cursor: pointer;
  background: transparent;
}

.input-with-color input[type="text"] {
  width: 75px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  padding: 3px 6px;
  font-size: 0.72rem;
  color: var(--text-primary);
}

/* Suit Catalog Grid */
.suit-catalog-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}

.suit-item-card {
  background: var(--bg-surface-elevated);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.suit-item-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-light);
  transform: translateY(-1px);
}

.suit-item-card.selected {
  border-color: var(--accent);
  background: rgba(212, 169, 106, 0.12);
  box-shadow: 0 0 10px rgba(212, 169, 106, 0.25);
}

.suit-thumb-box {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.suit-thumb-box svg {
  width: 100%;
  height: 100%;
}

.suit-name {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.suit-desc {
  font-size: 0.58rem;
  color: var(--text-muted);
  line-height: 1.2;
}

/* Sliders */
.ai-slider-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-secondary);
}

.slider-label b {
  font-family: var(--font-mono);
  color: var(--accent);
}

.range-slider {
  width: 100%;
  accent-color: var(--accent);
  height: 4px;
  border-radius: 999px;
  cursor: pointer;
}

/* Action Buttons */
.btn-ai-exec {
  background: linear-gradient(135deg, #d4a96a 0%, #b8860b 100%);
  color: #0b0f19;
  font-weight: 700;
  font-size: 0.76rem;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-ai-exec:hover {
  background: linear-gradient(135deg, #e5be82 0%, #d4a96a 100%);
  transform: translateY(-1px);
}

.btn-gemini-exec {
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.76rem;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-gemini-exec:hover {
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.4);
  transform: translateY(-1px);
}

.gemini-feedback-card {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-top: 8px;
}

/* Preview Stage */
.ai-preview-col {
  display: flex;
  flex-direction: column;
}

.preview-stage-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.6);
  border-bottom: 1px solid var(--border-subtle);
}

.preview-tag {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.06em;
}

.preview-item-info {
  font-size: 0.68rem;
  color: var(--text-secondary);
}

.preview-canvas-container {
  flex: 1;
  min-height: 380px;
  max-height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-conic-gradient(#1e293b 0% 25%, #0f172a 0% 50%) 50% / 16px 16px;
  position: relative;
  overflow: hidden;
  padding: 16px;
}

.preview-stage-content {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
}

.preview-image-elem {
  max-width: 100%;
  max-height: 380px;
  object-fit: contain;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  display: block;
}

.suit-live-overlay,
.suit-vector-wrap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  border-radius: 4px;
  z-index: 5;
}

.suit-live-overlay svg,
.suit-vector-wrap svg {
  position: absolute;
  left: 50%;
  transform-origin: top center;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.5));
  display: block;
  transition: transform 0.04s ease-out, top 0.04s ease-out;
}

.badge-offline-studio {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.mode-badge-free {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  font-size: 0.64rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

.mode-badge-opt {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  font-size: 0.64rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

.btn-demo-portrait {
  background: rgba(212, 169, 106, 0.15);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-weight: 600;
  transition: all 0.15s;
}

.btn-demo-portrait:hover {
  background: var(--accent);
  color: #0b0f19;
  transform: translateY(-1px);
}

.preview-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  color: var(--text-muted);
}

.preview-empty-state b {
  font-size: 0.86rem;
  color: var(--text-primary);
}

.preview-empty-state p {
  font-size: 0.7rem;
  max-width: 240px;
  line-height: 1.35;
}

.ai-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 15, 25, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-primary);
  font-size: 0.76rem;
  font-weight: 600;
  z-index: 10;
}

.ai-spinner-circle {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(212, 169, 106, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.preview-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
}

.btn-apply-ai {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
  transition: all 0.15s ease;
}

.btn-apply-ai:hover {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  transform: translateY(-1px);
}


