/**
 * Nano Banana WebApp - Components Styles
 */

/* ===== FORM ELEMENTS ===== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

textarea {
  width: 100%;
  padding: 12px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 100px;
  transition: var(--transition);
}

textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
}

textarea::placeholder {
  color: var(--text-muted);
}

/* ===== PROMPT WRAPPER WITH CLEAR BUTTON ===== */
.prompt-wrapper {
  position: relative;
  width: 100%;
}

.prompt-wrapper textarea {
  padding-right: 80px; /* Место для 2 кнопок */
}

.prompt-buttons {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 6px;
  z-index: 10;
}

.copy-prompt-btn,
.clear-prompt-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.3s var(--ease-spring),
              opacity 0.2s ease;
  pointer-events: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  overflow: hidden;
}

.copy-prompt-btn.visible,
.clear-prompt-btn.visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.copy-prompt-btn:hover {
  background: var(--primary);
  color: white;
  transform: scale(1.15);
  box-shadow: 0 0 15px rgba(106, 106, 255, 0.5),
              0 0 30px rgba(106, 106, 255, 0.3);
}

.copy-prompt-btn:active {
  transform: scale(0.85);
  box-shadow: 0 0 10px rgba(106, 106, 255, 0.4);
}

.clear-prompt-btn:hover {
  background: var(--error);
  color: white;
  transform: scale(1.15) rotate(90deg);
  box-shadow: 0 0 15px rgba(244, 67, 54, 0.5),
              0 0 30px rgba(244, 67, 54, 0.3);
}

.clear-prompt-btn:active {
  transform: scale(0.85) rotate(90deg);
  box-shadow: 0 0 10px rgba(244, 67, 54, 0.4);
}

.copy-prompt-btn svg,
.clear-prompt-btn svg {
  width: 14px;
  height: 14px;
  transition: transform 0.3s var(--ease-spring);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border: none;
  border-radius: var(--border-radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: all 0.3s var(--ease-spring),
              box-shadow 0.3s var(--ease-smooth);
  /* Fix click detection issues */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  transform-style: flat;
  isolation: isolate;
}

/* Ripple effect for all buttons */
.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.4) 0%, transparent 70%);
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  pointer-events: none;
  border-radius: inherit;
}

.btn:active::before {
  animation: rippleEffect 0.5s ease-out;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  background-size: 200% 200%;
  color: white;
  box-shadow: 0 4px 15px rgba(106, 106, 255, 0.3),
              0 0 0 0 rgba(106, 106, 255, 0);
  border: 1px solid rgba(106, 106, 255, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 25px rgba(106, 106, 255, 0.5),
              0 0 20px rgba(106, 106, 255, 0.3);
  animation: gradientShift 3s ease infinite;
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.97);
  box-shadow: 0 2px 10px rgba(106, 106, 255, 0.4);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Neon pulse for focused primary button */
.btn-primary:focus-visible {
  outline: none;
  animation: neonPulse 2s ease-in-out infinite;
  --glow-color: var(--glow-primary);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}

.btn-secondary:active {
  transform: scale(0.97);
  background: rgba(255, 255, 255, 0.1);
}

.btn-gold {
  background: linear-gradient(135deg, var(--accent-gold), #ff8c00);
  background-size: 200% 200%;
  color: #1a1a2e;
  box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3),
              0 0 0 0 rgba(255, 215, 0, 0);
  border: 1px solid rgba(255, 215, 0, 0.4);
}

.btn-gold:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 25px rgba(255, 215, 0, 0.5),
              0 0 25px rgba(255, 215, 0, 0.3);
  animation: gradientShift 3s ease infinite;
}

.btn-gold:active:not(:disabled) {
  transform: scale(0.97);
  box-shadow: 0 2px 10px rgba(255, 215, 0, 0.4);
}

.btn-gold:focus-visible {
  outline: none;
  animation: neonPulse 2s ease-in-out infinite;
  --glow-color: var(--glow-gold);
}

/* ===== OPTIONS SELECTOR ===== */
.options-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.option-btn {
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: all 0.3s var(--ease-spring),
              box-shadow 0.3s var(--ease-smooth);
  /* Fix click detection */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transform-style: flat;
  isolation: isolate;
}

/* Ripple for option buttons */
.option-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(106, 106, 255, 0.4) 0%, transparent 70%);
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  pointer-events: none;
  border-radius: 8px;
}

.option-btn:active::before {
  animation: rippleEffect 0.4s ease-out;
}

.option-btn:hover {
  background: rgba(106, 106, 255, 0.15);
  border-color: rgba(106, 106, 255, 0.4);
  color: var(--text-primary);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 15px rgba(106, 106, 255, 0.2);
}

.option-btn:active {
  transform: scale(0.96);
  box-shadow: none;
}

.option-btn.selected {
  background: linear-gradient(135deg, rgba(106, 106, 255, 0.25), rgba(138, 43, 226, 0.2));
  border-color: var(--accent-primary);
  color: var(--text-primary);
  box-shadow: 0 0 15px rgba(106, 106, 255, 0.3),
              inset 0 0 15px rgba(106, 106, 255, 0.1);
  animation: neonPulse 3s ease-in-out infinite;
  --glow-color: var(--glow-primary);
}

