:root {
  --primary-color: #6d28d9;
  --primary-light: #8b5cf6;
  --secondary-color: #10b981;
  --text-color-light: #1f2937;
  --text-color-dark: #f9fafb;
  --bg-color-light: #f9fafb;
  --bg-color-dark: #111827;
  --card-bg-light: rgba(255, 255, 255, 0.8);
  --card-bg-dark: rgba(31, 41, 55, 0.8);
  --shadow-light: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-dark: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  --border-radius: 12px;
  --transition: all 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", sans-serif;
  transition: var(--transition);
  min-height: 100vh;
}

body.light-mode {
  background-color: var(--bg-color-light);
  color: var(--text-color-light);
}

body.dark-mode {
  background-color: var(--bg-color-dark);
  color: var(--text-color-dark);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Header Styles */
header {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.logo-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-svg {
  animation: pulse 3s infinite ease-in-out;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.theme-toggle {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--primary-color);
  transition: var(--transition);
}

.search-container {
  display: flex;
  gap: 0.5rem;
}

#search-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius);
  border: 1px solid #d1d5db;
  font-size: 1rem;
  transition: var(--transition);
}

.dark-mode #search-input {
  background-color: #374151;
  border-color: #4b5563;
  color: var(--text-color-dark);
}

#search-button {
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius);
  border: none;
  background-color: var(--primary-color);
  color: white;
  cursor: pointer;
  transition: var(--transition);
}

#search-button:hover {
  background-color: var(--primary-light);
}

/* Glass Card Effect */
.glass-card {
  background: var(--card-bg-light);
  backdrop-filter: blur(10px);
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: var(--shadow-light);
  transition: var(--transition);
}

.dark-mode .glass-card {
  background: var(--card-bg-dark);
  box-shadow: var(--shadow-dark);
}

/* Prompt Section */
.prompt-section {
  margin-bottom: 2rem;
}

.prompt-section h2 {
  margin-bottom: 1rem;
  font-family: "Merriweather", serif;
  font-size: 1.5rem;
}

#prompt-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#prompt-input {
  width: 100%;
  min-height: 100px;
  padding: 1rem;
  border-radius: var(--border-radius);
  border: 1px solid #d1d5db;
  font-family: "Inter", sans-serif;
  font-size: 1rem;
  resize: vertical;
  transition: var(--transition);
}

.dark-mode #prompt-input {
  background-color: #374151;
  border-color: #4b5563;
  color: var(--text-color-dark);
}

#generate-button {
  align-self: flex-end;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius);
  border: none;
  background-color: var(--primary-color);
  color: white;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

#generate-button:hover {
  background-color: var(--primary-light);
  transform: translateY(-2px);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.hidden {
  display: none;
}

/* Gallery Section */
.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.gallery-header h2 {
  font-family: "Merriweather", serif;
  font-size: 1.5rem;
}

.gallery-tabs {
  display: flex;
  gap: 0.5rem;
}

.tab-button {
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  border: 1px solid #d1d5db;
  background: none;
  cursor: pointer;
  transition: var(--transition);
}

.dark-mode .tab-button {
  border-color: #4b5563;
  color: var(--text-color-dark);
}

.tab-button.active {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

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

.image-card {
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-light);
  transition: var(--transition);
  background: var(--card-bg-light);
  animation: fadeIn 0.5s ease-out;
}

.dark-mode .image-card {
  background: var(--card-bg-dark);
  box-shadow: var(--shadow-dark);
}

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

.image-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.image-container {
  width: 100%;
  height: 200px;
  overflow: hidden;
}

.image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.image-card:hover .image-container img {
  transform: scale(1.05);
}

.image-details {
  padding: 1rem;
}

