/* Generated image responsive sizing per aspect bucket */
.generated-result { width: 100%; }
.generated-image-container { max-width: 100%; }

/* Landscape 16:9 (default) */
.generated-result.aspect-16-9 .generated-image {
  width: 100%;
  height: auto;
}

/* Portrait 9:16 (very tall) */
.generated-result.aspect-9-16 .generated-image {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 90vh; /* viewport-based cap */
  object-fit: contain;
}

/* Square 1:1 */
.generated-result.aspect-1-1 .generated-image {
  width: 70%;
  height: auto;
}

/* Portrait 4:5 (less tall than 9:16) */
.generated-result.aspect-4-5 .generated-image {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
}

/* Small screens: relax max widths and caps */
@media (max-width: 640px) {
  .generated-result.aspect-16-9 .generated-image { max-width: 100%; }
  .generated-result.aspect-1-1 .generated-image { max-width: 92vw; }
  .generated-result.aspect-9-16 .generated-image { max-height: 65vh; }
  .generated-result.aspect-4-5 .generated-image { max-height: 75vh; }
}

/* Generated image action buttons (align with recreate styling) */
.image-action-buttons .download-btn:hover,
.image-action-buttons .edit-btn:hover {
  transform: translateY(-2px);
}

/* Mobile: stack action buttons vertically */
@media (max-width: 768px) {
  .image-action-buttons {
    flex-direction: column !important;
    gap: 8px !important;
  }
  .image-action-buttons .download-btn,
  .image-action-buttons .edit-btn {
    width: 100%;
    justify-content: center !important;
    text-align: center !important;
    align-items: center !important;
  }
}
/* Text Mode-specific styles */

/* Fixed footer positioning for text mode */
.text-mode .input-bar {
    position: fixed;
    bottom: 0;
    left: 260px; /* Updated to match new sidebar width */
    right: 0;
    z-index: 50;
    margin: 0;
    padding: 0.75rem 1.5rem; /* Reduced from 1.75rem 2rem */
}

/* Adjust chat area to account for fixed footer */
.text-mode .chat-area {
    padding-bottom: 250px; 
    height: calc(100vh - 250px);
    overflow-y: auto;
}

/* Enhanced style dropdown styling for text mode */
.text-mode .style-dropdown-btn {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 215, 0, 0.05) 100%);
    border: 2px solid rgba(255, 215, 0, 0.4);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
    min-height: 45px; /* match edits */
    min-width: 120px; /* parity baseline */
    padding: 0.6rem 1rem; /* compact */
    color: #FFD700;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: row; /* icon + text on same line */
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    text-decoration: none;
}

.text-mode .style-dropdown-btn:hover {
    border-color: #FFD700;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.4);
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 215, 0, 0.1) 100%);
}

/* Style dropdown menu */
.text-mode .style-dropdown {
    position: relative;
    display: inline-block;
}

/* Match edits layout: grid areas for footer */
.text-mode .input-container {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  gap: 0rem 1.5rem;
  align-items: start;
  grid-template-areas:
    "mode mode mode"
    "style textarea generate";
}

.text-mode .mode-dropdown-section { grid-area: mode; justify-self: center; }
.text-mode .style-dropdown-section { grid-area: style; }
.text-mode .text-input-section { grid-area: textarea; }
.text-mode .generate-section { grid-area: generate; }

/* Stack aspect + style vertically by default */
.text-mode .style-dropdown-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

.text-mode .aspect-dropdown {
    position: relative;
    display: inline-block;
    margin-left: 0;
}

.text-mode .aspect-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.12) 0%, rgba(255, 215, 0, 0.06) 100%);
    border: 2px solid rgba(255, 215, 0, 0.35);
    border-radius: 0.75rem;
    color: #FFD700;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 45px; /* match edits */
    min-width: 120px; /* parity baseline */
    justify-content: center;
    text-align: center;
}

.text-mode .aspect-dropdown-btn:hover {
    border-color: #FFD700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.35);
}

.text-mode .aspect-dropdown-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.95) 0%, rgba(42, 42, 42, 0.95) 100%);
    border: 2px solid rgba(255, 215, 0, 0.4);
    border-radius: 0.75rem;
    box-shadow: 0 0 24px rgba(255, 215, 0, 0.25);
    margin-bottom: 0.5rem;
    backdrop-filter: blur(10px);
    display: none;
    z-index: 100;
    min-width: 180px;
}