.option-btn.selected:hover {
  transform: translateY(-2px) scale(1.02);
}

.option-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.option-btn .pro-badge {
  font-size: 9px;
  color: var(--accent-gold);
  display: block;
  margin-top: 2px;
}

/* ===== QUALITY SELECTOR ===== */
.quality-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.quality-option {
  padding: 12px 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius);
  text-align: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: all 0.3s var(--ease-spring),
              box-shadow 0.3s var(--ease-smooth);
  /* Fix click detection */
  touch-action: manipulation;
  transform-style: flat;
  isolation: isolate;
}

/* Ripple for quality options */
.quality-option::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(106, 106, 255, 0.4) 0%, transparent 70%);
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  pointer-events: none;
  border-radius: inherit;
}

.quality-option:active::before {
  animation: rippleEffect 0.5s ease-out;
}

.quality-option:hover:not(.disabled) {
  border-color: rgba(106, 106, 255, 0.5);
  background: rgba(106, 106, 255, 0.12);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 15px rgba(106, 106, 255, 0.2);
}

.quality-option:active:not(.disabled) {
  transform: scale(0.97);
  box-shadow: none;
}

.quality-option.selected {
  background: linear-gradient(135deg, rgba(106, 106, 255, 0.2), rgba(138, 43, 226, 0.15));
  border-color: var(--accent-primary);
  box-shadow: 0 0 15px rgba(106, 106, 255, 0.3),
              inset 0 0 10px rgba(106, 106, 255, 0.1);
  animation: neonPulse 3s ease-in-out infinite;
  --glow-color: var(--glow-primary);
}

.quality-option.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.quality-option .name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.quality-option .desc {
  font-size: 10px;
  color: var(--text-muted);
}

.quality-option .pro-only {
  font-size: 9px;
  color: var(--accent-gold);
  margin-top: 4px;
}

/* ===== UPLOAD ZONE ===== */
.upload-zone {
  border: 2px dashed rgba(255, 255, 255, 0.3);
  border-radius: var(--border-radius);
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.upload-zone:hover {
  border-color: var(--accent-primary);
  background: rgba(106, 106, 255, 0.1);
}

.upload-zone.active {
  border-color: var(--success);
  border-style: solid;
  background: rgba(76, 175, 80, 0.1);
}

.upload-zone .icon {
  font-size: 48px;
  margin-bottom: 10px;
}

.upload-zone .text {
  font-size: 14px;
  color: var(--text-secondary);
}

.upload-zone .hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.image-preview {
  max-width: 100%;
  border-radius: var(--border-radius);
  margin-top: 12px;
  display: none;
}

.image-preview.visible {
  display: block;
}

/* ===== STATUS ===== */
.status-bar {
  padding: 12px;
  border-radius: var(--border-radius);
  margin-top: 16px;
  text-align: center;
  font-weight: 500;
  display: none;
}

.status-bar.visible {
  display: block;
}

.status-bar.loading {
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary), var(--accent-primary));
  background-size: 200% 100%;
  animation: gradientMove 2s ease infinite;
  color: white;
}

.status-bar.success {
  background: var(--success);
  color: white;
}

.status-bar.error {
  background: var(--error);
  color: white;
}

@keyframes gradientMove {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ===== STATUS BAR PROGRESS ===== */
/* Тонкий линейный прогресс-бар под .status-message в .status-bar.loading */
.status-bar-progress {
  position: relative;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 10px;
  height: 4px;
}
.status-bar-progress .progress-bar-fill {
  background: linear-gradient(90deg, #ffffff 0%, rgba(255, 255, 255, 0.85) 100%);
  height: 100%;
  width: 0%;
  transition: width 0.4s ease-out;
  border-radius: 4px;
}
.status-bar-progress .progress-bar-fill.failed {
  background: var(--error, #f44336);
}

/* ===== SPINNER ===== */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== RESULT AREA ===== */
.result-area {
  margin-top: 16px;
  display: none;
  opacity: 0;
}

.result-area.visible {
  display: block;
  animation: resultAreaAppear 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes resultAreaAppear {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.9);
    filter: blur(10px);
  }
  50% {
    filter: blur(5px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.result-image {
  width: 100%;
  border-radius: var(--border-radius);
  margin-bottom: 12px;
}

.result-actions {
  display: none;
  gap: 10px;
  flex-wrap: wrap;
}

.result-actions.visible {
  display: flex;
}

.result-actions .btn {
  flex: 1;
}

/* 2-column grid for primary actions (Regenerate + Save) so long labels
   don't get clipped. Cross-model button goes on its own row. */
.result-actions > .regenerate-btn,
.result-actions > .save-gallery-btn {
  flex: 1 1 calc(50% - 5px);
  min-width: 0;
  white-space: normal;
  text-align: center;
  padding-left: 10px;
  padding-right: 10px;
}

/* Cross-model variants row container (Product #33: 3 tiles of "try in another model") */
.result-actions > .cross-model-variants {
  flex: 1 1 100%;
  min-width: 0;
}

.cross-model-variants .cross-model-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-secondary);
  margin: 8px 0 8px;
  text-align: center;
  opacity: 0.85;
}

.cross-model-variants .cross-model-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

/* Animate + Edit as a second row (50/50, below Regenerate + Save) */
.result-actions > .result-action-btn {
  flex: 1 1 calc(50% - 5px);
  min-width: 0;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  white-space: normal;
  text-align: center;
  line-height: 1.2;
}

.result-actions > .result-action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.result-actions > .result-action-btn:active {
  transform: scale(0.97);
}

.result-actions > .result-action-btn .result-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.result-actions > .result-action-btn .result-action-icon svg {
  width: 100%;
  height: 100%;
}

/* Animate — purple accent */
.result-actions > .result-action-animate {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(99, 102, 241, 0.1));
  border-color: rgba(139, 92, 246, 0.35);
  color: #c4b5fd;
}
.result-actions > .result-action-animate:hover {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(99, 102, 241, 0.18));
  border-color: rgba(139, 92, 246, 0.6);
  box-shadow: 0 6px 18px rgba(139, 92, 246, 0.25);
}

/* Edit — cyan/teal accent */
.result-actions > .result-action-edit {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.15), rgba(6, 182, 212, 0.1));
  border-color: rgba(14, 165, 233, 0.35);
  color: #7dd3fc;
}
.result-actions > .result-action-edit:hover {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.25), rgba(6, 182, 212, 0.18));
  border-color: rgba(14, 165, 233, 0.6);
  box-shadow: 0 6px 18px rgba(14, 165, 233, 0.25);
}