.image-prompt {
  font-family: "Merriweather", serif;
  font-size: 1rem;
  margin-bottom: 0.5rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.image-date {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 1rem;
}

.dark-mode .image-date {
  color: #9ca3af;
}

.image-actions {
  display: flex;
  justify-content: space-between;
}

.image-action-btn {
  padding: 0.5rem;
  border-radius: var(--border-radius);
  border: none;
  background: none;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
}

.save-btn {
  color: var(--secondary-color);
}

.delete-btn {
  color: #ef4444;
}

.image-action-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.dark-mode .image-action-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Chatbot Styles */
.chatbot {
  position: fixed;
  bottom: 5rem;
  right: 2rem;
  width: 350px;
  height: 450px;
  background: var(--card-bg-light);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-light);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: var(--transition);
  z-index: 1000;
}

.dark-mode .chatbot {
  background: var(--card-bg-dark);
  box-shadow: var(--shadow-dark);
}

.chatbot.collapsed {
  height: 0;
  padding: 0;
  border: none;
}

.chatbot-header {
  padding: 1rem;
  background-color: var(--primary-color);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chatbot-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

#chatbot-toggle {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1rem;
}

.chatbot-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message {
  max-width: 80%;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  animation: messageIn 0.3s ease-out;
}

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

.message.user {
  align-self: flex-end;
  background-color: var(--primary-color);
  color: white;
  border-bottom-right-radius: 0.25rem;
}

.message.bot {
  align-self: flex-start;
  background-color: #e5e7eb;
  color: var(--text-color-light);
  border-bottom-left-radius: 0.25rem;
}

.dark-mode .message.bot {
  background-color: #374151;
  color: var(--text-color-dark);
}

.chatbot-input {
  padding: 1rem;
  display: flex;
  gap: 0.5rem;
  border-top: 1px solid #e5e7eb;
}

.dark-mode .chatbot-input {
  border-top-color: #4b5563;
}

#chatbot-input-field {
  flex: 1;
  padding: 0.75rem;
  border-radius: var(--border-radius);
  border: 1px solid #d1d5db;
  font-size: 0.875rem;
}

.dark-mode #chatbot-input-field {
  background-color: #374151;
  border-color: #4b5563;
  color: var(--text-color-dark);
}

#chatbot-send {
  padding: 0.75rem;
  border-radius: var(--border-radius);
  border: none;
  background-color: var(--primary-color);
  color: white;
  cursor: pointer;
}

.chatbot-trigger {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: var(--shadow-light);
  transition: var(--transition);
  z-index: 1000;
}

.chatbot-trigger:hover {
  transform: scale(1.1);
}

/* Notification */
.notification {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 1rem 1.5rem;
  border-radius: var(--border-radius);
  background-color: white;
  box-shadow: var(--shadow-light);
  display: flex;
  align-items: center;
  z-index: 1000;
  animation: slideUp 0.3s ease-out;
}

.dark-mode .notification {
  background-color: #1f2937;
  box-shadow: var(--shadow-dark);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translate(-50%, 20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.notification-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.notification-icon {
  font-size: 1.25rem;
}

.notification.success .notification-icon {
  color: var(--secondary-color);
}

.notification.error .notification-icon {
  color: #ef4444;
}

/* Responsive Styles */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  header {
    flex-direction: column;
    gap: 1rem;
  }

  .logo-wrapper {
    width: 100%;
    justify-content: center;
  }

  h1 {
    font-size: 1.75rem;
  }

  .search-container {
    width: 100%;
  }

  .gallery-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .gallery-tabs {
    width: 100%;
    display: flex;
    justify-content: space-between;
  }

  .tab-button {
    flex: 1;
    text-align: center;
  }

  .chatbot {
    width: 90%;
    right: 5%;
    left: 5%;
    bottom: 5rem;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .prompt-section {
    padding: 1.25rem;
  }

  #generate-button {
    align-self: stretch;
    justify-content: center;
  }

  .image-card {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  }

  .logo-svg {
    width: 30px;
    height: 30px;
  }

  h1 {
    font-size: 1.5rem;
  }
}
