/* Top Navigation Bar */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  z-index: 1003;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
}

.nav-logo img {
  width: 100px;
  height: 42px;
}

/* Sidebar Toggle Button - Always visible in header */
.sidebar-toggle {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 14px;
}

.sidebar-toggle:hover {
  background: var(--border-color);
  border-color: #8b5cf6;
  color: var(--text-primary);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Authentication Buttons (for non-logged in users) */
.auth-buttons {
  display: flex;
  gap: 0.5rem;
}

.btn-login,
.btn-signup {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
}

.btn-login {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-login:hover {
  color: var(--text-primary);
  border-color: #8b5cf6;
}

.btn-signup {
  background: var(--primary-gradient);
  color: white;
}

.btn-signup:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

/* User Profile Dropdown */
.user-profile {
  position: relative;
  display: none;
}

.user-profile.show {
  display: block;
}

.profile-trigger {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 8px 12px;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.profile-trigger:hover {
  border-color: #8b5cf6;
  background: var(--border-color);
}

.profile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 14px;
}

.profile-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.profile-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.2;
}

.profile-role {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.2;
}

.profile-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  min-width: 200px;
  z-index: 1004;
  display: none;
}

.profile-dropdown.show {
  display: block;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 12px 16px;
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.2s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.dropdown-item:hover {
  background: var(--input-bg);
  color: var(--text-primary);
}

.dropdown-item i {
  width: 16px;
  color: var(--text-secondary);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

/* Sidebar Styles */
.sidebar {
  position: fixed;
  top: 60px;
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - 60px);
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform 0.3s ease;
}

.sidebar.collapsed {
  transform: translateX(-100%);
}

.sidebar-content {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
}

.sidebar-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 1rem;
}

.sidebar-btn:hover {
  background: var(--input-bg);
  border-color: #8b5cf6;
}

.new-chat-btn {
  background: var(--primary-gradient);
  border: none;
  color: white;
}

.new-chat-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.sidebar-section {
  margin-top: 2rem;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 1rem;
}

.sidebar-history {
  max-height: 400px;
  overflow-y: auto;
}

.history-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  color: var(--text-secondary);
  font-size: 13px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  position: relative;
  padding-right: 32px;
}

.history-item:hover {
  background: var(--input-bg);
  color: var(--text-primary);
}

.history-item.active {
  background: var(--input-bg);
  color: var(--text-primary);
}

.history-item .delete-chat-btn {
  opacity: 1;
}

.history-content {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  min-width: 0;
}

.history-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-meta {
  font-size: 11px;
  opacity: 0.7;
}

.delete-chat-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  opacity: 0;
  transition: all 0.2s ease;
}

.delete-chat-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: 60px;
  min-height: calc(100vh - 60px);
  transition: margin-left 0.3s ease;
}

.sidebar.collapsed~.main-content {
  margin-left: 0;
}

/* Initial Layout */
.initial-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 60px);
  padding: 2rem;
  transition: all 0.5s ease;
}

.initial-container.hidden {
  display: none;
}

.welcome-section {
  text-align: center;
  margin-bottom: 3rem;
}

.welcome-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Search Container */
.search-container {
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.search-wrapper {
  position: relative;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  transition: all 0.3s ease;
  margin-bottom: 2rem;
  z-index: 1001;
}

.search-wrapper:focus-within {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.1);
}

.search-input {
  width: 100%;
  background: transparent;
  border: none;
  padding: 16px 20px;
  padding-right: 120px;
  font-size: 16px;
  color: var(--text-primary);
  outline: none;
  min-height: 60px;
}

.search-input::placeholder {
  color: var(--text-secondary);
}