@media (max-width: 420px) {
  .result-actions > .result-action-btn {
    font-size: 14px;
    padding: 12px 8px;
  }
}

/* Tighter text on narrow screens — avoid clipping without shrinking font */
@media (max-width: 420px) {
  .result-actions > .regenerate-btn .regenerate-text,
  .result-actions > .save-gallery-btn .save-gallery-text {
    font-size: 14px;
    line-height: 1.2;
  }
}

/* ===== ACCOUNT TAB ===== */
.balance-card {
  background: linear-gradient(135deg, #4a4a8a, var(--bg-card));
  text-align: center;
  padding: 24px;
}

.balance-card .label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.balance-card .amount {
  font-size: 42px;
  font-weight: bold;
  margin-bottom: 4px;
}

.balance-card .currency {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--border-radius);
  padding: 16px;
  text-align: center;
}

.stat-card .value {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 4px;
}

.stat-card .label {
  font-size: 11px;
  color: var(--text-muted);
}

/* ===== VERSION SELECTOR ===== */
.version-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.version-option {
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: all 0.3s var(--ease-spring),
              box-shadow 0.3s var(--ease-smooth);
}

/* Ripple for version options */
.version-option::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(106, 106, 255, 0.4) 0%, transparent 70%);
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  pointer-events: none;
  border-radius: inherit;
}

.version-option:active::before {
  animation: rippleEffect 0.5s ease-out;
}

.version-option:hover {
  border-color: rgba(106, 106, 255, 0.5);
  background: rgba(106, 106, 255, 0.12);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 15px rgba(106, 106, 255, 0.2);
}

.version-option:active {
  transform: scale(0.97);
  box-shadow: none;
}

.version-option.selected {
  border-color: var(--accent-primary);
  background: linear-gradient(135deg, rgba(106, 106, 255, 0.2), rgba(138, 43, 226, 0.15));
  box-shadow: 0 0 15px rgba(106, 106, 255, 0.3),
              inset 0 0 10px rgba(106, 106, 255, 0.1);
  animation: neonPulse 3s ease-in-out infinite;
  --glow-color: var(--glow-primary);
}

.version-option.pro.selected {
  border-color: var(--accent-gold);
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 140, 0, 0.1));
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.3),
              inset 0 0 10px rgba(255, 215, 0, 0.1);
  animation: neonPulse 3s ease-in-out infinite;
  --glow-color: var(--glow-gold);
}

.version-option.pro:hover {
  border-color: rgba(255, 215, 0, 0.5);
  background: rgba(255, 215, 0, 0.12);
  box-shadow: 0 4px 15px rgba(255, 215, 0, 0.2);
}

.version-option.pro::before {
  background: radial-gradient(circle, rgba(255, 215, 0, 0.4) 0%, transparent 70%);
}

.version-option .name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.version-option.pro .name {
  color: var(--accent-gold);
}

.version-option .desc {
  font-size: 11px;
  color: var(--text-muted);
}

/* ===== HISTORY TAB - Modern Animated Design ===== */

/* --- Filters Row --- */
.history-filters {
  display: flex;
  gap: 8px;
  padding: 0 4px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.history-filters::-webkit-scrollbar {
  display: none;
}

/* Second-row model filter (Все / Classic / SeeDream / GPT image / Pro).
   Reuses `.history-filter` pills but sits closer to the type-filter row. */
.history-model-filters {
  padding-top: 0;
  padding-bottom: 12px;
  margin-top: -8px;
}

.history-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.history-filter::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.history-filter .filter-icon {
  font-size: 14px;
  position: relative;
  z-index: 1;
  transition: transform 0.3s ease;
}

.history-filter .filter-text {
  position: relative;
  z-index: 1;
}

.history-filter:hover {
  border-color: rgba(106, 106, 255, 0.4);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(106, 106, 255, 0.2);
}

.history-filter:hover .filter-icon {
  transform: scale(1.2);
}

.history-filter.active {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 20px rgba(106, 106, 255, 0.4),
              0 0 30px rgba(106, 106, 255, 0.2);
}

.history-filter.active::before {
  opacity: 1;
}

.history-filter.active .filter-icon {
  animation: filterIconPulse 2s ease-in-out infinite;
}

@keyframes filterIconPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* --- Timeline Container --- */
.history-timeline {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-bottom: 20px;
}

/* --- Date Group --- */
.history-date-group {
  animation: dateGroupAppear 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}

@keyframes dateGroupAppear {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.history-date-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 0 4px;
}

.history-date-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg,
    rgba(106, 106, 255, 0.5) 0%,
    rgba(106, 106, 255, 0.1) 100%);
}