.text-mode .aspect-dropdown-menu.show { display: block; animation: dropdownSlideUp 0.25s ease-out; }

.text-mode .aspect-option {
    padding: 0.85rem 1rem;
    color: #ccc;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255, 215, 0, 0.12);
    font-weight: 500;
}

.text-mode .aspect-option:last-child { border-bottom: none; border-radius: 0 0 0.75rem 0.75rem; }
.text-mode .aspect-option:first-child { border-radius: 0.75rem 0.75rem 0 0; }
.text-mode .aspect-option:hover { background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 215, 0, 0.05) 100%); color: #FFD700; }
.text-mode .aspect-option.selected { background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 215, 0, 0.1) 100%); color: #FFD700; font-weight: 700; border-left: 4px solid #FFD700; }

.text-mode .style-dropdown-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.95) 0%, rgba(42, 42, 42, 0.95) 100%);
    border: 2px solid rgba(255, 215, 0, 0.4);
    border-radius: 1rem;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
    margin-bottom: 0.5rem;
    backdrop-filter: blur(10px);
    display: none;
    z-index: 100;
}

.text-mode .style-dropdown-menu.show {
    display: block;
    animation: dropdownSlideUp 0.3s ease-out;
}

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

.text-mode .style-option {
    padding: 1rem 1.5rem;
    color: #ccc;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(255, 215, 0, 0.1);
    font-weight: 500;
}

.text-mode .style-option:last-child {
    border-bottom: none;
    border-radius: 0 0 1rem 1rem;
}

.text-mode .style-option:first-child {
    border-radius: 1rem 1rem 0 0;
}

.text-mode .style-option:hover {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 215, 0, 0.05) 100%);
    color: #FFD700;
}

.text-mode .style-option.selected {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 215, 0, 0.1) 100%);
    color: #FFD700;
    font-weight: 600;
    border-left: 4px solid #FFD700;
    box-shadow: inset 0 0 20px rgba(255, 215, 0, 0.2);
}

/* Enhanced textarea styling for text mode */
.text-mode .message-textarea {
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.9) 0%, rgba(42, 42, 42, 0.9) 100%);
    border: 2px solid rgba(255, 215, 0, 0.4);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.1);
    min-height: 90px; /* Reduced from 100px */
    padding: 1rem; /* Reduced from 1.25rem */
}

.text-mode .message-textarea:focus {
    border-color: #FFD700;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.3);
}

/* Enhanced generate button for text mode */
.text-mode .generate-btn {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
    animation: textButtonGlow 2s ease-in-out infinite alternate;
    min-height: 90px; /* desktop */
    font-size: 0.9rem;
    min-width: 90px; /* Reduced from 120px */
    padding: 0.5rem 0.75rem; /* Reduced from 1.25rem 2rem */
}

/* Inline credits label under the generate button title (match edits) */
.text-mode .generate-btn .credits-inline {
    display: block;
    margin-top: 1px;
    font-size: 11px;
    line-height: 1;
    font-weight: 700;
    color: #1a1a1a;
    opacity: 0.95;
}

/* Ensure generate button stacks text + credits vertically */
.text-mode .generate-btn { display: inline-flex; flex-direction: column; align-items: center; }
.text-mode .generate-btn .generate-top { display: inline-flex; align-items: center; gap: 0.2rem; line-height: 1.1; }

.text-mode .generate-btn:hover {
    box-shadow: 0 15px 50px rgba(255, 215, 0, 0.5);
    animation: none;
}

/* Special welcome message styling for text mode */
.text-mode .welcome-message .message-text {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.12) 0%, rgba(255, 215, 0, 0.06) 100%);
    border: 2px solid rgba(255, 215, 0, 0.4);
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.25);
}
/* Make welcome text smaller on desktop */
/* Remove any heading-specific overrides; using divs like edits page */

/* Welcome text styling to mirror edits page */
.text-mode .welcome-main-text {
  font-size: 1.1rem;
  line-height: 1.6;
  font-weight: 600;
  color: #ffec7e;
  margin-bottom: 0.3rem;
  margin-top: 0.3rem;
}

