/* ── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #4f46e5;
  --primary-light: #818cf8;
  --primary-dark: #3730a3;
  --accent: #06b6d4;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,.05), 0 2px 4px rgba(0,0,0,.03);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.08);
  --transition: .2s ease;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }

/* ── Marquee Notification ──────────────────────────────────────── */
.marquee-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  max-width: 560px;
  margin: .75rem auto 0;
  padding: .55rem 1rem;
  font-size: .92rem;
  color: #92400e;
  overflow: hidden;
  border-radius: var(--radius);
}
.marquee-icon {
  flex-shrink: 0;
  font-size: 1.1rem;
}
.marquee-track {
  overflow: hidden;
  position: relative;
}
.marquee-content {
  display: inline-block;
  white-space: nowrap;
  animation: marquee-scroll 20s linear infinite;
}
@keyframes marquee-scroll {
  0%   { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

/* ── Header / Hero ───────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  padding: 3rem 1.5rem 2.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='.06'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero h1 { font-size: 2rem; font-weight: 700; position: relative; }
.hero p  { margin-top: .5rem; opacity: .9; font-size: 1.05rem; position: relative; }

/* ── Search ──────────────────────────────────────────────────── */
.search-bar {
  max-width: 560px;
  margin: -1.5rem auto 0;
  position: relative;
  z-index: 10;
}
.search-bar form {
  display: flex;
  background: var(--surface);
  border-radius: 50px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.search-bar input {
  flex: 1;
  border: none;
  padding: .85rem 1.25rem;
  font-size: 1rem;
  outline: none;
  background: transparent;
  color: var(--text);
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-bar button {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0 1.5rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background var(--transition);
}
.search-bar button:hover { background: var(--primary-dark); }

/* ── Nav Tabs (Category) ─────────────────────────────────────── */
.category-nav {
  max-width: 960px;
  margin: 2rem auto 0;
  padding: 0 1rem;
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  justify-content: center;
}
.cat-tab {
  padding: .45rem 1rem;
  border-radius: 50px;
  font-size: .9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.cat-tab:hover, .cat-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ── Main Content ────────────────────────────────────────────── */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

/* Category Section */
.category-section { margin-bottom: 2rem; }
.category-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: .75rem;
  padding-left: .25rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.category-title::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 1.1em;
  background: var(--primary);
  border-radius: 2px;
}

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

/* ── Site Card ───────────────────────────────────────────────── */
.site-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.1rem 1rem;
  box-shadow: var(--shadow);
  transition: all var(--transition);
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
}
.site-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
  transform: translateY(-2px);
  color: inherit;
}
.site-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
}
.site-info { min-width: 0; }
.site-info h3 {
  font-size: .95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-info p {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: .15rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Empty State ─────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty .icon { font-size: 3rem; margin-bottom: .5rem; }

/* ── Footer ──────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: .85rem;
}

/* ── Admin ───────────────────────────────────────────────────── */
.admin-header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: #fff;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.admin-header h1 { font-size: 1.4rem; }
.admin-header a { color: #fff; opacity: .85; }
.admin-header a:hover { opacity: 1; }

.admin-toolbar {
  max-width: 1100px;
  margin: 1.5rem auto 0;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.admin-toolbar form {
  flex: 1;
  min-width: 200px;
  display: flex;
  gap: .5rem;
}
.admin-toolbar input[type="text"] {
  flex: 1;
  padding: .6rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .9rem;
  outline: none;
  transition: border-color var(--transition);
}
.admin-toolbar input[type="text"]:focus { border-color: var(--primary); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .6rem 1.1rem;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-danger  { background: #ef4444; color: #fff; }
.btn-danger:hover  { background: #dc2626; color: #fff; }
.btn-ghost   { background: transparent; color: var(--primary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-sm { padding: .4rem .75rem; font-size: .82rem; }

.admin-table-wrap {
  max-width: 1100px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.admin-table th, .admin-table td {
  padding: .75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
}
.admin-table th {
  background: #f1f5f9;
  font-weight: 600;
  color: var(--text-muted);
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #f8fafc; }
.admin-table .actions { white-space: nowrap; display: flex; gap: .35rem; }
.admin-table .cat-badge {
  display: inline-block;
  padding: .15rem .6rem;
  border-radius: 50px;
  font-size: .78rem;
  background: #ede9fe;
  color: var(--primary);
}
.admin-table .url-cell {
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Admin Form ──────────────────────────────────────────────── */
.form-card {
  max-width: 600px;
  margin: 2rem auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
}
.form-card h2 {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
}
.form-group {
  margin-bottom: 1.25rem;
}
.form-group label {
  display: block;
  font-size: .88rem;
  font-weight: 500;
  margin-bottom: .35rem;
  color: var(--text);
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: .65rem .85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .9rem;
  outline: none;
  transition: border-color var(--transition);
  font-family: inherit;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--primary);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-actions {
  display: flex;
  gap: .75rem;
  margin-top: 1.5rem;
}

/* ── Form Hint ──────────────────────────────────────────────── */
.form-hint {
  display: block;
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: .3rem;
}

/* ── Verify / Login Page ────────────────────────────────────── */
.verify-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  padding: 2rem 1rem;
}
.verify-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
  max-width: 400px;
  width: 100%;
  text-align: center;
}
.verify-icon {
  font-size: 3rem;
  margin-bottom: .75rem;
}
.verify-card h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: .35rem;
}
.verify-desc {
  font-size: .88rem;
  color: var(--text-muted);
  margin-bottom: .25rem;
}
.verify-hint {
  font-size: .82rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}
.verify-error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: .6rem .85rem;
  font-size: .85rem;
  margin-bottom: 1rem;
}
.verify-input-group {
  margin-bottom: 1rem;
}
.verify-input-group input {
  width: 100%;
  padding: .75rem 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  transition: border-color var(--transition);
  text-align: center;
}
.verify-input-group input:focus {
  border-color: var(--primary);
}
.verify-btn {
  width: 100%;
  justify-content: center;
  padding: .75rem;
  font-size: 1rem;
}
.verify-back {
  display: inline-block;
  margin-top: 1rem;
  font-size: .85rem;
  color: var(--text-muted);
}
.verify-back:hover {
  color: var(--primary);
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 640px) {
  .hero { padding: 2rem 1rem 1.5rem; }
  .hero h1 { font-size: 1.5rem; }
  .site-grid { grid-template-columns: 1fr; }
  .admin-table { font-size: .82rem; }
  .admin-table th, .admin-table td { padding: .6rem .65rem; }
}