.history-date-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
  padding: 6px 12px;
  background: rgba(106, 106, 255, 0.1);
  border-radius: 12px;
  border: 1px solid rgba(106, 106, 255, 0.2);
}

/* --- Masonry Grid --- */
.history-masonry {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 0 4px;
}

@media (min-width: 480px) {
  .history-masonry {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* --- History Card --- */
.history-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-card);
  cursor: pointer;
  animation: cardAppear 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
  transform: translateY(30px) scale(0.9);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.4s ease;
}

.history-card:nth-child(1) { animation-delay: 0.05s; }
.history-card:nth-child(2) { animation-delay: 0.1s; }
.history-card:nth-child(3) { animation-delay: 0.15s; }
.history-card:nth-child(4) { animation-delay: 0.2s; }
.history-card:nth-child(5) { animation-delay: 0.25s; }
.history-card:nth-child(6) { animation-delay: 0.3s; }
.history-card:nth-child(7) { animation-delay: 0.35s; }
.history-card:nth-child(8) { animation-delay: 0.4s; }
.history-card:nth-child(9) { animation-delay: 0.45s; }
.history-card:nth-child(10) { animation-delay: 0.5s; }

@keyframes cardAppear {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.9);
    filter: blur(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.history-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4),
              0 0 30px rgba(106, 106, 255, 0.2);
  z-index: 10;
}

.history-card-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

.history-card:hover .history-card-image {
  transform: scale(1.1);
}

.history-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 40%,
    rgba(0, 0, 0, 0.8) 100%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px;
}

.history-card:hover .history-card-overlay {
  opacity: 1;
}

.history-card-type {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  color: white;
  display: flex;
  align-items: center;
  gap: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.history-card-type.type-image {
  background: linear-gradient(135deg, rgba(106, 106, 255, 0.8), rgba(138, 43, 226, 0.8));
}

.history-card-type.type-edit {
  background: linear-gradient(135deg, rgba(255, 152, 0, 0.8), rgba(255, 87, 34, 0.8));
}

.history-card-type.type-video {
  background: linear-gradient(135deg, rgba(233, 30, 99, 0.8), rgba(156, 39, 176, 0.8));
}

.history-card-cost {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-gold);
}

.history-card-prompt {
  font-size: 11px;
  color: white;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.history-card-time {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 4px;
}

/* Video card play button */
.history-card-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.history-card-play::before {
  content: '';
  width: 0;
  height: 0;
  border-left: 16px solid #333;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  margin-left: 4px;
}

.history-card:hover .history-card-play {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* --- Loading State --- */
.history-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
}

.history-loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(106, 106, 255, 0.2);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: historySpinner 1s linear infinite;
}

@keyframes historySpinner {
  to { transform: rotate(360deg); }
}

.history-loading-text {
  font-size: 14px;
  color: var(--text-secondary);
  animation: loadingPulse 1.5s ease-in-out infinite;
}

@keyframes loadingPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* --- Empty State --- */
.history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  animation: emptyAppear 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes emptyAppear {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.history-empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  animation: emptyIconFloat 3s ease-in-out infinite;
}

@keyframes emptyIconFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.history-empty-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.history-empty-text {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.history-empty-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border: none;
  border-radius: 16px;
  color: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(106, 106, 255, 0.4);
}

.history-empty-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 30px rgba(106, 106, 255, 0.5);
}

.history-empty-btn:active {
  transform: scale(0.98);
}

/* --- Swipe Carousel (Mobile) --- */
.history-carousel {
  display: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  gap: 12px;
  padding: 0 20px 20px;
}

.history-carousel::-webkit-scrollbar {
  display: none;
}

.history-carousel-card {
  flex-shrink: 0;
  width: 280px;
  scroll-snap-align: center;
  border-radius: 20px;
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease;
}

.history-carousel-card.active {
  transform: scale(1.05);
  box-shadow: 0 15px 50px rgba(106, 106, 255, 0.3);
}

/* Legacy empty-state support */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state .text {
  font-size: 14px;
}

/* ===== PROMPT EXAMPLES ===== */
.prompt-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.example-chip {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s var(--ease-spring),
              box-shadow 0.3s var(--ease-smooth);
}

/* Ripple for chips */
.example-chip::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(106, 106, 255, 0.5) 0%, transparent 70%);
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  pointer-events: none;
  border-radius: inherit;
}

.example-chip:active::before {
  animation: rippleEffect 0.4s ease-out;
}

.example-chip:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 4px 15px rgba(106, 106, 255, 0.4),
              0 0 15px rgba(106, 106, 255, 0.2);
}

