/* =========================================================
   QR SETTINGS
   Локальные стили для:
   1) блока QR-settings.html
   2) AI-модалки стилизации QR
========================================================= */

/* =========================================================
   LOCAL TOKENS
========================================================= */

:root {
  --qr-accent: #7c5cff;
  --qr-accent-2: #4cc9ff;
  --qr-success: #19d28a;
  --qr-warning: #ffb020;

  --qr-panel-bg: rgba(15, 20, 31, 0.92);
  --qr-panel-bg-soft: rgba(255, 255, 255, 0.03);
  --qr-border: rgba(255, 255, 255, 0.08);

  --qr-text: #eef3ff;
  --qr-text-soft: #b8c4da;
  --qr-text-muted: #93a4bc;

  --ai-bg: #090b10;
  --ai-bg-2: #0b0e13;
  --ai-surface: rgba(255, 255, 255, 0.03);
  --ai-surface-2: rgba(255, 255, 255, 0.05);
  --ai-border: rgba(255, 255, 255, 0.08);

  --ai-text: #eaf1fb;
  --ai-text-soft: #dfe8f5;
  --ai-text-muted: #9aa9be;

  --ai-shadow: 0 18px 60px rgba(0, 0, 0, 0.38);
}

/* =========================================================
   OPTION TILES
========================================================= */

.dot-option,
.corner-option,
.cornerDot-option,
.errorLevel-option {
  width: 84px;
  min-width: 84px;
  max-width: 84px;
  box-sizing: border-box;

  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;

  text-align: center;
  position: relative;
  margin: 2px;
  padding: 6px;

  cursor: pointer;
  user-select: none;

  border: 2px solid transparent;
  border-radius: 12px;

  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.dot-option:hover,
.corner-option:hover,
.cornerDot-option:hover,
.errorLevel-option:hover {
  border-color: rgba(124, 92, 255, 0.55);
  background: rgba(124, 92, 255, 0.07);
  transform: translateY(-1px);
}

.qr-opt-active {
  border-color: rgba(124, 92, 255, 0.95) !important;
  background: rgba(124, 92, 255, 0.10) !important;
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.12);
}

/* =========================================================
   PREVIEW TILES
========================================================= */

.dot-img-wrapper {
  width: 68px;
  height: 68px;
  box-sizing: border-box;

  overflow: hidden;
  position: relative;
  z-index: 1;

  background: #ffffff;
  border-radius: 10px;
  padding: 4px;

  display: flex;
  align-items: center;
  justify-content: center;

  margin: 0 auto;
}

.dot-img-wrapper img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  transform: scale(3);
  transform-origin: center;
}

.eye-shape {
  margin-top: 1px;
}

.caption {
  position: relative;
  z-index: 2;
  font-size: 12px;
  line-height: 1.2;
  color: var(--qr-text-soft);
  margin-top: 6px;
  text-align: center;
  word-break: break-word;
}

/* =========================================================
   QR PREVIEW BLOCK
========================================================= */

#qr-bg-wrapper {
  width: 100%;
  max-width: 500px;
  margin: auto;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

#qr-preview {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  overflow: hidden;
  position: relative;
}

#qr-preview > svg,
#qr-preview > canvas,
#qr-preview > img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 18px;
}

/* =========================================================
   EXPORT PANEL
========================================================= */

.qr-export-panel {
  max-width: 380px;
  margin: 15px auto 0;
  gap: 8px !important;
}

.qr-export-panel .btn {
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 10px;
  line-height: 1.15;
  letter-spacing: 0.15px;
}

.qr-export-panel .btn.btn-sm {
  padding: 6px 10px;
}