.search-actions {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Media Upload Container */
.media-upload-container {
  position: relative;
  display: flex;
  align-items: center;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-icon:hover {
  background: var(--border-color);
  color: var(--text-primary);
  border-color: #8b5cf6;
}

.btn-icon.has-media {
  background: #8b5cf6;
  color: white;
  border-color: #8b5cf6;
}

.btn-icon-remove {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: #ef4444;
  color: white;
  transition: all 0.2s ease;
  cursor: pointer;
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 10px;
  z-index: 10;
}

.btn-icon-remove:hover {
  background: #dc2626;
  transform: scale(1.1);
}

.btn-generate {
  background: var(--primary-gradient);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  font-size: 14px;
}

.btn-generate:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.btn-generate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Generation Categories */
.generation-categories {
  margin-bottom: 2rem;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(173px, 1fr));
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.category-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.category-card:hover {
  border-color: #8b5cf6;
  transform: translateY(-2px);
}

.category-card.active {
  border-color: #8b5cf6;
  background: rgba(139, 92, 246, 0.1);
}

.category-card.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.category-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 1rem;
  background: var(--primary-gradient);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
}

.category-card h3,
.category-card h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.category-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.category-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.coming-soon {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

/* Generation Options */
.generation-options {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 1.5rem;
}

.options-panel {
  display: none;
}

.options-panel.active {
  display: block;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.option-card {
  background: var(--input-bg);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

.option-card:hover:not(.disabled) {
  border-color: #8b5cf6;
}

.option-card.active {
  border-color: #8b5cf6;
  background: rgba(139, 92, 246, 0.1);
}

.option-card.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.option-card i {
  font-size: 20px;
  color: #8b5cf6;
}

.option-card span {
  font-size: 14px;
  font-weight: 500;
}

.image-settings,
.video-settings {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.tool-dropdown,
.tool-dropdown-small {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tool-dropdown:focus,
.tool-dropdown-small:focus {
  outline: none;
  border-color: #8b5cf6;
}

.tool-dropdown:hover,
.tool-dropdown-small:hover {
  border-color: #8b5cf6;
}

.tool-dropdown option,
.tool-dropdown-small option {
  background: var(--input-bg);
  color: var(--text-primary);
}

/* Specific Sizes */
.tool-dropdown {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  min-width: 120px;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.1);
}

.tool-dropdown-small {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  min-width: 80px;
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.1);
}

.mode-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.mode-settings {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-text {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Chat Layout */
.chat-container {
  display: none;
  flex-direction: column;
  min-height: calc(100vh - 200px);
  padding-bottom: 200px;
}

.chat-container.active {
  display: flex;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  background: var(--bg-dark);
}

.chat-input-fixed {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width);
  right: 0;
  background: var(--bg-dark);
  backdrop-filter: blur(10px);
  padding: 1rem;
  z-index: 999;
  border-top: 1px solid var(--border-color);
  transition: left 0.3s ease;
}

input[type="number"] {
  background-color: #1e1e1e;
  color: #f0f0f0;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  width: 100px;
}

input[type="number"]:focus {
  border-color: #1500ff77;
  outline: none;
}

.sidebar.collapsed~.main-content .chat-input-fixed {
  left: 0;
}

.chat-mode-indicator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--bg-card);
  border-radius: 8px;
  margin-top: 12px;
  font-size: 14px;
}

.mode-text {
  color: var(--text-secondary);
}

.change-mode-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.change-mode-btn:hover {
  border-color: #8b5cf6;
  color: var(--text-primary);
}

/* Mode Selector Modal */
.mode-selector-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.modal-content {
  background: var(--bg-card);
  border-radius: 12px;
  max-width: 800px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.5rem;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: var(--input-bg);
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
}

.modal-options {
  margin-top: 1.5rem;
}

/* Message Styling */
.message {
  margin-bottom: 2rem;
  padding: 1.5rem;
  border-radius: 12px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.message.user {
  background: var(--bg-card);
  border-left: 4px solid #8b5cf6;
}

.message.ai {
  background: var(--input-bg);
}

.message.error {
  background: rgba(239, 68, 68, 0.1);
  border-left: 4px solid #ef4444;
}

.message-content {
  position: relative;
}

.image-container {
  margin: 1rem 0;
  border-radius: 8px;
  overflow: hidden;
}

.video-container {
  margin: 1rem 0;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  position: relative;
}

.generated-image,
.generated-video {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1rem 0;
  border: none;
  display: block;
}

.generated-video {
  max-height: 400px;
  width: 100%;
  background: #000;
  border-radius: 8px;
}

/* Video loading state */
.video-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-secondary);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.video-error {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--error-color);
  font-size: 14px;
  text-align: center;
  padding: 1rem;
}

.download-btn-float {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
  backdrop-filter: blur(10px);
}

.download-btn-float:hover {
  background: rgba(139, 92, 246, 0.8);
  transform: scale(1.1);
}

.function-btn {
  position: absolute;
  top: 8px;
  right: 56px;
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
  backdrop-filter: blur(10px);
}

.function-btn:hover:not(:disabled) {
  background: rgba(139, 92, 246, 0.8);
  transform: scale(1.1);
}

.function-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.message-time {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 1rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* Loading Spinner */
.loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: inline-block;
}

.advanced-feature-container {
  position: relative;
  display: flex;
  align-items: center;
}

.advanced-search-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
}

.advanced-search-btn:hover {
  background: var(--border-color);
  color: var(--text-primary);
  border-color: #8b5cf6;
}

.advanced-search-btn.active,
.advanced-search-btn.has-features {
  border-color: #8b5cf6;
  color: #8b5cf6;
}

.advanced-search-btn.active {
  background: rgba(139, 92, 246, 0.1);
}

.advanced-search-btn.has-features {
  background: #8b5cf6;
  color: white;
}

.feature-counter-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #8b5cf6;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.advanced-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  max-height: var(--max-dropdown-height);
  overflow: hidden;
  display: none;
  width: 350px;
}