.example-chip:active {
  transform: scale(0.95);
  box-shadow: none;
}

/* ===== TOKEN COST INFO ===== */
.token-cost {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.token-cost .label {
  color: var(--text-secondary);
}

.token-cost .value {
  font-weight: 600;
  color: var(--accent-gold);
}

/* ===== NEON TOPUP BUTTON (Cyberpunk Style) ===== */
.topup-btn-neon {
  position: relative;
  display: block; /* Всегда видна */
  width: 100%;
  padding: 14px 24px;
  margin: 16px 0;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #fff;
  background: linear-gradient(135deg, #0f0f23 0%, #1a1a3e 100%);
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s ease;
}

.topup-btn-neon::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(
    90deg,
    #ff00ff,
    #00ffff,
    #ff00ff,
    #00ffff,
    #ff00ff
  );
  background-size: 400% 100%;
  border-radius: 10px;
  z-index: -1;
  animation: neon-border-flow 3s linear infinite;
}

.topup-btn-neon::after {
  content: '';
  position: absolute;
  inset: 2px;
  background: linear-gradient(135deg, #0f0f23 0%, #1a1a3e 100%);
  border-radius: 6px;
  z-index: -1;
}

.topup-btn-glow {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 255, 255, 0.4),
    rgba(255, 0, 255, 0.4),
    transparent
  );
  background-size: 200% 100%;
  animation: neon-glow-sweep 2s ease-in-out infinite;
  border-radius: 6px;
  opacity: 0.6;
}

.topup-btn-text {
  position: relative;
  z-index: 1;
  text-shadow:
    0 0 10px #00ffff,
    0 0 20px #00ffff,
    0 0 40px #ff00ff;
  animation: neon-text-pulse 1.5s ease-in-out infinite;
}

.topup-btn-neon:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 20px rgba(0, 255, 255, 0.5),
    0 0 40px rgba(255, 0, 255, 0.3),
    0 10px 30px rgba(0, 0, 0, 0.3);
}

.topup-btn-neon:hover .topup-btn-glow {
  opacity: 1;
}

.topup-btn-neon:active {
  transform: translateY(0);
}

@keyframes neon-border-flow {
  0% { background-position: 0% 50%; }
  100% { background-position: 400% 50%; }
}

@keyframes neon-glow-sweep {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes neon-text-pulse {
  0%, 100% {
    text-shadow:
      0 0 10px #00ffff,
      0 0 20px #00ffff,
      0 0 40px #ff00ff;
  }
  50% {
    text-shadow:
      0 0 15px #ff00ff,
      0 0 30px #ff00ff,
      0 0 60px #00ffff;
  }
}

/* ===== SAVE TO GALLERY BUTTON ===== */
.save-gallery-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  background-size: 200% 200%;
  color: white;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  animation: galleryGradientFlow 4s ease infinite;
  box-shadow:
    0 4px 20px rgba(102, 126, 234, 0.4),
    0 0 40px rgba(118, 75, 162, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.save-gallery-btn::before {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 14px;
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 50%,
    rgba(255, 255, 255, 0.05) 100%);
  pointer-events: none;
}

.save-gallery-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  transition: transform 0.3s ease;
}

.save-gallery-icon svg {
  width: 22px;
  height: 22px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.save-gallery-text {
  position: relative;
  z-index: 1;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.save-gallery-glow {
  position: absolute;
  inset: -3px;
  border-radius: 18px;
  background: linear-gradient(135deg, #667eea, #764ba2, #f093fb, #667eea);
  background-size: 300% 300%;
  opacity: 0;
  z-index: -1;
  filter: blur(12px);
  animation: galleryGlowRotate 3s linear infinite;
  transition: opacity 0.3s ease;
}

.save-gallery-shine {
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transform: skewX(-25deg);
  animation: galleryShine 4s ease-in-out infinite;
}

/* Hover state */
.save-gallery-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow:
    0 8px 30px rgba(102, 126, 234, 0.5),
    0 0 60px rgba(118, 75, 162, 0.3),
    0 0 80px rgba(240, 147, 251, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.save-gallery-btn:hover .save-gallery-glow {
  opacity: 0.6;
}

.save-gallery-btn:hover .save-gallery-icon {
  transform: translateY(3px);
  animation: downloadBounce 0.6s ease infinite;
}

/* Active state */
.save-gallery-btn:active {
  transform: translateY(0) scale(0.98);
  box-shadow:
    0 2px 15px rgba(102, 126, 234, 0.4),
    inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Animations */
@keyframes galleryGradientFlow {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@keyframes galleryGlowRotate {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 300% 50%;
  }
}

@keyframes galleryShine {
  0%, 100% {
    left: -100%;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  40% {
    left: 150%;
    opacity: 0;
  }
  41%, 99% {
    left: -100%;
    opacity: 0;
  }
}

@keyframes downloadBounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(4px);
  }
}

/* ===== REGENERATE BUTTON ===== */
.regenerate-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
  flex-shrink: 0;
}

.regenerate-btn::before {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: 13px;
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.15) 0%,
    transparent 50%);
  pointer-events: none;
}

.regenerate-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  transition: transform 0.4s ease;
}

.regenerate-icon svg {
  width: 18px;
  height: 18px;
}