.btn-qr-primary {
  background: linear-gradient(135deg, #7b5cff, #5d3df3) !important;
  border: none !important;
  color: #fff !important;
}

.btn-qr-primary:hover {
  background: linear-gradient(135deg, #8c72ff, #6a4df5) !important;
  box-shadow: 0 3px 10px rgba(120, 90, 255, 0.28);
}

.btn-qr-success {
  border: 1px solid #19d28a !important;
  color: #19d28a !important;
  background: transparent !important;
}

.btn-qr-success:hover {
  background: #19d28a !important;
  color: #000 !important;
}

.btn-qr-warning {
  border: 1px solid #ffb020 !important;
  color: #ffb020 !important;
  background: transparent !important;
}

.btn-qr-warning:hover {
  background: #ffb020 !important;
  color: #000 !important;
}

.qr-export-panel .input-group-text,
.qr-export-panel .form-select {
  font-size: 12.5px;
  padding-top: 5px;
  padding-bottom: 5px;
}

/* =========================================================
   TOAST
========================================================= */

#saveToast {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

/* =========================================================
   AI BUTTON
========================================================= */

#ai-style-setting.btn-ai-style {
  position: relative;
  isolation: isolate;
  overflow: hidden;

  min-height: 58px;
  padding: 11px 14px 11px 14px;
  border-radius: 12px !important;
  border: 1px solid rgba(126, 211, 255, 0.24) !important;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  color: #ffffff !important;
  text-align: left;

  background:
    linear-gradient(135deg, rgba(11, 18, 34, 0.96) 0%, rgba(21, 30, 56, 0.98) 42%, rgba(44, 20, 88, 0.98) 100%) !important;

  box-shadow:
    0 10px 24px rgba(11, 19, 41, 0.42),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    inset 0 1px 0 rgba(255, 255, 255, 0.06);

  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    border-color 0.22s ease,
    background 0.22s ease,
    filter 0.22s ease;
}

#ai-style-setting.btn-ai-style::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  border-radius: inherit;
  background:
    radial-gradient(circle at 14% 50%, rgba(76, 201, 255, 0.22), transparent 28%),
    radial-gradient(circle at 82% 25%, rgba(124, 92, 255, 0.22), transparent 30%),
    radial-gradient(circle at 65% 80%, rgba(170, 80, 255, 0.14), transparent 34%);
  opacity: 1;
}

#ai-style-setting.btn-ai-style::after {
  content: "";
  position: absolute;
  top: 0;
  left: -30%;
  width: 24%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  transform: skewX(-20deg);

  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.14) 50%,
    rgba(255, 255, 255, 0) 100%
  );

  animation: aiSmartShine 4.6s ease-in-out infinite;
}

#ai-style-setting.btn-ai-style:hover {
  transform: translateY(-2px);
  border-color: rgba(142, 220, 255, 0.42) !important;
  filter: saturate(1.08);

  box-shadow:
    0 16px 34px rgba(21, 30, 56, 0.52),
    0 0 18px rgba(89, 130, 255, 0.12),
    0 0 26px rgba(128, 67, 255, 0.10),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

#ai-style-setting.btn-ai-style:active {
  transform: translateY(0) scale(0.992);
}

#ai-style-setting.btn-ai-style:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 0.18rem rgba(76, 201, 255, 0.14),
    0 14px 30px rgba(17, 29, 59, 0.44);
}

/* Левая часть с иконкой */
#ai-style-setting .ai-icon-wrap {
  position: relative;
  width: 34px;
  height: 34px;
  min-width: 34px;
  flex: 0 0 34px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#ai-style-setting .ai-icon-core {
  position: relative;
  z-index: 2;

  width: 34px;
  height: 34px;
  border-radius: 50%;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: linear-gradient(135deg, #32d8ff 0%, #5b8cff 48%, #8a49ff 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 6px 14px rgba(74, 112, 255, 0.26);
}

#ai-style-setting .ai-icon-core i {
  font-size: 15px;
  color: #ffffff;
  line-height: 1;
  animation: aiStarPulse 2.4s ease-in-out infinite;
}

#ai-style-setting .ai-icon-ring {
  position: absolute;
  inset: -4px;
  z-index: 1;
  border-radius: 50%;
  border: 1px solid rgba(100, 203, 255, 0.28);
  animation: aiRingBreath 2.8s ease-in-out infinite;
}