.dropdown-header,
.feature-search-container {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dropdown-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.feature-counter {
  color: #8b5cf6;
  font-weight: 500;
  font-size: 14px;
}

.feature-search-input {
  width: 100%;
  padding: 8px 12px;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

.feature-search-input:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.1);
}

.feature-search-input::placeholder {
  color: var(--text-secondary);
}

.feature-list {
  max-height: 280px;
  overflow-y: auto;
  padding: 8px;
}

.feature-list::-webkit-scrollbar {
  width: var(--scrollbar-width);
}

.feature-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.feature-list::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-size: 14px;
}

.feature-item:hover {
  background: var(--input-bg);
}

.feature-checkbox {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-color);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.feature-checkbox:checked {
  background: #8b5cf6;
  border-color: #8b5cf6;
}

.feature-checkbox:checked::after {
  content: '✓';
  position: absolute;
  top: -2px;
  left: 2px;
  color: white;
  font-size: 12px;
  font-weight: bold;
}

.feature-label {
  flex: 1;
  color: var(--text-primary);
  cursor: pointer;
}

#chatAdvancedFeatureDropdown {
  position: fixed !important;
  top: -400px !important;
  left: 90% !important;
  transform: translateX(-50%);
  width: 90vw;
  max-width: var(--max-dropdown-width);
  z-index: 2000 !important;
  max-height: 70vh;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  background: rgba(0, 0, 0, 0.55);
  border: none;
  border-radius: var(--btn-radius);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
  z-index: 10;
}

.copy-btn:hover {
  background: rgba(139, 92, 246, 0.9);
}