.regenerate-text {
  white-space: nowrap;
}

.regenerate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.regenerate-btn:hover .regenerate-icon {
  transform: rotate(180deg);
}

.regenerate-btn:active {
  transform: translateY(0) scale(0.98);
}

.regenerate-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ===== CROSS-MODEL REGENERATE BUTTON ===== */
.cross-model-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  min-width: 0;
  min-height: 78px;
  padding: 8px 4px;
  border: none;
  border-radius: 14px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: hidden;
  letter-spacing: 0.2px;
  text-align: center;
  line-height: 1.15;
}

.cross-model-btn .cross-model-emoji {
  font-size: 18px;
  line-height: 1;
}

.cross-model-btn .cross-model-label-text {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.cross-model-btn .cross-model-cost {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.2px;
  opacity: 0.85;
}

.cross-model-btn::before {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: 13px;
  background: inherit;
  opacity: 0;
  transition: opacity 0.3s;
}

/* SeeDream variant: pink-purple gradient */
.cross-model-seedream {
  background: linear-gradient(135deg, #e040fb 0%, #7c4dff 50%, #536dfe 100%);
  box-shadow:
    0 4px 15px rgba(224, 64, 251, 0.35),
    0 0 30px rgba(124, 77, 255, 0.15);
}

.cross-model-seedream:hover {
  transform: translateY(-2px);
  box-shadow:
    0 6px 25px rgba(224, 64, 251, 0.45),
    0 0 40px rgba(124, 77, 255, 0.25);
}

/* Classic variant: blue-gray gradient */
.cross-model-classic {
  background: linear-gradient(135deg, #42a5f5 0%, #5c6bc0 50%, #7e57c2 100%);
  box-shadow:
    0 4px 15px rgba(66, 165, 245, 0.35),
    0 0 30px rgba(92, 107, 192, 0.15);
}

.cross-model-classic:hover {
  transform: translateY(-2px);
  box-shadow:
    0 6px 25px rgba(66, 165, 245, 0.45),
    0 0 40px rgba(92, 107, 192, 0.25);
}

/* GPT image variant: cyan-blue gradient (matches VERSION_STYLES.gpt_image) */
.cross-model-gpt {
  background: linear-gradient(135deg, #0ea5e9 0%, #3b82f6 50%, #6366f1 100%);
  box-shadow:
    0 4px 15px rgba(14, 165, 233, 0.35),
    0 0 30px rgba(59, 130, 246, 0.15);
}

.cross-model-gpt:hover {
  transform: translateY(-2px);
  box-shadow:
    0 6px 25px rgba(14, 165, 233, 0.45),
    0 0 40px rgba(59, 130, 246, 0.25);
}

/* Pro variant: gold gradient (premium upsell) */
.cross-model-pro {
  background: linear-gradient(135deg, #ffd700 0%, #ffae00 50%, #ff8c00 100%);
  box-shadow:
    0 4px 15px rgba(255, 174, 0, 0.4),
    0 0 30px rgba(255, 215, 0, 0.2);
  color: #1a1a2e;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
}

.cross-model-pro .cross-model-cost {
  background: rgba(0, 0, 0, 0.18);
  color: #1a1a2e;
}

.cross-model-pro:hover {
  transform: translateY(-2px);
  box-shadow:
    0 6px 25px rgba(255, 174, 0, 0.5),
    0 0 40px rgba(255, 215, 0, 0.35);
}

.cross-model-btn:active {
  transform: translateY(0) scale(0.98);
}

.cross-model-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ===== BATCH EDIT MODE ===== */

/* Mode header */
.batch-mode-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.batch-mode-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.batch-mode-toggle:hover {
  background: rgba(106, 106, 255, 0.15);
  border-color: var(--accent-primary);
}

.batch-mode-toggle.active {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 15px rgba(106, 106, 255, 0.4);
}

.toggle-icon {
  font-size: 14px;
}

/* Batch count */
.batch-count {
  margin-left: auto;
  padding: 4px 10px;
  background: rgba(106, 106, 255, 0.2);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-primary);
}

/* Batch previews grid */
.batch-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.batch-preview-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
  animation: batchPreviewAppear 0.3s ease;
}

@keyframes batchPreviewAppear {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.batch-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.batch-preview-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.2s ease;
}

.batch-preview-item:hover .batch-preview-remove {
  opacity: 1;
}

.batch-preview-remove:hover {
  background: var(--error);
  transform: scale(1.1);
}

.batch-preview-remove svg {
  width: 12px;
  height: 12px;
}

/* Add more button */
.batch-add-more {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.batch-add-more:hover {
  border-color: var(--accent-primary);
  background: rgba(106, 106, 255, 0.1);
}

.batch-add-icon {
  font-size: 28px;
  color: var(--accent-primary);
  margin-bottom: 4px;
}

.batch-add-text {
  font-size: 12px;
  color: var(--text-secondary);
}

.batch-hint {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
}

/* Batch cost display */
.batch-cost {
  background: linear-gradient(135deg, rgba(106, 106, 255, 0.15), rgba(138, 43, 226, 0.15));
  border: 1px solid rgba(106, 106, 255, 0.3);
}

/* Batch edit button */
.batch-btn {
  background: linear-gradient(135deg, #ff6b35, #f7931e);
  box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

.batch-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(255, 107, 53, 0.4);
}

/* Batch result area */
.batch-result {
  margin-top: 20px;
}

.batch-result-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.batch-result-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.batch-result-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.batch-result-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  animation: batchResultAppear 0.5s ease;
}

@keyframes batchResultAppear {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.batch-result-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.batch-result-item:hover img {
  transform: scale(1.05);
}

/* Batch result actions */
.batch-result-actions {
  display: flex;
  justify-content: center;
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 12px;
}

.batch-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.batch-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(106, 106, 255, 0.4);
}

.batch-action-btn:active {
  transform: translateY(0);
}

.batch-action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.batch-action-icon {
  font-size: 16px;
}

/* ===== PREVIEW CONTAINER WITH SETTINGS ===== */
.preview-container {
  position: relative;
  display: none;
  margin-top: 12px;
  border-radius: 16px;
  overflow: hidden;
}

.preview-container.visible {
  display: block;
}

.preview-container .image-preview {
  display: block !important;
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.3);
  margin-top: 0;
}

/* Floating settings button */
.preview-settings-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: white;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 10;
  animation: settingsBtnPulse 2s ease-in-out infinite;
}

@keyframes settingsBtnPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(102, 126, 234, 0);
  }
}