/* Текст */
#ai-style-setting .ai-btn-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-width: 0;
  flex: 1 1 auto;
}

#ai-style-setting .ai-btn-title {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.1;
  color: #ffffff;
  letter-spacing: 0.15px;
}

#ai-style-setting .ai-btn-subtitle {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.15;
  color: #9ec3ea;
  font-weight: 600;
  letter-spacing: 0.1px;
}

/* Бейдж справа */
#ai-style-setting .ai-btn-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-width: 42px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;

  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.45px;
  text-transform: uppercase;

  color: #eaffff;
  background: linear-gradient(135deg, rgba(53, 214, 255, 0.22), rgba(119, 67, 255, 0.24));
  border: 1px solid rgba(129, 212, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* Небольшая локальная подстройка */
.qr-export-panel #ai-style-setting {
  margin-bottom: 2px;
}

/* hover-усиление внутренних частей */
#ai-style-setting:hover .ai-icon-core {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 8px 18px rgba(86, 118, 255, 0.34),
    0 0 14px rgba(97, 199, 255, 0.24);
}

#ai-style-setting:hover .ai-btn-subtitle {
  color: #c3dcff;
}

#ai-style-setting:hover .ai-btn-badge {
  background: linear-gradient(135deg, rgba(63, 223, 255, 0.3), rgba(135, 84, 255, 0.32));
  border-color: rgba(153, 225, 255, 0.28);
}

/* Мобильная версия */
@media (max-width: 767.98px) {
  #ai-style-setting.btn-ai-style {
    min-height: 54px;
    padding: 10px 12px;
    gap: 10px;
  }

  #ai-style-setting .ai-btn-title {
    font-size: 13.5px;
  }

  #ai-style-setting .ai-btn-subtitle {
    font-size: 10.5px;
  }

  #ai-style-setting .ai-btn-badge {
    min-width: 38px;
    height: 20px;
    font-size: 9px;
    padding: 0 7px;
  }

  #ai-style-setting .ai-icon-wrap,
  #ai-style-setting .ai-icon-core {
    width: 32px;
    height: 32px;
    min-width: 32px;
  }

  #ai-style-setting .ai-icon-core i {
    font-size: 14px;
  }
}

@keyframes aiStarPulse {
  0%, 100% {
    transform: scale(1) rotate(0deg);
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.2));
  }
  50% {
    transform: scale(1.12) rotate(8deg);
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.34));
  }
}

@keyframes aiRingBreath {
  0%, 100% {
    transform: scale(0.96);
    opacity: 0.55;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

@keyframes aiSmartShine {
  0% {
    left: -30%;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  24% {
    left: 108%;
    opacity: 0;
  }
  100% {
    left: 108%;
    opacity: 0;
  }
}

/* =========================================================
   AI MODAL: ROOT
========================================================= */

#aiStyleModal {
  --bs-modal-bg: transparent;
}

#aiStyleModal .modal-dialog {
  max-width: 100%;
  margin: 0;
}

#aiStyleModal .modal-content.ai-modal-content {
  background: linear-gradient(180deg, var(--ai-bg) 0%, var(--ai-bg-2) 100%) !important;
  color: var(--ai-text) !important;
  border: none !important;
  border-radius: 0 !important;
  min-height: 100vh;
}

#aiStyleModal .btn-close {
  filter: invert(1) grayscale(100%);
  opacity: 0.85;
}

/* =========================================================
   AI TOPBAR
========================================================= */

#aiStyleModal .ai-modal-topbar {
  min-height: 54px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--ai-border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.015));
}

#aiStyleModal .modal-title {
  color: #f4f7fd !important;
  font-weight: 700;
  font-size: 18px;
}

#aiStyleModal .modal-title i,
#aiStyleModal .ai-stage-title i {
  color: #8d7dff !important;
}

