:root {
  --bg-color: #f9f9f9;
  --text-color: #000;
  --card-bg: #fff;
  --link-color: #0066cc;
  --muted: rgba(0,0,0,0.6);
  --shadow: 0 1px 4px rgba(0,0,0,0.1);
}

body.dark-mode {
  --bg-color: #1e1e1e;
  --text-color: #eee;
  --card-bg: #2a2a2a;
  --link-color: #4da6ff;
  --muted: rgba(255,255,255,0.65);
  --shadow: 0 1px 4px rgba(0,0,0,0.45);
}

* { box-sizing: border-box; }

body {
  font-family: Arial, sans-serif;
  margin: 20px;
  background: var(--bg-color);
  color: var(--text-color);
  transition: background 0.3s, color 0.3s;
}

#app { max-width: 1100px; margin: 0 auto; }

a { color: var(--link-color); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { text-align: center; margin: 10px 0 18px; }
h2 { margin: 12px 0 10px; }

#adminLogin { text-align: center; margin-bottom: 14px; }
#adminLogin input { padding: 8px; width: min(320px, 70vw); border-radius: 8px; border: 1px solid rgba(0,0,0,0.15); }
body.dark-mode #adminLogin input { border: 1px solid rgba(255,255,255,0.18); background: #121212; color: var(--text-color); }
#adminLogin button { padding: 8px 12px; margin-left: 6px; cursor: pointer; border-radius: 8px; border: 0; box-shadow: var(--shadow); }

.toolbar {
  text-align: center;
  margin-bottom: 12px;
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar button {
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 10px;
  border: 0;
  box-shadow: var(--shadow);
}

.status {
  font-size: 13px;
  color: var(--muted);
  min-height: 18px;
}

#search { width: 100%; padding: 10px; margin: 12px 0 6px; border-radius: 10px; border: 1px solid rgba(0,0,0,0.15); }
body.dark-mode #search { border: 1px solid rgba(255,255,255,0.18); background: #121212; color: var(--text-color); }

.card {
  background: var(--card-bg);
  padding: 12px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin: 10px 0;
  transition: background 0.3s;
}

.card h3 { margin: 0 0 6px; }
.card p { margin: 4px 0 8px; color: var(--muted); }

.btn {
  margin: 2px;
  padding: 6px 10px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  box-shadow: var(--shadow);
}

.delete-btn { background: #e74c3c; color: #fff; }
.edit-btn { background: #f39c12; color: #fff; }
.add-btn { background: #2ecc71; color: #fff; }
.back-btn { background: #3498db; color: #fff; margin-bottom: 6px; }
.toggle-btn { background: #8e44ad; color: #fff; }

.delete-btn:hover { filter: brightness(0.92); }
.edit-btn:hover { filter: brightness(0.92); }
.add-btn:hover { filter: brightness(0.92); }
.back-btn:hover { filter: brightness(0.92); }
.toggle-btn:hover { filter: brightness(0.92); }

.mini {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

/* Grid view */
.grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.grid-view .card {
  margin: 0;
  min-height: 130px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.grid-view .card h3,
.grid-view .card p,
.grid-view .card div,
.grid-view .card a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Small screens */
@media (max-width: 520px) {
  body { margin: 12px; }
  #adminLogin button { margin-left: 0; margin-top: 8px; }
  #adminLogin { display: flex; flex-direction: column; align-items: center; gap: 8px; }
}
