/* My Dialogues Page */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

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

:root {
  --primary: #e63946;
  --secondary: #457b9d;
  --accent: #f4a261;
  --dark: #1d3557;
  --light: #f1faee;
  --bg: #fef9ef;
  --text: #2d3436;
  --text-light: #636e72;
}

body {
  font-family: 'Nunito', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

[x-cloak] { display: none !important; }

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

.page-header h1 { font-size: 1.25rem; font-weight: 700; }

.page-header a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.page-header a:hover { text-decoration: underline; }

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

/* View toggle */
.view-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(29, 53, 87, 0.06);
  width: fit-content;
}

.view-toggle button {
  padding: 0.5rem 1.25rem;
  border: none;
  background: white;
  color: var(--text-light);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.view-toggle button.active {
  background: var(--secondary);
  color: white;
}

.view-toggle button:hover:not(.active) {
  background: var(--light);
}

/* Sort bar */
.sort-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.sort-bar .count {
  font-size: 0.85rem;
  color: var(--text-light);
}

.sort-toggle {
  display: flex;
  gap: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--light);
}

.sort-toggle button {
  padding: 0.3rem 0.75rem;
  border: none;
  background: white;
  color: var(--text-light);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.sort-toggle button.active {
  background: var(--dark);
  color: white;
}

/* Dialogue cards grid */
.dialogue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}

.dialogue-card {
  background: white;
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  box-shadow: 0 1px 4px rgba(29, 53, 87, 0.06);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  color: var(--text);
  transition: box-shadow 0.15s, transform 0.15s;
  border-left: 3px solid var(--secondary);
}

.dialogue-card:hover {
  box-shadow: 0 4px 12px rgba(29, 53, 87, 0.12);
}

.dialogue-card.community {
  border-left-color: var(--accent);
}

.dialogue-card-title-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  cursor: pointer;
}

.dialogue-card-title-link:hover .dialogue-card-title {
  color: var(--secondary);
}

.dialogue-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--dark);
  line-height: 1.3;
  transition: color 0.15s;
}

.dialogue-card-scenario {
  font-size: 0.83rem;
  color: var(--text-light);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dialogue-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 0.4rem;
}

.dialogue-card-badges {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-mode {
  background: var(--light);
  color: var(--secondary);
}

.badge-chunks {
  background: #e8f4f8;
  color: var(--secondary);
}

.badge-words {
  background: #fff3e0;
  color: #e65100;
}

.dialogue-card-like {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--text-light);
}

.dialogue-card-like.liked {
  color: var(--primary);
}

.dialogue-card-date {
  font-size: 0.75rem;
  color: var(--text-light);
  opacity: 0.7;
}

.dialogue-card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.delete-btn {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem;
  opacity: 0.5;
  transition: opacity 0.15s, color 0.15s;
}

.delete-btn:hover {
  opacity: 1;
  color: var(--primary);
}

/* Loading & empty states */
.loading-state, .empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-light);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.pagination button {
  padding: 0.4rem 1rem;
  border: 1px solid var(--light);
  border-radius: 8px;
  background: white;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination .page-info {
  font-size: 0.85rem;
  color: var(--text-light);
}

/* Auth prompt */
.auth-prompt {
  text-align: center;
  padding: 4rem 1rem;
}

.auth-prompt p {
  color: var(--text-light);
  margin-bottom: 1rem;
}

.auth-prompt a {
  color: var(--secondary);
  font-weight: 600;
}

@media (max-width: 480px) {
  .page-header { padding: 0.8rem 1rem; }
  .container { padding: 1rem 0.75rem 3rem; }
  .dialogue-grid { grid-template-columns: 1fr; }
}
