/* ============================================
   3Fire AI Image Studio - Premium Dark Theme
   Blue-Purple-Gold Aurora Aesthetic
   ============================================ */

/* --- CSS Variables --- */
:root {
  --bg-primary: #08070e;
  --bg-surface: rgba(18, 16, 30, 0.85);
  --bg-surface-solid: #12101e;
  --bg-elevated: rgba(28, 25, 48, 0.7);
  --bg-input: rgba(12, 10, 22, 0.8);
  --border-default: rgba(120, 100, 180, 0.15);
  --border-hover: rgba(160, 140, 220, 0.3);
  --border-focus: #c8a24e;
  --accent: #c8a24e;
  --accent-hover: #dbb65e;
  --accent-muted: rgba(200, 162, 78, 0.12);
  --gradient-fire: linear-gradient(135deg, #c8a24e, #e8c46a, #c8a24e);
  --gradient-accent: linear-gradient(135deg, #6c5ce7, #a855f7, #c8a24e);
  --gradient-aurora-1: radial-gradient(ellipse at 20% 50%, rgba(108, 92, 231, 0.15) 0%, transparent 50%);
  --gradient-aurora-2: radial-gradient(ellipse at 80% 20%, rgba(168, 85, 247, 0.1) 0%, transparent 50%);
  --gradient-aurora-3: radial-gradient(ellipse at 60% 80%, rgba(200, 162, 78, 0.08) 0%, transparent 50%);
  --text-primary: #f0eef6;
  --text-secondary: #9b95b0;
  --text-tertiary: #6b6580;
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --shadow-glow: 0 0 40px rgba(108, 92, 231, 0.08), 0 0 80px rgba(200, 162, 78, 0.04);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3), 0 0 1px rgba(120, 100, 180, 0.2);
}

/* --- Reset --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

input, select, textarea, button {
  font-family: inherit;
  font-size: inherit;
}

a { color: var(--accent); text-decoration: none; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(120, 100, 180, 0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(120, 100, 180, 0.35); }

/* --- Views --- */
.view {
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============================================
   AURORA BACKGROUND EFFECTS
   ============================================ */

.auth-bg-effects {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.aurora {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.6;
  animation: auroraFloat 12s ease-in-out infinite;
}

.aurora-1 {
  width: 600px;
  height: 600px;
  top: -200px;
  left: -100px;
  background: radial-gradient(circle, rgba(108, 92, 231, 0.3) 0%, transparent 70%);
  animation-delay: 0s;
}

.aurora-2 {
  width: 500px;
  height: 500px;
  top: 30%;
  right: -150px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.2) 0%, transparent 70%);
  animation-delay: -4s;
  animation-duration: 15s;
}

.aurora-3 {
  width: 400px;
  height: 400px;
  bottom: -100px;
  left: 30%;
  background: radial-gradient(circle, rgba(200, 162, 78, 0.15) 0%, transparent 70%);
  animation-delay: -8s;
  animation-duration: 18s;
}

@keyframes auroraFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-20px, 15px) scale(0.95); }
}

/* ============================================
   AUTH VIEW
   ============================================ */

.auth-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  z-index: 1;
}

.auth-brand {
  text-align: center;
  margin-bottom: 2.5rem;
}

.auth-tagline {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.5rem;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-card);
}

/* Auth Tabs */
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-default);
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition);
  position: relative;
}

.auth-tab::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-accent);
  transform: scaleX(0);
  transition: transform var(--transition);
  border-radius: 1px;
}

.auth-tab:hover { color: var(--text-primary); }

.auth-tab.active {
  color: var(--text-primary);
}

.auth-tab.active::after {
  transform: scaleX(1);
}

/* Auth Forms */
.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

/* ============================================
   LOGO
   ============================================ */

.logo {
  display: inline-flex;
  align-items: baseline;
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  user-select: none;
}

.logo-three {
  background: var(--gradient-fire);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
}

.logo-text {
  color: var(--text-primary);
}

.logo-sm {
  font-size: 1.35rem;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */

.form-group {
  margin-bottom: 1.25rem;
}

.form-group-inline {
  margin-bottom: 0;
  flex: 1;
  min-width: 0;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  line-height: 1.5;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-tertiary);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted), 0 0 20px rgba(200, 162, 78, 0.06);
}

.form-select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6580' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
}

.form-select option {
  background: var(--bg-surface-solid);
  color: var(--text-primary);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 0.375rem;
}

/* Password Wrapper */
.password-wrapper {
  position: relative;
}

.password-wrapper .form-input {
  padding-right: 2.75rem;
}

.password-toggle {
  position: absolute;
  right: 0.625rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition);
  border-radius: var(--radius-sm);
}