.preview-settings-btn:hover {
  background: rgba(102, 126, 234, 0.8);
  border-color: rgba(102, 126, 234, 0.8);
  transform: scale(1.1) rotate(90deg);
}

.preview-settings-btn:active {
  transform: scale(0.95) rotate(90deg);
}

/* Settings badge on preview */
.preview-settings-badge {
  position: absolute;
  bottom: 12px;
  left: 12px;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  color: white;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
}

.preview-settings-badge:hover {
  background: rgba(102, 126, 234, 0.8);
  border-color: rgba(102, 126, 234, 0.8);
  transform: scale(1.05);
}

/* Swipe hint */
.preview-swipe-hint {
  position: absolute;
  bottom: 12px;
  right: 12px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  pointer-events: none;
}

.preview-swipe-hint span {
  animation: swipeHintBounce 1.5s ease-in-out infinite;
}

@keyframes swipeHintBounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

.preview-container.show-hint .preview-swipe-hint {
  opacity: 1;
  transform: translateY(0);
}

/* Long press visual feedback */
.preview-container.pressing {
  transform: scale(0.98);
}

.preview-container.pressing .image-preview {
  filter: brightness(0.8);
}

/* Preview overlay for gestures */
.preview-gesture-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  cursor: pointer;
}

/* History batch badge */
.history-card-batch {
  position: absolute;
  bottom: 8px;
  left: 8px;
  padding: 4px 8px;
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.9), rgba(247, 147, 30, 0.9));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  color: white;
  display: flex;
  align-items: center;
  gap: 4px;
}

.history-card-batch-icon {
  font-size: 11px;
}

/* ===== VERSION TOGGLE (Generate Tab) ===== */
.version-card {
  padding: 12px 16px;
}

.version-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.version-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.version-toggle {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}

.version-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.version-btn.active {
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.version-btn:not(.active):hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.version-name {
  font-weight: 600;
}

.version-badge-pro {
  font-size: 10px;
  padding: 2px 6px;
  background: linear-gradient(135deg, #ffd700, #ffaa00);
  color: #000;
  border-radius: 6px;
  font-weight: 700;
}

/* ===== BALANCE BADGE CLICKABLE ===== */
.balance-badge.clickable {
  cursor: pointer;
  transition: all 0.2s ease;
}

.balance-badge.clickable:hover {
  transform: scale(1.05);
  box-shadow: 0 0 12px rgba(102, 126, 234, 0.5);
}

.balance-badge.clickable:active {
  transform: scale(0.98);
}

.balance-icon {
  margin-left: 2px;
}

/* ===== BALANCE MODAL ===== */
.balance-modal {
  max-width: 380px;
  padding: 0;
  overflow: hidden;
}

.modal-close-btn {
  position: absolute;
  top: calc(12px + var(--tg-content-safe-area-inset-top, 0px));
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.modal-close-btn:hover {
  background: var(--error);
  color: white;
}

.balance-modal-header {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  padding: 20px 20px;
  padding-top: calc(20px + var(--tg-content-safe-area-inset-top, 0px));
  text-align: center;
}

.balance-modal-amount {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
}

.balance-modal-amount .balance-value {
  font-size: 40px;
  font-weight: 700;
  color: white;
}

.balance-modal-amount .balance-currency {
  font-size: 26px;
}

.balance-modal-label {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 4px;
}

.balance-modal-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.balance-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.balance-stat .stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.balance-stat .stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.balance-modal-topup {
  padding: 10px 12px;
}

.topup-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-align: center;
}

.balance-modal .topup-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.balance-modal .topup-option {
  padding: 6px;
}

.balance-modal .topup-option .package-name {
  font-size: 12px;
}

.balance-modal .topup-option .tokens-base {
  font-size: 20px;
}

.balance-modal .topup-option .tokens-bonus {
  font-size: 11px;
}

.balance-modal .topup-option .price {
  font-size: 12px;
}

.balance-modal .modal-actions {
  padding: 6px 12px 12px;
  border-top: none;
  flex-direction: column;
  gap: 4px;
}

.btn-topup {
  width: 100%;
  padding: 10px;
  font-size: 14px;
}

.btn-topup-top {
  margin-bottom: 12px;
}

/* ===== QUICK SETTINGS BUTTON (Radial Menu Trigger) ===== */
.quick-settings-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 18px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.15));
  border: 2px solid rgba(102, 126, 234, 0.3);
  border-radius: 16px;
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.quick-settings-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.3), rgba(118, 75, 162, 0.3));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.quick-settings-btn:hover::before {
  opacity: 1;
}

