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

:root {
  --bg: #f5f7fa;
  --card-bg: #ffffff;
  --text: #333333;
  --text-secondary: #666666;
  --accent: #4a90d9;
  --border: #e8ecf1;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  --radius: 8px;
  --danger: #e74c3c;
}

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

/* ============================================================
   HOME PAGE
   ============================================================ */

.home-body {
  background: #0f172a;
  color: #e2e8f0;
}

/* --- Hero Banner --- */
.hero {
  position: relative;
  padding: 60px 20px 48px;
  text-align: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(74,144,217,0.25) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(108,92,231,0.2) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(26,188,156,0.15) 0%, transparent 50%);
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin: 0 auto;
}

.hero-title {
  font-size: 40px;
  font-weight: 800;
  background: linear-gradient(135deg, #60a5fa, #a78bfa, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
  letter-spacing: 2px;
}

.hero-subtitle {
  font-size: 14px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 28px;
}

.hero-search {
  position: relative;
  max-width: 480px;
  margin: 0 auto 24px;
}

.hero-search .search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.4);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.hero-search input {
  width: 100%;
  padding: 14px 20px 14px 46px;
  font-size: 15px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  outline: none;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  color: #fff;
  transition: all 0.3s;
}

.hero-search input::placeholder {
  color: rgba(255,255,255,0.35);
}

.hero-search input:focus {
  border-color: rgba(74,144,217,0.5);
  background: rgba(255,255,255,0.12);
  box-shadow: 0 0 0 4px rgba(74,144,217,0.15);
}

/* --- Stats --- */
.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.stat-item {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.stat-num {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 13px;
  color: rgba(255,255,255,0.45);
}

.stat-divider {
  width: 1px;
  height: 24px;
  background: rgba(255,255,255,0.15);
}

/* --- Main Content --- */
.home-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

/* --- Category --- */
.home-category {
  margin-bottom: 36px;
}

.home-category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 0 4px;
}

.home-category-bar {
  width: 3px;
  height: 20px;
  border-radius: 2px;
  flex-shrink: 0;
}

.home-category-icon {
  font-size: 20px;
}

.home-category-title {
  font-size: 17px;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  flex: 1;
}

.home-category-count {
  font-size: 12px;
  font-weight: 600;
  background: rgba(255,255,255,0.06);
  padding: 2px 10px;
  border-radius: 10px;
}

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

/* --- Site Card --- */
.home-site-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 12px;
  text-decoration: none;
  color: #e2e8f0;
  transition: all 0.2s;
}

.home-site-card:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(74,144,217,0.4);
  transform: translateX(4px);
}

.home-site-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  flex-shrink: 0;
}

.home-site-body {
  flex: 1;
  min-width: 0;
}

.home-site-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-site-desc {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-site-arrow {
  font-size: 18px;
  color: rgba(255,255,255,0.2);
  flex-shrink: 0;
  transition: all 0.2s;
}

.home-site-card:hover .home-site-arrow {
  color: rgba(74,144,217,0.8);
  transform: translateX(2px);
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 80px 20px;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-text {
  font-size: 15px;
  color: rgba(255,255,255,0.4);
}

/* --- Home Footer --- */
.footer--home {
  text-align: center;
  padding: 24px 20px;
  color: rgba(255,255,255,0.3);
  font-size: 13px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: transparent;
}

.footer-admin {
  display: inline-block;
  padding: 4px 14px;
  font-size: 12px;
  color: rgba(255,255,255,0.35);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  text-decoration: none;
  margin-bottom: 12px;
  transition: all 0.2s;
}

.footer-admin:hover {
  color: rgba(255,255,255,0.7);
  border-color: rgba(74,144,217,0.4);
}

/* --- Home Responsive --- */
@media (max-width: 768px) {
  .hero { padding: 48px 16px 36px; }
  .hero-title { font-size: 30px; }
  .home-sites-grid { grid-template-columns: 1fr; }
  .stat-num { font-size: 22px; }
}

@media (max-width: 480px) {
  .hero { padding: 36px 16px 28px; }
  .hero-title { font-size: 26px; }
  .hero-search input { padding: 12px 16px 12px 40px; font-size: 14px; }
  .home-site-card { padding: 12px 14px; gap: 10px; }
  .home-site-avatar { width: 36px; height: 36px; font-size: 15px; }
  .home-category-title { font-size: 15px; }
}

/* ============================================================
   ADMIN PAGE
   ============================================================ */

/* --- Shared Header --- */
.header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 24px 0 20px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 14px;
  padding: 0 20px;
}

.logo {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
}

.header-link {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  padding: 6px 16px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.header-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* --- Admin Header --- */
.header--admin {
  background: #1a1d23;
  border-bottom: 2px solid var(--accent);
}

.logo--admin {
  color: #fff;
  letter-spacing: 1px;
}

.header-link--admin {
  border-color: rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.7);
}

.header-link--admin:hover {
  border-color: var(--accent);
  color: #fff;
}

.admin-body {
  background: #f0f2f5;
}

/* --- Admin Container --- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px 40px;
}

/* --- Category --- */
.category {
  margin-bottom: 40px;
}

.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-left: 4px;
}