.password-toggle:hover {
  color: var(--text-secondary);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
  line-height: 1.4;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: var(--gradient-fire);
  color: #1a1530;
  font-weight: 600;
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent 50%);
  opacity: 0;
  transition: opacity var(--transition);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 24px rgba(200, 162, 78, 0.3), 0 0 40px rgba(200, 162, 78, 0.1);
}

.btn-primary:hover:not(:disabled)::before {
  opacity: 1;
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.btn-icon {
  padding: 0.5rem;
  border: none;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 0.9375rem;
}

.btn-full {
  width: 100%;
}

/* ============================================
   APP HEADER
   ============================================ */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 56px;
  border-bottom: 1px solid var(--border-default);
  background: rgba(8, 7, 14, 0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-model-select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-family: var(--font-sans);
  cursor: pointer;
  outline: none;
  transition: all var(--transition);
  max-width: 160px;
}

.header-model-select:hover {
  border-color: rgba(255, 180, 50, 0.4);
  background: rgba(255, 255, 255, 0.08);
}

.header-model-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 180, 50, 0.15);
}

.header-model-select option {
  background: #1a1a2e;
  color: var(--text-primary);
}

#settings-btn {
  color: var(--text-tertiary);
  border-radius: var(--radius-md);
}

#settings-btn:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

/* User Menu */
.user-menu {
  position: relative;
}

.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.875rem;
}

.user-menu-trigger:hover {
  background: var(--bg-elevated);
  border-color: var(--border-default);
  color: var(--text-primary);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gradient-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.user-avatar-lg {
  width: 36px;
  height: 36px;
  font-size: 0.875rem;
}

#user-display-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Dropdown */
.dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 240px;
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 0.5rem;
  display: none;
  z-index: 200;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 1px rgba(120, 100, 180, 0.3);
  animation: dropdownIn 0.15s ease;
}

@keyframes dropdownIn {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dropdown.show {
  display: block;
}

.dropdown-header {
  padding: 0.75rem;
}

.dropdown-user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dropdown-username {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.dropdown-email {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 0.125rem;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-default);
  margin: 0.25rem 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}

.dropdown-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* ============================================
   APP MAIN
   ============================================ */

.app-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* App Background */
#app-view {
  background:
    var(--gradient-aurora-1),
    var(--gradient-aurora-2),
    var(--gradient-aurora-3),
    var(--bg-primary);
  min-height: 100vh;
}

/* Create Section */
.create-section {
  margin-bottom: 3rem;
}

.create-card {
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.create-header {
  padding: 1.5rem 1.5rem 0;
}

.create-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.create-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.create-body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.create-options {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

/* ============================================
   HISTORY SECTION
   ============================================ */

.history-section {
  animation: fadeIn 0.3s ease;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.section-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

/* Image Card */
.image-card {
  position: relative;
  background: var(--bg-surface);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
}

.image-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4), 0 0 1px rgba(168, 85, 247, 0.3);
}

.image-card-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: var(--bg-elevated);
}

.image-card-info {
  padding: 0.75rem;
}

.image-card-prompt {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.image-card-time {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  margin-top: 0.375rem;
}

.image-card-actions {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity var(--transition);
}

.image-card:hover .image-card-actions {
  opacity: 1;
}

.image-card-action-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 7, 14, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(120, 100, 180, 0.2);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition);
}

.image-card-action-btn:hover {
  background: rgba(8, 7, 14, 0.9);
  border-color: rgba(168, 85, 247, 0.4);
}

.image-card-action-btn.delete:hover {
  background: var(--danger);
  border-color: var(--danger);
}

/* ============================================
   MODAL
   ============================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 7, 14, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 2rem;
}

.modal-overlay.show {
  display: flex;
  animation: fadeIn 0.25s ease;
}

.modal {
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5), 0 0 1px rgba(120, 100, 180, 0.3);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-default);
}

.modal-title {
  font-size: 1.0625rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0.375rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

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

.modal-close-float {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  background: rgba(8, 7, 14, 0.6);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(120, 100, 180, 0.2);
}

.modal-close-float:hover {
  background: rgba(8, 7, 14, 0.85);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-default);
}

/* Image Preview Modal */
.modal-image-preview {
  max-width: 800px;
  position: relative;
}

.modal-image-body {
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
}

.preview-image {
  max-width: 100%;
  max-height: 65vh;
  object-fit: contain;
  display: block;
}

.preview-prompt {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
  flex: 1;
  margin-right: 1rem;
}

.preview-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Model Input Group */
.model-input-group {
  display: flex;
  gap: 0.5rem;
}

.model-input-group .form-select {
  flex: 0 0 auto;
  width: auto;
  min-width: 140px;
}

.model-input-group .form-input {
  flex: 1;
  min-width: 0;
}

