/* ===== Left Drawer ===== */

.drawerOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1100;
  animation: fadeIn 150ms ease-out;
}

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

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 960px;
  max-width: 95vw;
  background: var(--drawer-bg);
  border-right: 1px solid var(--border-default);
  z-index: 1101;
  display: flex;
  flex-direction: column;
  animation: slideInLeft 200ms ease-out;
}

@keyframes slideInLeft {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

.drawerHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--drawer-header-bg);
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}

.drawerTitle {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.drawerClose {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: var(--transition-all);
}

.drawerClose:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.drawerBody {
  overflow-y: scroll;
  height: calc(100vh - 50px);
  padding: var(--space-3);
  padding-bottom: var(--space-6);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  align-content: start;
}

/* ===== Preset Cards ===== */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  padding-bottom: var(--space-4);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-default);
  transition: var(--transition-all);
}

.cardImage {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  object-fit: contain;
  opacity: 0.7;
  pointer-events: none;
}

.cardSelected {
  border-color: rgba(34, 197, 94, 0.5);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.2);
}

.cardHeader {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.cardIcon {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.cardTitle {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.cardDescription {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.5;
  flex: 1;
}

.cardActions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: auto;
  padding-top: var(--space-2);
}

.showMoreButton {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0;
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  cursor: pointer;
  transition: var(--transition-all);
}

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

.selectButton {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2-5);
  margin-left: auto;
  background: transparent;
  border: 1px solid rgba(34, 197, 94, 0.4);
  border-radius: var(--radius-md);
  color: rgba(34, 197, 94, 0.9);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: var(--transition-all);
}

.selectButton:hover {
  background: rgba(34, 197, 94, 0.9);
  color: white;
}

:global([data-theme="light"]) .selectButton {
  background: rgba(34, 197, 94, 0.9);
  border-color: rgba(34, 197, 94, 0.9);
  color: white;
}

:global([data-theme="light"]) .selectButton:hover {
  background: rgba(34, 197, 94, 1);
}

.selectButtonApplied {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.4);
  color: rgba(34, 197, 94, 0.9);
  cursor: default;
}

.selectButtonApplied:hover {
  background: rgba(34, 197, 94, 0.15);
  color: rgba(34, 197, 94, 0.9);
}

/* ===== Detail Modal (centered, scrollable) ===== */

.detailBody {
  padding: var(--space-4);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.7;
  max-height: 55vh;
  overflow-y: auto;
}

.detailSection + .detailSection {
  margin-top: var(--space-6);
}

.detailBody h4 {
  margin: 0 0 var(--space-1) 0;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.detailBody h4:first-child {
  margin-top: 0;
}

.detailLine {
  margin: var(--space-0-5) 0;
}

.detailLineBullet {
  margin: var(--space-0-5) 0;
  padding-left: var(--space-4);
}

/* ===== Toggle Bar ===== */

.toggleBar {
  display: flex;
  gap: 1px;
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--border-default);
  background: var(--drawer-header-bg);
  flex-shrink: 0;
}

.toggleButton {
  flex: 1;
  padding: var(--space-1-5) var(--space-3);
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: var(--transition-all);
}

.toggleButton:hover:not(.toggleButtonActive) {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
}

.toggleButton:first-child {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.toggleButton:last-child {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  border-left: none;
}

.toggleButton:last-child.toggleButtonActive {
  border-left: 1px solid rgba(34, 197, 94, 0.45);
}

.toggleButtonActive {
  background: rgba(34, 197, 94, 0.12);
  color: rgba(34, 197, 94, 0.95);
  border-color: rgba(34, 197, 94, 0.45);
  font-weight: var(--font-semibold);
}

/* Light mode: inactive needs more contrast against light gray bg */
:global([data-theme="light"]) .toggleButton {
  background: white;
  border-color: #d1d5db;
  color: #6b7280;
}

:global([data-theme="light"]) .toggleButton:hover:not(.toggleButtonActive) {
  background: #f9fafb;
  color: #374151;
}

:global([data-theme="light"]) .toggleButtonActive {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
  border-color: #16a34a;
  font-weight: var(--font-semibold);
}

:global([data-theme="light"]) .toggleButton:last-child.toggleButtonActive {
  border-left: 1px solid #16a34a;
}

/* Fix the left border on the second button when first is active */
.toggleButtonActive + .toggleButton {
  border-left: 1px solid var(--border-default);
}

:global([data-theme="light"]) .toggleButtonActive + .toggleButton {
  border-left: 1px solid #d1d5db;
}

/* ===== My Presets View ===== */

.userBody {
  overflow-y: auto;
  height: calc(100vh - 100px);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.generateButton {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2-5) var(--space-3);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(59, 130, 246, 0.15));
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-default);
  color: rgba(139, 92, 246, 0.95);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  cursor: pointer;
  transition: var(--transition-all);
  flex-shrink: 0;
}

.generateButton:hover {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(59, 130, 246, 0.25));
  border-color: rgba(139, 92, 246, 0.5);
}

:global([data-theme="light"]) .generateButton {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(59, 130, 246, 0.1));
  color: rgba(109, 62, 216, 0.95);
}

:global([data-theme="light"]) .generateButton:hover {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(59, 130, 246, 0.18));
}

.userGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  align-content: start;
}

.userCard {
  display: flex;
  flex-direction: column;
  gap: var(--space-1-5);
  padding: var(--space-3);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-default);
  transition: var(--transition-all);
}

.userCardName {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.userCardDescription {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.5;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.userCardDate {
  font-size: 10px;
  color: var(--text-tertiary);
}

.deleteButton {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: var(--transition-all);
}

.deleteButton:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: rgba(239, 68, 68, 0.9);
}

.emptyState {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-8) var(--space-4);
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  text-align: center;
}

.emptyState p {
  margin: 0;
}

.emptyIcon {
  opacity: 0.4;
}

.spinner {
  animation: spin 1s linear infinite;
}

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