.category-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.category-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* --- Sites Grid --- */
.sites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

/* --- Site Card --- */
.site-card {
  position: relative;
  display: block;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.site-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.site-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.site-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* --- Card Actions --- */
.card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
}

.card-actions button {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--text-secondary);
  transition: all 0.15s;
}

.card-actions button:hover {
  background: var(--accent);
  color: #fff;
}

.card-actions button.btn-delete:hover {
  background: var(--danger);
  color: #fff;
}

/* --- Add Site Card --- */
.add-site-card {
  background: var(--card-bg);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  transition: border-color 0.15s, color 0.15s;
}

.add-site-card:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* --- Locked Site --- */
.site-card--locked {
  border-left: 3px solid var(--danger);
}

.lock-badge {
  font-size: 13px;
}

/* --- Drag & Drop --- */
.drag-handle {
  cursor: grab;
  font-size: 18px;
  color: var(--text-secondary);
  padding: 0 6px 0 0;
  user-select: none;
  opacity: 0.4;
  transition: opacity 0.15s;
}

.drag-handle:hover {
  opacity: 1;
}

.category[draggable="true"] .category-header {
  display: flex;
  align-items: center;
  gap: 0;
}

.category--dragging {
  opacity: 0.4;
  background: var(--bg);
  border-radius: 8px;
}

.category--drag-over {
  position: relative;
}

.category--drag-over::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

/* --- Admin Bar --- */
.admin-bar {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  gap: 12px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.admin-bar-btn {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}

.admin-bar-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.admin-bar-btn--danger:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* --- Icon Buttons --- */
.icon-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--text-secondary);
  transition: all 0.15s;
}

.icon-btn:hover {
  background: var(--danger);
  color: #fff;
}

/* --- Modal --- */
.modal-checkbox {
  margin-top: 16px;
}

.modal-checkbox label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  margin: 0;
}

.modal-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  padding: 20px 24px 0;
}

.modal-body {
  padding: 20px 24px;
}

.modal-body label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  margin-top: 12px;
}

.modal-body label:first-child {
  margin-top: 0;
}

.modal-body input[type="text"] {
  width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  transition: border-color 0.2s;
}

.modal-body input[type="text"]:focus {
  border-color: var(--accent);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
}

.modal-btn {
  padding: 8px 20px;
  font-size: 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.modal-btn:hover {
  opacity: 0.85;
}

.modal-btn--cancel {
  background: var(--bg);
  color: var(--text-secondary);
}

.modal-btn--confirm {
  background: var(--accent);
  color: #fff;
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 24px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s;
}

.toast.show {
  opacity: 1;
}

.toast--success {
  background: #27ae60;
  color: #fff;
}

.toast--error {
  background: var(--danger);
  color: #fff;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #0f172a;
}

.login-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  backdrop-filter: blur(16px);
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  margin-bottom: 4px;
}

.login-subtitle {
  text-align: center;
  color: rgba(255,255,255,0.4);
  font-size: 14px;
  margin-bottom: 28px;
}

.login-field {
  margin-bottom: 18px;
}

.login-field label {
  display: block;
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 6px;
}

.login-field input {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  outline: none;
  background: rgba(255,255,255,0.06);
  color: #fff;
  transition: all 0.2s;
}

.login-field input::placeholder {
  color: rgba(255,255,255,0.3);
}

.login-field input:focus {
  border-color: rgba(74,144,217,0.5);
  box-shadow: 0 0 0 3px rgba(74,144,217,0.15);
}

.login-error {
  font-size: 13px;
  color: #ef4444;
  margin-bottom: 12px;
  min-height: 18px;
}

.login-btn {
  width: 100%;
  padding: 11px;
  font-size: 15px;
  font-weight: 600;
  background: linear-gradient(135deg, #4a90d9, #6c5ce7);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.login-btn:hover {
  opacity: 0.85;
}

.login-back {
  display: block;
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: rgba(255,255,255,0.35);
  text-decoration: none;
}

.login-back:hover {
  color: rgba(255,255,255,0.7);
}

/* --- Logout --- */
.header-logout {
  position: absolute;
  left: 20px;
  right: auto;
  color: var(--danger);
  border-color: var(--danger);
}

.header--admin .header-logout {
  border-color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.7);
}

.header--admin .header-logout:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

/* --- Shared Footer --- */
.footer {
  text-align: center;
  padding: 24px;
  color: var(--text-secondary);
  font-size: 13px;
  border-top: 1px solid var(--border);
  background: #fff;
}

/* --- Admin Responsive --- */
@media (max-width: 600px) {
  .sites-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
  }
  .site-card { padding: 14px; }
  .header-link { padding: 4px 12px; font-size: 12px; }
}