/* ============================================
   LOADING OVERLAY
   ============================================ */

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 7, 14, 0.85);
  backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.loading-overlay.show {
  display: flex;
  animation: fadeIn 0.3s ease;
}

.loading-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.loading-spinner-ring {
  position: relative;
  width: 80px;
  height: 80px;
}

.loading-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
}

.loading-ring:nth-child(1) {
  border-top-color: #c8a24e;
  border-right-color: rgba(200, 162, 78, 0.3);
  animation: loadingSpin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.loading-ring:nth-child(2) {
  inset: 8px;
  border-bottom-color: #a855f7;
  border-left-color: rgba(168, 85, 247, 0.3);
  animation: loadingSpin 1.5s cubic-bezier(0.5, 0, 0.5, 1) infinite reverse;
}

.loading-ring:nth-child(3) {
  inset: 16px;
  border-top-color: #6c5ce7;
  border-right-color: rgba(108, 92, 231, 0.3);
  animation: loadingSpin 1.8s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

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

.loading-text {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.loading-subtext {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  animation: loadingPulse 2s ease-in-out infinite;
}

@keyframes loadingPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ============================================
   NOTIFICATIONS
   ============================================ */

#notification-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.notification {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 1rem;
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-primary);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: slideInRight 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: auto;
  max-width: 360px;
}

.notification.success { border-left: 3px solid var(--success); }
.notification.error { border-left: 3px solid var(--danger); }
.notification.info { border-left: 3px solid var(--accent); }

.notification-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.notification.success .notification-icon { color: var(--success); }
.notification.error .notification-icon { color: var(--danger); }
.notification.info .notification-icon { color: var(--accent); }

.notification.removing {
  animation: slideOutRight 0.3s ease forwards;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100%); }
}

/* ============================================
   UTILITIES
   ============================================ */

.text-danger {
  color: var(--danger) !important;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 640px) {
  .app-header {
    padding: 0 1rem;
  }

  .app-main {
    padding: 1.25rem 1rem;
  }

  .create-header {
    padding: 1.25rem 1.25rem 0;
  }

  .create-body {
    padding: 1rem 1.25rem 1.25rem;
  }

  .create-options {
    flex-direction: column;
    gap: 0.75rem;
  }

  .history-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
  }

  .modal-overlay {
    padding: 1rem;
  }

  .modal-footer {
    flex-direction: column;
  }

  .preview-prompt {
    margin-right: 0;
    margin-bottom: 0.75rem;
  }

  .preview-actions {
    width: 100%;
  }

  .preview-actions .btn {
    flex: 1;
  }

  #user-display-name {
    display: none;
  }

  .model-input-group {
    flex-direction: column;
  }

  .model-input-group .form-select {
    width: 100%;
  }

  .auth-card {
    padding: 1.5rem;
  }

  .aurora {
    filter: blur(60px);
    opacity: 0.4;
  }

  .aurora-1 { width: 400px; height: 400px; }
  .aurora-2 { width: 350px; height: 350px; }
  .aurora-3 { width: 300px; height: 300px; }
}

/* ============================================
   Reference Image Upload
   ============================================ */

.reference-upload {
  position: relative;
  width: 100%;
  height: 100px;
  border: 2px dashed rgba(120, 100, 180, 0.25);
  border-radius: 14px;
  background: rgba(18, 16, 30, 0.4);
  cursor: pointer;
  transition: all var(--transition);
  overflow: hidden;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reference-upload:hover,
.reference-upload.drag-over {
  border-color: var(--accent);
  background: rgba(249, 115, 22, 0.05);
}

.reference-upload.has-image {
  border-style: solid;
  border-color: rgba(120, 100, 180, 0.2);
  cursor: default;
}

.reference-file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.reference-upload.has-image .reference-file-input {
  cursor: default;
}

.reference-upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  color: var(--text-secondary);
  pointer-events: none;
  width: 100%;
  height: 100%;
}

.reference-upload-placeholder svg {
  color: var(--accent);
  opacity: 0.6;
}

.reference-upload-text {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary);
}

.reference-upload-hint {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.reference-upload-preview {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  pointer-events: none;
}

.reference-upload-preview img {
  max-height: 160px;
  max-width: 100%;
  border-radius: 10px;
  object-fit: contain;
  pointer-events: none;
}

.reference-remove-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 7, 14, 0.8);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(120, 100, 180, 0.2);
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  pointer-events: all;
  transition: all var(--transition);
  z-index: 3;
}

.reference-remove-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

/* new-api 集成提示条 */
.new-api-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: rgba(108, 92, 231, 0.12);
  border-bottom: 1px solid rgba(108, 92, 231, 0.2);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.new-api-banner svg {
  color: #a855f7;
  flex-shrink: 0;
}

.new-api-banner strong {
  color: var(--text-primary);
  font-weight: 600;
}
