/* ===============================
   Theme / Base
================================ */

:root {
  --bg: #f7f7f9;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #24b47e;
  --accent-dark: #1b8a61;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===============================
   Header / Nav
================================ */

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: white;
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 800;
  font-size: 1.05rem;
  text-decoration: none;
  color: var(--text);
}

.nav {
  display: flex;
  gap: 18px;
  align-items: center;
}

.nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.95rem;
}

.nav a.active {
  color: var(--text);
  font-weight: 600;
}

.nav button {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.95rem;
}

.nav button:hover,
.nav a:hover {
  color: var(--text);
}

/* ===============================
   Layout
================================ */

main {
  max-width: none;
  margin: 40px 0;
  padding: 0 40px;
  flex: 1;
}

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

.card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.12);
}

.page-card {
  padding: 28px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.card-header h1 {
  font-size: 1.8rem;
  letter-spacing: -0.01em;
}

/* ===============================
   Buttons
================================ */

button {
  font: inherit;
  padding: 10px 18px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
}

button.primary {
  background: var(--accent);
  color: white;
  font-weight: 600;
}

button.primary:hover {
  background: var(--accent-dark);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===============================
   Groups List
================================ */

.group {
  background: var(--card);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.06);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.group:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(0,0,0,0.08);
}

.groups-list {
  list-style: none;
  padding: 8px;
  margin: 0;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(0,0,0,.10);
}

.group h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.group p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.group::after {
  content: "→";
  color: var(--muted);
  font-size: 0.9rem;
}

.group .name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.group .meta {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: capitalize;
}

.group::after {
  content: "→";
  align-self: flex-end;
  margin-top: auto;
  color: var(--muted);
  font-size: 1.1rem;
  transition: transform 0.15s ease, color 0.15s ease;
}

.group:hover::after {
  transform: translateX(4px);
  color: var(--text);
}

/* ===============================
   Status / Errors
================================ */

.status {
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 0.95rem;
}

.error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.groups-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.groups-grid li {
  background: var(--card);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.groups-grid li:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(0,0,0,0.08);
}

.hidden {
  display: none;
}

/* ===============================
   Empty State
================================ */

.empty {
  background: var(--card);
  border-radius: 16px;
  padding: 40px 32px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.12);
  text-align: center;
  margin-top: 24px;
}

.empty h2 {
  margin-top: 0;
  margin-bottom: 8px;
}

.empty p {
  color: var(--muted);
  margin-bottom: 18px;
}

/* ===============================
   Modal
================================ */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-card {
  background: white;
  border-radius: 20px;
  padding: 28px 28px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
}

.modal h2 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
}

.modal p {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.hint {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 14px;
}

#cancel-btn {
  background: transparent;
  color: var(--muted);
}

#cancel-btn:hover {
  color: var(--text);
}

#create-btn {
  background: var(--accent);
  color: white;
  font-weight: 600;
}

#create-btn:hover {
  background: var(--accent-dark);
}

/* ===============================
   Form Elements
================================ */

label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

input[type="text"] {
  height: 48px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 1rem;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(36, 180, 126, 0.2);
}

.actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ===============================
   Footer
================================ */

.footer {
  padding: 12px 24px;
  font-size: 0.875rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-links {
  display: flex;
  gap: 28px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--text);
}