#aiStyleModal .ai-stage-meta .badge {
  font-size: 11px;
  font-weight: 600;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035) !important;
  color: var(--ai-text-soft) !important;
}

/* =========================================================
   AI BODY LAYOUT
========================================================= */

#aiStyleModal .ai-modal-body {
  height: calc(100vh - 56px);
  overflow: hidden;
  min-height: 0;
  padding: 0 !important;
}

#aiStyleModal .ai-modal-shell {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  background: transparent;
}

#aiStyleModal .ai-stage {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px 12px 8px;
  overflow: hidden;
}

/* =========================================================
   AI MOBILE TOOLBAR TOGGLE
========================================================= */

#aiStyleModal .ai-toolbar-mobile-toggle {
  display: none;
  position: relative;
  z-index: 30;
}

#aiStyleModal .ai-toolbar-toggle-btn {
  width: 100%;
  min-height: 38px;
  border-radius: 10px;
  border: 1px solid var(--ai-border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.025));
  color: #eef3fb;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

#aiStyleModal .ai-toolbar-toggle-btn:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  border-color: rgba(59, 130, 246, 0.24);
  color: #fff;
}

#aiStyleModal .ai-toolbar-toggle-btn.is-open {
  border-color: rgba(111, 0, 255, 0.36);
  background: linear-gradient(135deg, rgba(111, 0, 255, 0.16), rgba(59, 130, 246, 0.10));
}

/* =========================================================
   AI TOOLBAR
========================================================= */

#aiStyleModal .ai-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
}

#aiStyleModal .ai-toolbar-item,
#aiStyleModal .ai-toolbar-item-sm,
#aiStyleModal .ai-toolbar-item-wide {
  flex: 0 0 auto;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

#aiStyleModal .ai-toolbar-item {
  padding: 0 !important;
}

#aiStyleModal .ai-toolbar-label {
  display: block;
  margin-bottom: 6px;
  font-size: 10px;
  line-height: 1.1;
  color: var(--ai-text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* =========================================================
   AI SELECTS
========================================================= */

#aiStyleModal .ai-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  width: auto;
  min-width: 240px;
  max-width: 320px;
  height: 34px;
  min-height: 34px;
  padding: 5px 34px 5px 11px;

  border-radius: 12px !important;
  border: 1px solid var(--ai-border) !important;
  background-color: rgba(255, 255, 255, 0.045) !important;

  color: #e8eef8 !important;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.2;

  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);

  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'><path fill='%23b9c7db' d='M3.2 5.5 8 10.3l4.8-4.8 1.1 1.1L8 12.5 2.1 6.6z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 12px 12px;

  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

#aiStyleModal .ai-select:hover {
  border-color: rgba(59, 130, 246, 0.22) !important;
  background-color: rgba(255, 255, 255, 0.06) !important;
}

#aiStyleModal .ai-select:focus {
  border-color: rgba(59, 130, 246, 0.38) !important;
  background-color: rgba(255, 255, 255, 0.065) !important;
  box-shadow: 0 0 0 0.12rem rgba(59, 130, 246, 0.12) !important;
  color: #ffffff !important;
  outline: none;
}

#aiStyleModal .ai-select option {
  background: #151920 !important;
  color: #f3f6fb !important;
}

#aiStyleModal .ai-select optgroup {
  background: #11151b !important;
  color: #cad5e5 !important;
  font-weight: 700;
}

/* =========================================================
   AI STAGE HEADER
========================================================= */

#aiStyleModal .ai-stage-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-width: 0;
}

#aiStyleModal .ai-stage-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

#aiStyleModal .ai-stage-title .fw-semibold {
  font-size: 14px;
  font-weight: 700;
  color: #f3f7ff;
}

#aiStyleModal #aiStageSubTitle {
  color: var(--ai-text-muted) !important;
  font-size: 12px;
}

/* =========================================================
   AI CANVAS / PREVIEW
========================================================= */