.avatar-initials {
  background-color: #7B61FF;
  color: white;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.wallet-balance-box {
  padding: 8px 10px;
  background: rgba(139, 92, 246, 0.08);
  border-radius: 8px;
  /* margin: 8px; */
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.wallet-amount {
  font-size: 16px;
  font-weight: 600;
  color: #8b5cf6;
}


@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.hidden-file-input {
  display: none;
}

.hidden {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ===== RESPONSIVE DESIGN ===== */

/* Large Screens */
@media (max-width: 1200px) {
  .welcome-title {
    font-size: 2.2rem;
  }

  .search-container {
    max-width: 800px;
  }

  .category-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

/* Medium Screens */
@media (max-width: 992px) {
  :root {
    --sidebar-width: 250px;
  }

  .welcome-title {
    font-size: 2rem;
  }

  .welcome-subtitle {
    font-size: 1rem;
  }

  .category-grid,
  .options-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .image-settings,
  .video-settings {
    flex-direction: column;
    align-items: center;
  }

  .tool-dropdown {
    min-width: 200px;
  }
}

/* Tablet Screens */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 280px;
  }

  .sidebar {
    transform: translateX(-100%);
    z-index: 1002;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .chat-input-fixed {
    left: 0;
    padding: 1rem;
  }

  .welcome-title {
    font-size: 1.8rem;
    margin-bottom: 0.75rem;
  }

  .welcome-subtitle {
    font-size: 1rem;
  }

  .welcome-section {
    margin-bottom: 2rem;
  }

  .initial-container,
  .chat-messages {
    padding: 1.5rem 1rem;
  }

  .search-input {
    padding: 14px 16px;
    padding-right: 100px;
    font-size: 15px;
    min-height: 50px;
  }

  .search-actions {
    right: 12px;
    gap: 8px;
  }

  .btn-generate {
    padding: 8px 16px;
    font-size: 13px;
    height: 36px;
  }

  .btn-icon {
    width: 36px;
    height: 36px;
  }

  .category-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .category-card {
    padding: 1rem;
  }

  .category-icon {
    width: 50px;
    height: 50px;
    font-size: 20px;
  }

  .category-card h3,
  .category-card h4 {
    font-size: 1rem;
  }

  .options-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .generation-options {
    padding: 1rem;
  }

  .message {
    padding: 1rem;
    margin-bottom: 1.5rem;
  }

  .modal-content {
    margin: 1rem;
    max-height: calc(100vh - 2rem);
  }

  .modal-header,
  .modal-body {
    padding: 1rem;
  }
  .advanced-dropdown {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90vw;
    max-width: 400px;
    max-height: 70vh;
  }
}

/* Large Mobile Screens */
@media (max-width: 649px) {
  .welcome-title {
    font-size: 1.6rem;
  }

  .welcome-subtitle {
    font-size: 0.9rem;
  }

  .initial-container,
  .chat-messages {
    padding: 1rem 0.75rem;
  }

  .search-input {
    padding: 12px 14px;
    padding-right: 85px;
    font-size: 14px;
    min-height: 44px;
  }

  .search-actions {
    right: 10px;
    gap: 6px;
  }

  .btn-generate {
    padding: 6px 12px;
    font-size: 12px;
    height: 32px;
  }

  .btn-text {
    display: none;
  }

  .btn-icon {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .category-card {
    padding: 0.75rem;
  }

  .category-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
    margin-bottom: 0.75rem;
  }

  .category-card h3,
  .category-card h4 {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
  }

  .category-card p {
    font-size: 0.8rem;
  }

  .tool-dropdown {
    min-width: 100%;
    padding: 6px 10px;
    font-size: 13px;
  }

  .image-settings,
  .video-settings {
    gap: 0.5rem;
  }

  .message {
    padding: 0.75rem;
    margin-bottom: 1rem;
  }

  .download-btn-float,
  .function-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .function-btn {
    right: 40px;
  }
}

@media (max-width: 440px) {
  .profile-info {
    display: none;
  }
  .menu-text{
    display: none;
  }
}

/* Small Mobile Screens */
@media (max-width: 480px) {
  .welcome-title {
    font-size: 1.4rem;
    line-height: 1.2;
  }

  .welcome-subtitle {
    font-size: 0.85rem;
  }

  .initial-container {
    padding: 0.75rem 0.5rem;
    min-height: calc(100vh - 60px);
  }

  .chat-messages {
    padding: 0.75rem 0.5rem;
  }

  .chat-input-fixed {
    padding: 0.75rem;
  }

  .search-wrapper {
    border-radius: 10px;
    margin-bottom: 1.5rem;
  }

  .search-input {
    padding: 10px 12px;
    padding-right: 70px;
    font-size: 13px;
    min-height: 40px;
  }

  .search-actions {
    right: 8px;
    gap: 4px;
  }

  .btn-generate {
    padding: 4px 10px;
    font-size: 11px;
    height: 28px;
    border-radius: 6px;
  }

  .btn-icon {
    width: 28px;
    height: 28px;
    font-size: 12px;
    border-radius: 6px;
  }

  .category-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .category-card {
    padding: 0.5rem;
    border-radius: 8px;
  }

  .category-icon {
    width: 35px;
    height: 35px;
    font-size: 16px;
    margin-bottom: 0.5rem;
  }

  .category-card h3,
  .category-card h4 {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
  }

  .category-card p {
    font-size: 0.75rem;
  }

  .generation-options .option-card {
    padding: 0.75rem;
    border-radius: 8px;
  }

  .option-card i {
    font-size: 16px;
  }

  .option-card span {
    font-size: 12px;
  }

  .tool-dropdown {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 5px;
  }

  .message {
    padding: 0.5rem;
    margin-bottom: 0.75rem;
    border-radius: 10px;
  }

  .message-content p {
    font-size: 13px;
  }

  .generated-image,
  .generated-video {
    border-radius: 5px;
    margin: 0.5rem 0;
  }

  .download-btn-float,
  .function-btn {
    width: 28px;
    height: 28px;
    font-size: 12px;
    border-radius: 6px;
  }

  .function-btn {
    right: 34px;
  }

  .message-time {
    font-size: 10px;
    margin-top: 0.5rem;
  }

  .sidebar {
    width: 100vw;
  }

  .sidebar-header {
    padding: 0.75rem;
  }

  .sidebar-content {
    padding: 0.5rem;
  }

  .sidebar-btn,
  .history-item {
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 6px;
  }

  .history-title,
  .history-meta {
    font-size: 10px;
  }

  .delete-chat-btn {
    width: 20px;
    height: 20px;
    font-size: 10px;
  }

  .empty-state {
    padding: 2rem 0.5rem;
  }

  .empty-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
  }

  .empty-state h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
  }

  .empty-state p {
    font-size: 0.85rem;
  }

  .chat-mode-indicator {
    padding: 6px 12px;
    font-size: 12px;
    margin-top: 8px;
  }

  .modal-content {
    margin: 0.5rem;
    border-radius: 8px;
  }

  .modal-header h3 {
    font-size: 1.2rem;
  }

  .modal-header,
  .modal-body {
    padding: 0.75rem;
  }

  .image-settings,
  .video-settings {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .tool-dropdown,
  .tool-dropdown-small {
    min-width: 100%;
  }

  .mode-settings {
    flex-direction: column;
    gap: 6px;
  }
}

/* Extra Small Mobile Screens */
@media (max-width: 360px) {
  .welcome-title {
    font-size: 1.2rem;
  }

  .welcome-subtitle {
    font-size: 0.8rem;
  }

  .search-input {
    padding: 8px 10px;
    padding-right: 60px;
    font-size: 12px;
    min-height: 36px;
  }

  .btn-generate {
    padding: 3px 8px;
    font-size: 10px;
    height: 24px;
  }

  .btn-icon {
    width: 24px;
    height: 24px;
    font-size: 10px;
  }

  .category-icon {
    width: 30px;
    height: 30px;
    font-size: 14px;
  }

  .category-card h3,
  .category-card h4,
  .category-card p {
    font-size: 0.8rem;
  }

  .tool-dropdown {
    padding: 3px 6px;
    font-size: 11px;
  }

  .message {
    padding: 0.4rem;
  }

  .message-content p {
    font-size: 12px;
  }

  .download-btn-float,
  .function-btn {
    width: 24px;
    height: 24px;
    font-size: 10px;
  }

  .function-btn {
    right: 30px;
  }
}

/* Landscape orientation for mobile devices */
@media (max-width: 768px) and (orientation: landscape) {
  .initial-container {
    padding: 1rem;
    min-height: calc(100vh - 40px);
  }

  .welcome-section {
    margin-bottom: 1.5rem;
  }

  .welcome-title {
    font-size: 1.6rem;
  }

  .chat-messages {
    padding: 1rem;
  }

  .message {
    padding: 0.75rem;
  }

  .category-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .options-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {

  .btn-generate,
  .btn-icon,
  .function-btn,
  .sidebar-btn,
  .tool-dropdown,
  .category-card,
  .option-card {
    min-height: 44px;
  }

  .search-input {
    min-height: 44px;
  }

  .history-item {
    min-height: 40px;
  }

  .delete-chat-btn {
    min-width: 40px;
    min-height: 40px;
  }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {

  .generated-image,
  .generated-video {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Print styles */
@media print {

  .sidebar,
  .sidebar-toggle,
  .chat-input-fixed,
  .download-btn-float,
  .function-btn {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
  }

  .message {
    break-inside: avoid;
  }
}