.quick-settings-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(102, 126, 234, 0.6);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.quick-settings-btn:active {
  transform: translateY(0) scale(0.98);
}

.quick-settings-icon {
  font-size: 20px;
  margin-right: 10px;
  animation: rotateGear 8s linear infinite;
  position: relative;
  z-index: 1;
}

@keyframes rotateGear {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.quick-settings-btn:hover .quick-settings-icon {
  animation-duration: 2s;
}

.quick-settings-text {
  font-weight: 600;
  flex: 1;
  text-align: left;
  position: relative;
  z-index: 1;
}

.quick-settings-value {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.9);
  position: relative;
  z-index: 1;
  transition: all 0.3s ease;
}

.quick-settings-btn:hover .quick-settings-value {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

/* ===== COST ROW (Generate/Edit) ===== */
.generate-cost-row,
.edit-cost-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.generate-cost-row .cost-label,
.edit-cost-row .cost-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.generate-cost-row .cost-value,
.edit-cost-row .cost-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-primary);
}

.edit-cost-row.batch-cost .cost-value {
  color: #ffd700;
}

/* ===== CHAT UPLOAD PROGRESS ===== */
.chat-upload-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  margin-top: 12px;
  background: linear-gradient(135deg, rgba(0, 136, 255, 0.15), rgba(0, 204, 153, 0.1));
  border-radius: var(--border-radius);
  border: 1px solid rgba(0, 136, 255, 0.3);
  animation: chatUploadPulse 2s ease-in-out infinite;
}

.chat-upload-progress.hidden {
  display: none;
}

.chat-upload-icon {
  width: 40px;
  height: 40px;
  margin-bottom: 12px;
  color: #0088ff;
  animation: chatUploadIconFly 1.5s ease-in-out infinite;
}

.chat-upload-icon svg {
  width: 100%;
  height: 100%;
}

.chat-upload-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.chat-upload-bar {
  width: 100%;
  max-width: 280px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.chat-upload-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 30%;
  background: linear-gradient(90deg, #0088ff, #00cc99, #0088ff);
  background-size: 200% 100%;
  border-radius: 3px;
  animation: chatUploadFillMove 1.5s ease-in-out infinite;
}

/* Анимации для chat upload */
@keyframes chatUploadPulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(0, 136, 255, 0.2);
  }
  50% {
    box-shadow: 0 0 30px rgba(0, 204, 153, 0.3);
  }
}

@keyframes chatUploadIconFly {
  0%, 100% {
    transform: translateX(0) translateY(0);
  }
  25% {
    transform: translateX(5px) translateY(-3px);
  }
  50% {
    transform: translateX(8px) translateY(-5px);
  }
  75% {
    transform: translateX(3px) translateY(-2px);
  }
}

@keyframes chatUploadFillMove {
  0% {
    transform: translateX(-100%);
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    transform: translateX(400%);
    background-position: 0% 50%;
  }
}

/* ===== PHOTOS UPLOAD SECTION (Create Tab) ===== */
.photos-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.photos-count {
  padding: 4px 10px;
  background: rgba(106, 106, 255, 0.2);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-primary);
}

.photos-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.photos-grid:empty {
  display: none;
}

.photo-preview-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  animation: photoAppear 0.3s var(--ease-smooth);
}

@keyframes photoAppear {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.photo-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: none;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  color: white;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.photo-preview-item:hover .photo-remove-btn {
  opacity: 1;
}

.photo-remove-btn:hover {
  background: var(--error);
  transform: scale(1.1);
}

/* Touch devices - always show remove button */
@media (hover: none) {
  .photo-remove-btn {
    opacity: 1;
    background: rgba(0, 0, 0, 0.6);
  }
}

.add-photo-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s var(--ease-smooth);
}

.add-photo-btn:hover {
  border-color: var(--accent-primary);
  background: rgba(106, 106, 255, 0.1);
  color: var(--text-primary);
}

.add-photo-btn:active {
  transform: scale(0.98);
}

.add-icon {
  font-size: 24px;
  color: var(--accent-primary);
  font-weight: 300;
}

.add-text {
  font-weight: 500;
}

.photos-hint {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 10px;
  opacity: 0.8;
}

/* Create Cost Row */
.create-cost-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Oferta Button - compact link style */
.oferta-btn {
  display: block;
  width: 100%;
  padding: 4px 8px;
  margin-bottom: 4px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.45);
  font-size: 11px;
  font-weight: 400;
  text-align: center;
  text-decoration: underline;
  transition: all 0.2s ease;
}

.oferta-btn:hover {
  color: rgba(255, 255, 255, 0.7);
}

.oferta-btn:active {
  opacity: 0.8;
}