#aiStyleModal .ai-stage-canvas {
  position: relative;
  min-height: 0;
  border: 1px solid var(--ai-border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#aiStyleModal #aiQrPreviewWrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 1100px);
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  transition: width 0.18s ease, height 0.18s ease;
}

#aiQrPreviewWrapper.ai-aspect-square {
  aspect-ratio: 1 / 1;
}

#aiQrPreviewWrapper.ai-aspect-portrait {
  aspect-ratio: 3 / 4;
}

#aiQrPreviewWrapper.ai-aspect-landscape {
  aspect-ratio: 4 / 3;
}

#aiQrPreview {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#aiStyleModal #aiQrPreview svg,
#aiStyleModal #aiQrPreview img,
#aiStyleModal #aiQrPreview canvas {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.ai-overlay-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* =========================================================
   AI EMPTY STAGE
========================================================= */

.ai-empty-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-empty-stage__frame {
  width: 100%;
  height: 100%;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.ai-empty-stage__inner {
  text-align: center;
  padding: 24px;
  max-width: 520px;
}

.ai-empty-stage__badge {
  display: inline-block;
  margin-bottom: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  color: #abd9ff;
  background: rgba(59, 130, 246, 0.10);
  border: 1px solid rgba(59, 130, 246, 0.20);
}

.ai-empty-stage__title {
  color: #e9f0fa;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
}

.ai-empty-stage__text {
  color: #f8fafc;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

.ai-empty-stage__sub {
  color: rgba(226, 232, 240, 0.68);
  font-size: 12.5px;
  line-height: 1.45;
}

/* =========================================================
   AI FOOTER
========================================================= */

#aiStyleModal .ai-stage-footer {
  min-height: 0;
}

#aiStyleModal .ai-stage-footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

#aiStyleModal .ai-stage-footer-top > .small {
  color: #96a7bf !important;
  font-size: 12px;
}

#aiStyleModal .ai-stage-actions {
  align-items: center;
}

/* =========================================================
   FORMAT SWITCH / DOWNLOAD
========================================================= */

.ai-format-segment {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--ai-border);
}

.ai-format-segment__btn {
  border: none;
  background: transparent;
  color: #cfd7e6;
  min-width: 54px;
  height: 30px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  transition: all 0.15s ease;
}

.ai-format-segment__btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.ai-format-segment__btn.is-active {
  color: #fff;
  background: linear-gradient(135deg, rgba(111, 0, 255, 0.9), rgba(56, 189, 248, 0.7));
}

.ai-download-btn-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: none;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  box-shadow:
    0 4px 12px rgba(37, 99, 235, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: all 0.15s ease;
}

.ai-download-btn-inline:hover {
  transform: translateY(-1px);
  box-shadow:
    0 6px 16px rgba(37, 99, 235, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.ai-download-btn-inline:active {
  transform: scale(0.97);
}

/* =========================================================
   AI ACTION BUTTONS
========================================================= */

#aiStyleModal #aiApplyBtn,
#aiStyleModal #aiDiscardBtn {
  min-height: 32px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
}

#aiStyleModal #aiApplyBtn {
  background: linear-gradient(135deg, #18b566, #23c36b) !important;
  border: none !important;
  box-shadow: 0 4px 12px rgba(24, 181, 102, 0.18);
}

#aiStyleModal #aiApplyBtn:hover:not(:disabled) {
  transform: translateY(-1px);
}

#aiStyleModal #aiDiscardBtn {
  border: 1px solid rgba(255, 107, 129, 0.25) !important;
  color: #ff7f8f !important;
  background: rgba(255, 107, 129, 0.05) !important;
}

#aiStyleModal #aiDiscardBtn:hover:not(:disabled) {
  color: #fff !important;
  background: rgba(255, 107, 129, 0.10) !important;
}

#aiStyleModal #aiStatusLine {
  min-height: 18px;
  font-size: 12px;
  color: #aec0d7;
}

/* =========================================================
   AI LOADING
========================================================= */

