:root {
  --primary-color: #6c5ce7;
  --primary-light: #a29bfe;
  --secondary-color: #fd79a8;
  --text-color: #2d3436;
  --bg-color: #f9f9f9;
  --card-bg: #ffffff;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
  --border-radius: 12px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header styles */
header {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-light)
  );
  color: white;
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  box-shadow: var(--shadow);
}

header h1 {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.history-icon {
  cursor: pointer;
  font-size: 1.5rem;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transition: var(--transition);
}

.history-icon:hover {
  background-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

/* History panel */
.history {
  position: absolute;
  top: 100%;
  right: 0;
  width: 350px;
  background-color: var(--card-bg);
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  z-index: 100;
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}

.history.active {
  transform: translateY(0);
  opacity: 1;
  pointer-events: all;
}

.history h2 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  font-size: 1.5rem;
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: 0.5rem;
}

.past-prompts {
  max-height: 300px;
  overflow-y: auto;
}

.prompt-item {
  display: flex;
  align-items: center;
  padding: 0.8rem;
  border-radius: var(--border-radius);
  margin-bottom: 0.5rem;
  background-color: #f5f5f5;
  transition: var(--transition);
}

.prompt-item:hover {
  background-color: #eee;
}

.prompt-item i {
  margin-right: 0.8rem;
  color: var(--primary-color);
}

.prompt-item p {
  flex: 1;
  font-size: 0.9rem;
  color: var(--primary-color);
}

.prompt-date {
  font-size: 0.75rem;
  color: #777;
  margin-right: 0.8rem;
}

.prompt-item .fa-trash {
  color: #e74c3c;
  cursor: pointer;
  opacity: 0.7;
  transition: var(--transition);
}

.prompt-item .fa-trash:hover {
  opacity: 1;
  transform: scale(1.1);
}
#clearHistory.disabled {
  display: none;
}
/* Main container */
.container {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Images grid */
.images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  width: 100%;
}

.image-box {
  aspect-ratio: 1/1;
  background-color: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 500px;
}

.image-box:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.image-box::before {
  content: "";
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid var(--primary-light);
  border-top-color: transparent;
  animation: spin 1s linear infinite;
  opacity: 0;
}

.image-box.loading::before {
  opacity: 1;
}

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

/* Prompt input area */
.prompt {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  margin-top: auto;
}
.prompt > div {
  flex-basis: 100%;
}
.prompt input {
  width: 100%;
  padding: 1rem 1.5rem;
  border: 2px solid #ddd;
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: var(--transition);
  outline: none;
}
.prompt input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.2);
}
.selectLists {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}
.selectListStyle {
  flex: 1;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-color: #f8f9fa;
  border: 2px solid var(--primary-light);
  padding: 10px 20px;
  border-radius: 5px;
  font-size: 16px;
  color: #495057;
  outline: none;
  transition: all 0.3s ease;
}

.selectListStyle:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.2);
}

.selectListStyle::after {
  content: "\25BC";
  font-size: 12px;
  color: #007bff;
  position: absolute;
  top: 50%;
  right: 15px;
  transform: translateY(-50%);
  pointer-events: none;
}

.btn {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-light)
  );
  color: white;
  border: none;
  border-radius: var(--border-radius);
  padding: 10px 20px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(108, 92, 231, 0.3);
}

.btn:active {
  transform: translateY(0);
}

/* Loading animation */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  header {
    padding: 1rem;
  }

  header h1 {
    font-size: 1.8rem;
  }

  .container {
    padding: 1rem;
  }

  .history {
    width: 100%;
    max-width: 100%;
    border-radius: 0;
  }

  .btn {
    padding: 1rem;
  }
}