.text-mode .welcome-sub-text {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #ededca;
  margin-left: 1rem;
  margin-bottom: 0.3rem;
}

/* Text-specific animations */
@keyframes textButtonGlow {
    0% {
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
    }
    100% {
        box-shadow: 0 0 40px rgba(255, 215, 0, 0.4);
    }
}

/* Unauth/plan/credits modals (copied from edits to mirror styling) */
.unauth-generate-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.unauth-generate-modal.active { opacity: 1; visibility: visible; }

.unauth-generate-modal-content {
  background: linear-gradient(135deg, rgba(26, 26, 26, 0.98) 0%, rgba(42, 42, 42, 0.98) 100%);
  border-radius: 20px;
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.18), 0 0 60px rgba(255, 215, 0, 0.08);
  max-width: 460px; width: 90%; max-height: 80vh; overflow-y: auto;
  transform: translateY(30px) scale(0.95);
  transition: all 0.3s ease;
  border: 2px solid rgba(255, 215, 0, 0.3);
}
.unauth-generate-modal.active .unauth-generate-modal-content { transform: translateY(0) scale(1); }

.unauth-generate-modal-header { display: flex; justify-content: flex-end; padding: 20px 20px 0 20px; }
.unauth-generate-modal-close {
  background: rgba(255, 215, 0, 0.12);
  border: 1px solid rgba(255, 215, 0, 0.35);
  border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 18px; color: #FFD700; transition: all 0.2s ease; box-shadow: 0 0 10px rgba(255, 215, 0, 0.25);
}
.unauth-generate-modal-close:hover { background: rgba(255, 215, 0, 0.2); color: #1a1a1a; transform: scale(1.1); }
.unauth-generate-modal-body { padding: 0 30px 30px 30px; text-align: center; }
.unauth-generate-modal-icon {
  margin: 0 auto 20px auto; width: 80px; height: 80px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%); color: #1a1a1a; box-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
}
.unauth-generate-modal-title { color: #FFD700; text-shadow: 0 0 12px rgba(255, 215, 0, 0.6); font-size: 22px; font-weight: 700; margin: 0 0 12px 0; line-height: 1.3; }
.unauth-generate-modal-message { color: #e5e7eb; font-size: 16px; line-height: 1.5; margin: 0 0 30px 0; opacity: 0.9; }
.unauth-generate-modal-buttons { display: flex; gap: 12px; justify-content: center; }
.unauth-generate-modal-btn {
  padding: 12px 24px; border-radius: 12px; font-weight: 700; font-size: 15px; text-decoration: none; transition: all 0.2s ease; border: 2px solid transparent;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; min-width: 120px;
}
.unauth-generate-modal-login { background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%); color: #1a1a1a; box-shadow: 0 8px 24px rgba(255, 215, 0, 0.35); }
.unauth-generate-modal-login:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(255, 215, 0, 0.5); color: #1a1a1a; }
.unauth-generate-modal-signup { background: transparent; color: #FFD700; border-color: rgba(255, 215, 0, 0.35); box-shadow: 0 0 16px rgba(255, 215, 0, 0.15); }
.unauth-generate-modal-signup:hover { background: rgba(255, 215, 0, 0.1); border-color: rgba(255, 215, 0, 0.55); transform: translateY(-2px); box-shadow: 0 0 24px rgba(255, 215, 0, 0.25); color: #FFD700; }

/* Credit Balance Pill */
.credit-balance-pill {
  position: absolute; top: 20px; right: 20px; z-index: 1000;
  background: linear-gradient(135deg, #facc15 0%, #fbbf24 100%);
  color: #1f2937; padding: 8px 16px; border-radius: 20px; font-weight: 600; font-size: 14px;
  box-shadow: 0 4px 16px rgba(251, 191, 36, 0.4), 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2); backdrop-filter: blur(10px);
  display: flex; align-items: center; gap: 6px;
}

/* Generation modal and progress (mirror edits) */
.generation-modal {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px); z-index: 9999; display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: all 0.4s ease;
}
.generation-modal.active { opacity: 1; visibility: visible; }
.generation-modal-content { text-align: center; transform: scale(0.8) rotate(-5deg); transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); max-width: 90vw; padding: 2rem; }
.generation-modal.active .generation-modal-content { transform: scale(1) rotate(0deg); }

.generation-loader { position: relative; width: 120px; height: 120px; margin: 0 auto 2rem; }
.loader-ring { position: absolute; border: 3px solid transparent; border-radius: 50%; animation: spin 2s linear infinite; }
.loader-ring:nth-child(1) { width: 120px; height: 120px; border-top: 3px solid #FFD700; border-right: 3px solid #FFD700; animation-duration: 2s; }
.loader-ring:nth-child(2) { width: 90px; height: 90px; top: 15px; left: 15px; border-bottom: 3px solid #FFA500; border-left: 3px solid #FFA500; animation-duration: 1.5s; animation-direction: reverse; }
.loader-ring:nth-child(3) { width: 60px; height: 60px; top: 30px; left: 30px; border-top: 3px solid #FFD700; border-right: 3px solid #FFD700; animation-duration: 1s; }

.generation-progress-container { width: 100%; max-width: 300px; margin: 1.5rem auto; background: rgba(34, 197, 94, 0.1); border-radius: 20px; padding: 4px; border: 1px solid rgba(34, 197, 94, 0.3); box-shadow: 0 0 20px rgba(34, 197, 94, 0.2); position: relative; overflow: hidden; }
.generation-progress-bar { height: 8px; background: linear-gradient(90deg, #22c55e 0%, #16a34a 25%, #15803d 50%, #166534 75%, #14532d 100%); border-radius: 16px; width: 0%; transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1); position: relative; box-shadow: 0 0 10px rgba(34, 197, 94, 0.6), 0 0 20px rgba(34, 197, 94, 0.4), 0 0 30px rgba(34, 197, 94, 0.2); }
.generation-progress-bar::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%); border-radius: 16px; animation: progressGlow 2s ease-in-out infinite; }
.generation-progress-bar.submitted { width: 25%; }
.generation-progress-bar.pending { width: 50%; }
.generation-progress-bar.processing { width: 75%; }
.generation-progress-bar.completed { width: 100%; }
.generation-progress-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 0.75rem; font-weight: 600; color: #22c55e; text-shadow: 0 0 8px rgba(34, 197, 94, 0.8); z-index: 2; opacity: 0; transition: opacity 0.3s ease; }
.generation-progress-text.show { opacity: 1; }
.generation-progress-stage { position: absolute; top: -25px; font-size: 0.7rem; color: #22c55e; font-weight: 500; opacity: 0.7; transition: all 0.3s ease; }
.generation-progress-stage.active { opacity: 1; color: #22c55e; text-shadow: 0 0 8px rgba(34, 197, 94, 0.6); font-weight: 600; }
.generation-progress-stage.completed { opacity: 1; color: #16a34a; }
.generation-progress-stage.submitted { left: 0%; }
.generation-progress-stage.pending { left: 25%; }
.generation-progress-stage.processing { left: 50%; }
.generation-progress-stage.completed { left: 75%; }

.loader-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 40px; height: 40px; background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%); border-radius: 50%; display: flex; align-items: center; justify-content: center; animation: pulse 1.5s ease-in-out infinite alternate; box-shadow: 0 0 30px rgba(255, 215, 0, 0.6); }
.loader-icon { width: 20px; height: 20px; color: #1a1a1a; animation: iconBounce 2s ease-in-out infinite; }
.loader-particle { position: absolute; width: 4px; height: 4px; background: #FFD700; border-radius: 50%; animation: float 3s ease-in-out infinite; box-shadow: 0 0 10px rgba(255, 215, 0, 0.8); }
.loader-particle:nth-child(4) { top: 10px; left: 50%; animation-delay: 0s; }
.loader-particle:nth-child(5) { top: 50%; right: 10px; animation-delay: 0.5s; }
.loader-particle:nth-child(6) { bottom: 10px; left: 50%; animation-delay: 1s; }
.loader-particle:nth-child(7) { top: 50%; left: 10px; animation-delay: 1.5s; }

.generation-message { color: #fff; font-size: 1.5rem; font-weight: 600; margin-bottom: 1rem; background: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FFD700 100%); background-size: 200% 100%; -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; animation: shimmer 2s ease-in-out infinite; }
.generation-subtitle { color: #ccc; font-size: 1.1rem; font-weight: 400; opacity: 0.9; animation: fadeInOut 2s ease-in-out infinite; }

.queue-details { margin-top: 1.5rem; margin-bottom: 1.5rem; padding: 1rem; background: rgba(255, 215, 0, 0.08); border-radius: 1rem; border: 1px solid rgba(255, 215, 0, 0.3); box-shadow: 0 0 20px rgba(255, 215, 0, 0.1); }
.queue-apology { color: #fbbf24; font-size: 0.9rem; font-weight: 400; opacity: 0.9; margin-top: 0.75rem; font-style: italic; text-align: center; }
.queue-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; text-align: center; }
.queue-stat { display: flex; flex-direction: column; gap: 0.25rem; align-items: center; }
.queue-label { font-size: 0.8rem; color: #ccc; font-weight: 400; text-transform: uppercase; letter-spacing: 0.5px; }
.queue-value { font-size: 1rem; color: #FFD700; font-weight: 600; text-shadow: 0 0 10px rgba(255, 215, 0, 0.3); }
.loading-dots { display: inline-block; margin-left: 0.5rem; }
.loading-dots span { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #FFD700; margin: 0 2px; animation: dotPulse 1.4s ease-in-out infinite both; }
.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

/* Validation overlay */
.validation-loading-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(8px);
  z-index: 10000; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: all 0.3s ease;
}
.validation-loading-overlay.active { opacity: 1; visibility: visible; }
.validation-loading-content { background: linear-gradient(135deg, rgba(26, 26, 26, 0.95) 0%, rgba(42, 42, 42, 0.95) 100%); border: 2px solid rgba(255, 215, 0, 0.35); border-radius: 16px; padding: 2rem; text-align: center; box-shadow: 0 0 30px rgba(255, 215, 0, 0.18), 0 0 60px rgba(255, 215, 0, 0.08); transform: scale(0.8); transition: transform 0.3s ease; max-width: 320px; width: 90%; }
.validation-loading-overlay.active .validation-loading-content { transform: scale(1); }
.validation-loader { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.validation-spinner { width: 48px; height: 48px; background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%); border-radius: 50%; display: flex; align-items: center; justify-content: center; animation: validationSpin 2s linear infinite; box-shadow: 0 0 25px rgba(255, 215, 0, 0.45), 0 0 50px rgba(255, 215, 0, 0.25); }
.validation-spinner svg { width: 20px; height: 20px; color: #1f2937; animation: validationPulse 1.5s ease-in-out infinite; }
.validation-message { font-size: 18px; font-weight: 600; color: #FFD700; margin: 0; text-shadow: 0 0 10px rgba(255, 215, 0, 0.6); }
.validation-submessage { font-size: 14px; color: #e5e7eb; margin: 0; opacity: 0.9; }

/* Download modal */
.download-modal { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(6px); z-index: 9999; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
.download-modal.active { opacity: 1; visibility: visible; }
.download-modal-content { text-align: center; transform: scale(0.7) translateY(30px); transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); max-width: 90vw; padding: 2rem; }
.download-modal.active .download-modal-content { transform: scale(1) translateY(0); }
.download-loader { position: relative; width: 100px; height: 100px; margin: 0 auto 2rem; }
.pulse-ring { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 40px; height: 40px; border: 3px solid #10b981; border-radius: 50%; animation: pulseRing 2s ease-out infinite; }
.pulse-ring:nth-child(1) { animation-delay: 0s; }
.pulse-ring:nth-child(2) { animation-delay: 0.4s; }
.pulse-ring:nth-child(3) { animation-delay: 0.8s; }
.download-icon { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 32px; height: 32px; background: linear-gradient(135deg, #10b981 0%, #059669 100%); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; animation: downloadIconBounce 1.5s ease-in-out infinite; box-shadow: 0 0 20px rgba(16, 185, 129, 0.4); }
.download-icon svg { width: 18px; height: 18px; }
.download-message { color: #fff; font-size: 1.4rem; font-weight: 600; margin-bottom: 0.8rem; background: linear-gradient(135deg, #10b981 0%, #34d399 50%, #10b981 100%); background-size: 200% 100%; -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; animation: downloadShimmer 2.5s ease-in-out infinite; }
.download-subtitle { color: #d1d5db; font-size: 1rem; font-weight: 400; opacity: 0.9; animation: downloadFadeInOut 2s ease-in-out infinite; }
.download-dots { display: inline-block; margin-left: 0.5rem; }
.download-dots span { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #10b981; margin: 0 2px; animation: downloadDotPulse 1.2s ease-in-out infinite both; }
.download-dots span:nth-child(1) { animation-delay: -0.24s; }
.download-dots span:nth-child(2) { animation-delay: -0.12s; }
.download-dots span:nth-child(3) { animation-delay: 0s; }

/* User Request Card (mirror edits) */
.user-message .user-request-card { background: linear-gradient(135deg, rgba(26, 26, 26, 0.9) 0%, rgba(42, 42, 42, 0.9) 100%); border: 1.5px solid rgba(255, 215, 0, 0.35); border-radius: 14px; padding: 0.9rem 1rem; box-shadow: 0 6px 24px rgba(255, 215, 0, 0.12), inset 0 0 0 1px rgba(255, 215, 0, 0.12); }
.user-request-card .request-header { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.4rem; margin-bottom: 0.6rem; }
.user-request-card .request-title { color: #ffec7e; font-weight: 800; letter-spacing: 0.2px; text-align: center; }
.user-request-card .request-badges { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: center; }
.user-request-card .badge { padding: 0.18rem 0.5rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; border: 1px solid transparent; white-space: nowrap; }
.badge-cost { color: #1a1a1a; background: linear-gradient(135deg, #fde68a, #fbbf24); }
.user-request-card .request-body .row { display: grid; grid-template-columns: 88px 1fr; gap: 0.6rem; align-items: center; padding: 0.35rem 0; border-top: 1px dashed rgba(255, 215, 0, 0.18); }
.user-request-card .request-body .row:first-child { border-top: 0; }
.user-request-card .label { color: #fcd34d; font-size: 0.9rem; font-weight: 600; }
.user-request-card .value { color: #f3f4f6; }
.user-request-card .desc { background: rgba(255, 215, 0, 0.06); border: 1px solid rgba(255, 215, 0, 0.18); border-radius: 10px; padding: 0.55rem 0.7rem; line-height: 1.45; color: #ededca; display: flex; align-items: center; min-height: 38px; font-size: 0.9rem; white-space: normal; word-break: break-word; overflow-wrap: anywhere; }

/* Keyframes copied to match edits */
@keyframes spin { 0% { transform: rotate(0deg);} 100% { transform: rotate(360deg);} }
@keyframes progressGlow { 0% { opacity: 0.3; transform: translateX(-100%);} 50% { opacity: 0.6; transform: translateX(100%);} 100% { opacity: 0.3; transform: translateX(-100%);} }
@keyframes pulse { 0% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);} 100% { transform: translate(-50%, -50%) scale(1.1); box-shadow: 0 0 50px rgba(255, 215, 0, 0.8);} }
@keyframes iconBounce { 0%,100% { transform: translateY(0);} 50% { transform: translateY(-5px);} }
@keyframes float { 0%,100% { transform: translateY(0) scale(1); opacity:1;} 50% { transform: translateY(-20px) scale(1.2); opacity:.7;} }
@keyframes shimmer { 0% { background-position: -200% 0;} 100% { background-position: 200% 0;} }
@keyframes fadeInOut { 0%,100% { opacity:.9;} 50% { opacity:.6;} }
@keyframes dotPulse { 0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; } 40% { transform: scale(1.2); opacity: 1; } }
@keyframes validationSpin { from { transform: rotate(0deg);} to { transform: rotate(360deg);} }
@keyframes validationPulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.1); opacity: 0.8; } }
@keyframes pulseRing { 0% { transform: translate(-50%, -50%) scale(0.8); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; } }
@keyframes downloadIconBounce { 0%, 100% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 20px rgba(16, 185, 129, 0.4); } 50% { transform: translate(-50%, -50%) scale(1.1); box-shadow: 0 0 30px rgba(16, 185, 129, 0.6); } }
@keyframes downloadShimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes downloadFadeInOut { 0%, 100% { opacity: 0.9; } 50% { opacity: 0.6; } }
@keyframes downloadDotPulse { 0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; } 40% { transform: scale(1.3); opacity: 1; } }

/* Plan upgrade modal overrides */
#planUpgradeModal.unauth-generate-modal { background: rgba(0,0,0,0.85); }
#planUpgradeModal .unauth-generate-modal-content { background: linear-gradient(135deg, rgba(26,26,26,0.98) 0%, rgba(42,42,42,0.98) 100%); border: 2px solid rgba(255,215,0,0.4); box-shadow: 0 0 30px rgba(255,215,0,0.22), 0 0 60px rgba(255,215,0,0.12); }
#planUpgradeModal .unauth-generate-modal-title { color: #FFD700; }
#planUpgradeModal .unauth-generate-modal-message { color: #e5e7eb; }
#planUpgradeModal .unauth-generate-modal-login,
#planUpgradeModal .unauth-generate-modal-signup { background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%); color: #1a1a1a; border-color: rgba(255,215,0,0.35); }

/* Mode dropdown styling for text mode */
.mode-dropdown-section {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.mode-dropdown {
    position: relative;
    display: inline-block;
}

.mode-dropdown-btn {
    display: inline-block;
    padding: 0.6rem 1.25rem;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 215, 0, 0.1) 100%);
    border: 2px solid #FFD700;
    border-radius: 0.75rem;
    color: #FFD700;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
    animation: modeGlow 2s ease-in-out infinite alternate;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-dropdown-btn:hover {
    border-color: #FFD700;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 215, 0, 0.15) 100%);
}

.mode-dropdown-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.95) 0%, rgba(42, 42, 42, 0.95) 100%);
    border: 2px solid rgba(255, 215, 0, 0.4);
    border-radius: 1rem;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
    margin-bottom: 0.5rem;
    backdrop-filter: blur(10px);
    display: none;
    z-index: 100;
    min-width: 150px;
}

.mode-dropdown-menu.show {
    display: block;
    animation: dropdownSlideUp 0.3s ease-out;
}

.mode-option {
    padding: 1rem 1.5rem;
    color: #ccc;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(255, 215, 0, 0.1);
    font-weight: 500;
}

.mode-option:last-child {
    border-bottom: none;
    border-radius: 0 0 1rem 1rem;
}

.mode-option:first-child {
    border-radius: 1rem 1rem 0 0;
}

.mode-option:hover {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 215, 0, 0.05) 100%);
    color: #FFD700;
}

.mode-option.selected {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 215, 0, 0.1) 100%);
    color: #FFD700;
    font-weight: 600;
    border-left: 4px solid #FFD700;
    box-shadow: inset 0 0 20px rgba(255, 215, 0, 0.2);
}

@keyframes modeGlow {
    0% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
    }
    100% {
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
    }
}

/* Responsive adjustments for text mode (match edits) */
@media (max-width: 1024px) {
    .text-mode .input-bar {
        left: 260px; /* Account for sidebar being open on tablet */
        right: 0; /* Constrain the width */
        width: calc(100vw - 260px); /* Explicitly set width to available space */
        padding: 1rem;
    }
    
    .text-mode .chat-area {
        padding-bottom: 300px; /* Increased for tablet layout */
        height: calc(100vh - 300px);
    }
    
    /* Match edits tablet layout */
    .text-mode .input-container {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: auto auto auto;
        gap: 1rem;
        grid-template-areas:
          "mode mode mode"
          "textarea textarea textarea"
          "style style generate";
    }
    .text-mode .mode-dropdown-section { grid-area: mode; justify-self: center; }
    .text-mode .text-input-section { grid-area: textarea; width: 100%; }
    .text-mode .style-dropdown-section { 
        grid-area: style; 
        display: grid; 
        grid-template-columns: 1fr 1fr; 
        gap: 1rem; 
        align-items: stretch;
    }
    .text-mode .generate-section { grid-area: generate; }
    
    /* Match edits tablet control sizing: all three same height */
    .text-mode .style-dropdown-btn,
    .text-mode .aspect-dropdown-btn,
    .text-mode .generate-btn { width: 100%; min-width: auto; min-height: 70px; padding: 0.75rem; font-size: 0.875rem; gap: 0.5rem; }
    .text-mode .message-textarea { min-height: 80px; padding: 1rem; font-size: 0.875rem; }
    
    /* Tablet mode dropdown styling */
    .mode-dropdown-btn {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
    
    .mode-dropdown-menu {
        left: -50%;
        right: -50%;
        min-width: 150px;
    }

    .text-mode .welcome-message .message-text h3 {
        font-size: 1rem;
    }

    .text-mode .welcome-main-text { font-size: 1rem; margin-top: 0.25rem; }
    .text-mode .welcome-sub-text { font-size: 0.9rem; }
    
    /* Tablet dropdown adjustments */
    .text-mode .style-dropdown-menu {
        left: 0;
        right: 0;
        min-width: 200px;
    }
}

@media (max-width: 768px) {
    .text-mode .input-bar {
        left: 0; /* No sidebar offset on mobile */
        right: 0; /* Use full width */
        width: 100vw; /* Use full viewport width on mobile */
        padding: 1rem;
    }
    
    .text-mode .chat-area {
        padding-bottom: 350px; /* Increased for mobile layout */
        height: calc(100vh - 350px);
    }
    
    /* Match edits mobile layout */
    .text-mode .input-container {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: auto auto auto;
        gap: 1rem;
        grid-template-areas:
          "mode mode mode"
          "textarea textarea textarea"
          "style style generate";
    }
    .text-mode .mode-dropdown-section { grid-area: mode; justify-self: center; }
    .text-mode .text-input-section { grid-area: textarea; width: 100%; }
    .text-mode .style-dropdown-section { 
        grid-area: style; 
        display: grid; 
        grid-template-columns: 1fr 1fr; 
        gap: 1rem; 
        align-items: stretch;
    }
    .text-mode .generate-section { grid-area: generate; }
    
    /* Match edits mobile control sizing: all three same height */
    .text-mode .style-dropdown-btn,
    .text-mode .aspect-dropdown-btn,
    .text-mode .generate-btn { width: 100%; min-width: auto; min-height: 70px; padding: 0.75rem; font-size: 0.875rem; gap: 0.5rem; }
    .text-mode .message-textarea { min-height: 80px; padding: 1rem; font-size: 0.875rem; }
    
    /* Mobile mode dropdown styling */
    .mode-dropdown-btn {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
    
    .mode-dropdown-menu {
        left: -50%;
        right: -50%;
        min-width: 150px;
    }

    .text-mode .welcome-message .message-text h3 {
        font-size: 1rem;
    }

    .text-mode .welcome-main-text { font-size: 1rem; margin-top: 0.25rem; }
    .text-mode .welcome-sub-text { font-size: 0.9rem; }
    
    /* Mobile dropdown adjustments */
    .text-mode .style-dropdown-menu {
        left: 0;
        right: 0;
        min-width: 200px;
    }
}

@media (max-width: 480px) {
    .text-mode .input-bar {
        padding: 0.75rem;
    }
    
    .text-mode .chat-area {
        padding-bottom: 400px;
        height: calc(100vh - 400px);
    }
    
    /* Credit pill parity with edits on small phones */
    .text-mode .credit-balance-pill {
        top: 10px;
        right: 10px;
        padding: 5px 10px;
        font-size: 11px;
        border-radius: 14px;
        gap: 4px;
    }

    /* Reduce gap between mode dropdown and next row */
    .text-mode .mode-dropdown-section {
        margin-bottom: 0.3rem;
    }

    /* Ensure exact same height on small phones */
    .text-mode .style-dropdown-btn,
    .text-mode .aspect-dropdown-btn,
    .text-mode .generate-btn { min-height: 70px; padding: 0.5rem; font-size: 0.8rem; }
    
    .text-mode .message-textarea {
        min-height: 70px;
        padding: 0.875rem;
        font-size: 0.8rem;
    }

    .text-mode .welcome-message .message-text h3 {
        font-size: 0.85rem;
      }
    .text-mode .welcome-main-text { font-size: 0.95rem; }
    .text-mode .welcome-sub-text { font-size: 0.85rem; }
} 

/* Remove desktop-specific overrides now that defaults handle stacking/compact */