#aiStyleModal .ai-loading {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(7, 10, 16, 0.42);
  backdrop-filter: blur(6px);
  text-align: center;
}

#aiStyleModal .ai-loading-card {
  width: min(460px, calc(100% - 40px));
  max-width: 460px;
  margin: 0 auto;
  border-radius: 18px;
  padding: 22px 20px 18px;
  text-align: center;
  background: linear-gradient(180deg, rgba(20, 24, 34, 0.96), rgba(12, 15, 22, 0.96));
  border: 1px solid var(--ai-border);
  box-shadow:
    0 18px 60px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

#aiStyleModal .ai-loading-spinner-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

#aiStyleModal .ai-loading-spinner {
  width: 2.2rem;
  height: 2.2rem;
  border-width: 0.24em;
}

#aiStyleModal .ai-loading-title {
  color: #f3f7ff;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 700;
  margin-bottom: 8px;
}

#aiStyleModal .ai-loading-subtitle {
  color: #b9c7da;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 10px;
}

#aiStyleModal .ai-loading-hint {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  line-height: 1.3;
  color: #9fd4ff;
  background: rgba(59, 130, 246, 0.10);
  border: 1px solid rgba(59, 130, 246, 0.16);
}

/* =========================================================
   AI COMPOSER
========================================================= */

#aiStyleModal .ai-composer {
  border-top: 1px solid var(--ai-border);
  padding: 10px 12px 8px;
  background: rgba(255, 255, 255, 0.015);
  backdrop-filter: blur(8px);
}

#aiStyleModal .ai-composer-inner {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

#aiStyleModal .ai-composer-inputwrap {
  flex: 1 1 auto;
}

#aiStyleModal .ai-composer-textarea {
  resize: none;
  min-height: 42px;
  max-height: 120px;
  overflow: auto;
  padding: 10px 12px;
  line-height: 1.22;
  font-size: 13px;
  font-weight: 500;
  border-radius: 12px !important;
  border: 1px solid var(--ai-border) !important;
  background: rgba(255, 255, 255, 0.04) !important;
  color: #eef3fb !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

#aiStyleModal .ai-composer-textarea::placeholder {
  color: #8ea1bb;
}

#aiStyleModal .ai-composer-textarea:hover {
  border-color: rgba(59, 130, 246, 0.20) !important;
  background: rgba(255, 255, 255, 0.05) !important;
}

#aiStyleModal .ai-composer-textarea:focus {
  border-color: rgba(59, 130, 246, 0.35) !important;
  background: rgba(255, 255, 255, 0.06) !important;
  box-shadow: 0 0 0 0.12rem rgba(59, 130, 246, 0.10) !important;
  color: #fff !important;
  outline: none;
}

#aiStyleModal .ai-composer-send,
#aiStyleModal #generateAiStyle {
  height: 42px;
  min-width: 148px;
  white-space: nowrap;
  border: none !important;
  border-radius: 12px !important;
  font-size: 13px;
  font-weight: 700;
  color: #fff !important;
  background: linear-gradient(135deg, #00c2ff, #2563eb 45%, #6f00ff) !important;
  box-shadow:
    0 6px 16px rgba(111, 0, 255, 0.20),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition: all 0.18s ease;
}

#aiStyleModal .ai-composer-send:hover,
#aiStyleModal #generateAiStyle:hover {
  transform: translateY(-1px);
}

#aiStyleModal .ai-composer-hint {
  margin-top: 5px;
  font-size: 11px;
  color: #8798b1 !important;
}

/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 1199.98px) {
  #aiStyleModal .ai-select {
    min-width: 220px;
    max-width: 260px;
  }

  #aiStyleModal .ai-toolbar {
    gap: 6px;
  }
}

@media (max-width: 767.98px) {
  #aiStyleModal .ai-modal-body {
    height: calc(100vh - 52px);
  }

  #aiStyleModal .ai-modal-shell {
    grid-template-rows: minmax(0, 1fr) auto !important;
    min-height: 0;
  }

  #aiStyleModal .ai-stage {
    padding: 10px;
    gap: 8px;
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: 14px !important;
    scrollbar-width: thin;
  }

  #aiStyleModal .ai-toolbar-mobile-toggle {
    display: block !important;
  }

  #aiStyleModal .ai-toolbar {
    display: none !important;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--ai-border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.025);
    position: relative;
    z-index: 20;
  }

  #aiStyleModal .ai-toolbar.is-open {
    display: flex !important;
  }

  #aiStyleModal .ai-toolbar-item,
  #aiStyleModal .ai-toolbar-item-sm,
  #aiStyleModal .ai-toolbar-item-wide {
    width: 100%;
    padding: 0 !important;
  }

  #aiStyleModal .ai-select {
    width: 100%;
    min-width: 0;
    max-width: none;
    height: 38px;
    min-height: 38px;
    font-size: 13px;
    padding-right: 38px;
    background-position: right 12px center;
  }

  #aiStyleModal .ai-stage-canvas {
    min-height: 220px;
    padding: 8px;
    flex-shrink: 0;
  }

  #aiStyleModal #aiQrPreviewWrapper {
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    max-height: 100%;
  }

  #aiStyleModal .ai-stage-footer {
    flex-shrink: 0;
    min-height: fit-content;
    padding-top: 2px;
    padding-bottom: 6px;
  }

  #aiStyleModal .ai-stage-footer-top {
    flex-direction: column;
    align-items: stretch !important;
    gap: 8px;
  }

  #aiStyleModal #aiStatusLine {
    min-height: 20px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.35;
    padding-bottom: 2px;
  }

  #aiStyleModal .ai-stage-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    flex-shrink: 0;
  }

  #aiStyleModal .ai-stage-actions > .d-flex {
    width: 100%;
    justify-content: space-between;
    flex-shrink: 0;
  }

  #aiStyleModal #aiApplyBtn,
  #aiStyleModal #aiDiscardBtn {
    min-height: 36px;
    font-size: 13px;
    width: 100%;
  }

  #aiStyleModal .ai-composer {
    flex-shrink: 0;
    position: relative;
    z-index: 5;
    padding: 8px 10px 10px;
  }

  #aiStyleModal .ai-composer-inner {
    flex-direction: column;
    align-items: stretch;
  }

  #aiStyleModal .ai-composer-textarea {
    min-height: 44px;
    font-size: 14px;
    max-height: 140px !important;
    overflow-y: auto !important;
  }

  #aiStyleModal .ai-composer-send,
  #aiStyleModal #generateAiStyle {
    width: 100%;
    min-width: 0;
    height: 44px;
  }

  #aiStyleModal .ai-loading {
    padding: 14px;
  }

  #aiStyleModal .ai-loading-card {
    width: min(94vw, 420px);
    max-width: 420px;
    padding: 18px 16px 16px;
    border-radius: 16px;
  }

  #aiStyleModal .ai-loading-title {
    font-size: 14px;
  }

  #aiStyleModal .ai-loading-subtitle {
    font-size: 12.5px;
  }

  #aiStyleModal .ai-loading-hint {
    font-size: 11px;
  }
}

/* =========================================================
   STEP 2 LAYOUT TUNING
   Чуть больше места правой колонке с QR-превью
========================================================= */

@media (min-width: 768px) {
  #step2Card .row.gy-4.flex-column-reverse.flex-md-row > .col-md-8 {
    flex: 0 0 62%;
    max-width: 62%;
  }

  #step2Card .row.gy-4.flex-column-reverse.flex-md-row > .col-md-4 {
    flex: 0 0 38%;
    max-width: 38%;
  }

  /* Сам блок превью делаем чуть шире */
  #step2Card #qr-bg-wrapper {
    max-width: 560px;
  }

  /* Панель под QR тоже можно чуть расширить */
  #step2Card .qr-export-panel {
    max-width: 420px;
  }
}