/* ============================================
   LINK HUB — Professional Stylesheet
   ============================================ */

:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #e0e7ff;
  --secondary: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --dark: #0f172a;
  --gray-900: #111827;
  --gray-800: #1f2937;
  --gray-700: #374151;
  --gray-600: #4b5563;
  --gray-500: #6b7280;
  --gray-400: #9ca3af;
  --gray-300: #d1d5db;
  --gray-200: #e5e7eb;
  --gray-100: #f3f4f6;
  --gray-50: #f9fafb;
  --white: #ffffff;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --shadow: 0 4px 24px rgba(0,0,0,.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.12);
  --shadow-card: 0 2px 8px rgba(79,70,229,.08), 0 8px 24px rgba(0,0,0,.06);
  --transition: all .25s cubic-bezier(.4,0,.2,1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: #f0f2ff;
  color: var(--gray-800);
  min-height: 100vh;
  line-height: 1.6;
}

/* === BACKGROUND PATTERN === */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(79,70,229,.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 110%, rgba(6,182,212,.1) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* === NAVBAR === */
.navbar-main {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(79,70,229,.1);
  padding: 0;
}
.navbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.brand-logo {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(79,70,229,.35);
}
.brand-text { line-height: 1.2; }
.brand-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -.3px;
}
.brand-subtitle {
  font-size: 11px;
  color: var(--gray-500);
  font-weight: 500;
}
.navbar-search {
  flex: 1;
  max-width: 360px;
}
.search-box {
  position: relative;
}
.search-box input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  border: 1.5px solid var(--gray-200);
  border-radius: 50px;
  font-size: 14px;
  background: var(--gray-50);
  transition: var(--transition);
  outline: none;
}
.search-box input:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.search-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 14px;
}
.navbar-actions { display: flex; align-items: center; gap: 8px; }
.btn-admin {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
}
.btn-admin:hover { background: var(--primary-dark); transform: translateY(-1px); color: white; }

/* === HERO === */
.hero {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 64px 24px 48px;
  max-width: 700px;
  margin: 0 auto;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(28px, 5vw, 46px);
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -1px;
  line-height: 1.15;
  margin-bottom: 16px;
}
.hero h1 span {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  font-size: 16px;
  color: var(--gray-500);
  max-width: 500px;
  margin: 0 auto 32px;
}
.hero-stats {
  display: flex; justify-content: center; gap: 32px;
}
.stat {
  text-align: center;
}
.stat-num {
  font-size: 22px;
  font-weight: 800;
  color: var(--gray-900);
}
.stat-label {
  font-size: 12px;
  color: var(--gray-500);
  font-weight: 500;
}

/* === MAIN CONTENT === */
.main-content {
  position: relative; z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* === FILTER TABS === */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 40px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }
.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: 1.5px solid var(--gray-200);
  border-radius: 50px;
  background: white;
  color: var(--gray-600);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(79,70,229,.3);
}
.filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  background: rgba(255,255,255,.25);
}
.filter-btn:not(.active) .filter-count {
  background: var(--gray-100);
  color: var(--gray-600);
}

/* === SECTION TITLE === */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-800);
}
.section-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 14px;
}
.section-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-400);
}

/* === LINK CARDS GRID === */
.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 48px;
}

/* === LINK CARD === */
.link-card {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(255,255,255,.8);
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
}
.link-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-color, var(--primary));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s ease;
}
.link-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(79,70,229,.1);
}
.link-card:hover::before {
  transform: scaleX(1);
}
.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.card-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.card-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.3;
}
.card-desc {
  font-size: 13px;
  color: var(--gray-500);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--gray-100);
}
.card-url {
  font-size: 11px;
  color: var(--gray-400);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}
.card-open-btn {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  flex-shrink: 0;
}
.card-open-btn i { transition: transform .2s; }
.link-card:hover .card-open-btn i { transform: translate(2px, -2px); }

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: 64px 24px;
}
.empty-icon {
  width: 80px; height: 80px;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  font-size: 32px;
  color: var(--primary);
}
.empty-state h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.empty-state p { font-size: 14px; color: var(--gray-500); }

/* === ADMIN PANEL === */
.admin-layout {
  display: flex;
  min-height: 100vh;
  background: #f0f2ff;
}

/* === SIDEBAR === */
.sidebar {
  width: 260px;
  background: white;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  box-shadow: var(--shadow);
}
.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; gap: 12px;
  text-decoration: none;
}
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}
.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray-400);
  padding: 8px 8px 4px;
  margin-top: 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--gray-600);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
}
.nav-item i { width: 18px; text-align: center; font-size: 15px; }
.nav-item:hover { background: var(--gray-50); color: var(--primary); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 50px;
}
.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--gray-100);
}

/* === ADMIN MAIN === */
.admin-main {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.admin-header {
  background: white;
  padding: 20px 32px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.page-title h1 { font-size: 22px; font-weight: 800; color: var(--gray-900); }
.page-title p { font-size: 13px; color: var(--gray-500); }
.admin-body {
  flex: 1;
  padding: 28px 32px;
}

/* === STATS CARDS === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}
.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-card-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-card-num {
  font-size: 26px;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1;
}
.stat-card-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  margin-top: 2px;
}

/* === TABLE === */
.table-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.table-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.table-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
}
.table-actions {
  display: flex; align-items: center; gap: 8px;
}
.table-responsive { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
thead th {
  background: var(--gray-50);
  padding: 12px 20px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
tbody td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--gray-50); }
.td-link-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px;
  color: white;
}
.td-title { font-weight: 600; color: var(--gray-900); }
.td-url {
  font-size: 12px;
  color: var(--gray-400);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* === BADGES === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 600;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79,70,229,.3); color: white; }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-success { background: #d1fae5; color: #065f46; }
.btn-success:hover { background: var(--success); color: white; }
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: white; }
.btn-icon {
  width: 34px; height: 34px;
  padding: 0;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
}

/* === MODAL === */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn .25s cubic-bezier(.34,1.56,.64,1);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.92) translateY(20px); }
  to   { opacity: 1; transform: scale(1)  translateY(0); }
}
.modal-header {
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  background: var(--gray-100);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  font-size: 16px;
}
.modal-close:hover { background: var(--gray-200); }
.modal-body { padding: 24px 28px; }
.modal-footer {
  padding: 16px 28px 24px;
  display: flex; gap: 8px; justify-content: flex-end;
  border-top: 1px solid var(--gray-100);
}

/* === FORM === */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.form-label span { color: var(--danger); }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  font-size: 14px;
  font-family: var(--font);
  color: var(--gray-800);
  background: var(--gray-50);
  transition: var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.form-control::placeholder { color: var(--gray-400); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 12px; color: var(--gray-400); margin-top: 4px; }
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* === COLOR PICKER === */
.color-options {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-top: 8px;
}
.color-opt {
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
  position: relative;
}
.color-opt.selected {
  border-color: var(--gray-900);
  transform: scale(1.15);
}
.color-opt::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 11px;
  font-weight: 700;
  opacity: 0;
}
.color-opt.selected::after { opacity: 1; }

/* === ICON PICKER === */
.icon-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  padding: 4px;
}
.icon-opt {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  transition: var(--transition);
  border: 1.5px solid transparent;
  color: var(--gray-600);
}
.icon-opt:hover { background: var(--gray-100); }
.icon-opt.selected { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

/* === ALERTS === */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning  { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info     { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* === TOAST === */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--gray-900);
  color: white;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: toastIn .3s ease;
  min-width: 240px;
}
.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* === LOGIN PAGE === */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  font-size: 26px;
  color: white;
  box-shadow: 0 8px 24px rgba(79,70,229,.4);
}
.login-title {
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 6px;
}
.login-sub {
  text-align: center;
  font-size: 14px;
  color: var(--gray-500);
  margin-bottom: 28px;
}

/* === DRAG HANDLE === */
.drag-handle {
  cursor: grab;
  color: var(--gray-300);
  font-size: 16px;
  transition: color .2s;
}
.drag-handle:hover { color: var(--gray-500); }

/* === DIVIDER === */
.divider {
  height: 1px;
  background: var(--gray-100);
  margin: 28px 0;
}

/* === SWITCH TOGGLE === */
.switch {
  position: relative;
  display: inline-block;
  width: 40px; height: 22px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  inset: 0;
  background: var(--gray-300);
  border-radius: 50px;
  cursor: pointer;
  transition: .3s;
}
.slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: white;
  left: 3px; top: 3px;
  transition: .3s;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* ══════════════════════════════════════════
   RESPONSIVE — ADMIN MOBILE FRIENDLY
══════════════════════════════════════════ */

/* ── Overlay gelap saat sidebar terbuka ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 99;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

/* ── Hamburger button ── */
.btn-hamburger {
  display: none;
  width: 38px; height: 38px;
  border: none;
  background: var(--gray-100);
  border-radius: 9px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--gray-700);
  flex-shrink: 0;
  transition: var(--transition);
}
.btn-hamburger:hover { background: var(--gray-200); }

/* ── Admin page title responsif ── */
.page-title { flex: 1; }
.page-title h1 { font-size: clamp(16px, 4vw, 22px); }

/* ── Admin header button responsif ── */
.admin-header .btn { white-space: nowrap; }

@media (max-width: 768px) {

  /* ── Sidebar: tersembunyi default, slide masuk ── */
  .sidebar {
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }

  /* ── Hamburger tampil di mobile ── */
  .btn-hamburger { display: flex; }

  /* ── Navbar: shrink di mobile ── */
  .navbar-inner { padding: 0 16px; }
  .navbar-search { display: none; }
  .brand-title { font-size: 14px; }
  .brand-subtitle { font-size: 10px; }
  .btn-admin { padding: 7px 14px; font-size: 12px; }

  /* ── Konten utama tidak perlu margin kiri ── */
  .admin-main { margin-left: 0; }

  /* ── Header admin ── */
  .admin-header {
    padding: 14px 16px;
    gap: 10px;
  }
  .page-title h1 { font-size: 17px; }
  .page-title p  { display: none; }   /* sembunyikan subtitle di mobile */

  /* ── Body admin ── */
  .admin-body { padding: 16px; }

  /* ── Stats: 2 kolom di mobile ── */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
  }
  .stat-card { padding: 14px 16px; gap: 10px; }
  .stat-card-icon { width: 38px; height: 38px; font-size: 16px; border-radius: 9px; }
  .stat-card-num  { font-size: 20px; }

  /* ── Table header: stack vertikal ── */
  .table-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 16px;
    gap: 10px;
  }
  .table-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }
  .table-actions form {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }
  .table-actions select {
    min-width: 120px !important;
  }
  .table-actions button,
  .table-actions a {
    white-space: nowrap;
  }
  thead th { padding: 10px 12px; font-size: 10px; }
  tbody td { padding: 12px 12px; font-size: 13px; }

  /* ── Admin pages: padding responsif ── */
  .admin-body { padding: 16px; }

  /* ── Form row: 1 kolom ── */
  .form-row { grid-template-columns: 1fr; }

  /* ── Modal: full screen di mobile ── */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    max-width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 92vh;
  }
  .modal-header { padding: 18px 20px 14px; }
  .modal-body   { padding: 16px 20px; }
  .modal-footer { padding: 12px 20px 20px; }

  /* ── Icon grid: 6 kolom di mobile ── */
  .icon-grid { grid-template-columns: repeat(6, 1fr); }

  /* ── Sembunyikan kolom tabel yang tidak penting ── */
  .col-hide-mobile { display: none; }

  /* ── Tombol aksi: lebih besar (touch target) ── */
  .btn-icon { width: 38px; height: 38px; }

  /* ── Login card ── */
  .login-card { padding: 28px 20px; border-radius: 16px; }

  /* ── Table card responsif ── */
  .table-card { border-radius: 12px; margin-bottom: 16px; }
  .table-responsive::-webkit-scrollbar { height: 6px; }
  .table-responsive::-webkit-scrollbar-track { background: var(--gray-100); }
  .table-responsive::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }

  /* ── Navbar responsif utk mobile ── */
  @media (max-width: 520px) {
    .navbar-inner { padding: 0 12px; }
    .navbar-brand { gap: 8px; }
    .brand-logo { width: 36px; height: 36px; font-size: 16px; }
    .brand-title { font-size: 13px; }
    .brand-subtitle { display: none; }
  }
}

@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr; }
  .admin-body { padding: 12px; }
  .admin-header { padding: 12px; flex-direction: column; align-items: flex-start; }
  .admin-header > div:last-child { width: 100%; }
  .admin-header .btn { width: 100%; }
  .table-header { padding: 12px; }
  div[style*="max-width:740px"] { padding: 16px 12px !important; }
}

/* ── Sembunyikan teks tombol di mobile ── */
@media (max-width: 480px) {
  .btn-text { display: none; }
  .table-actions { gap: 6px; }
  .btn-sm { padding: 6px 10px; font-size: 11px; }
  .page-title h1 { font-size: 15px; }
  .form-row { grid-template-columns: 1fr; gap: 12px; }
}

/* ══════════════════════════════════════════
   FILTER FORM (links.php)
══════════════════════════════════════════ */
.filter-form {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
  flex-wrap: wrap;
}
.filter-select {
  flex: 1;
  min-width: 130px;
  padding: 8px 32px 8px 12px !important;
}
.filter-search {
  position: relative;
  flex: 2;
  min-width: 160px;
}
.filter-search i {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 13px;
  pointer-events: none;
}
.filter-search input { width: 100%; padding-left: 34px !important; }
@media (max-width: 768px) {
  .filter-form { gap: 6px; }
  .filter-select { min-width: 110px; font-size: 13px; }
  .filter-search { min-width: 0; flex: 1; }
}

/* ══════════════════════════════════════════
   SETTINGS PAGE
══════════════════════════════════════════ */
.settings-wrap { max-width: 700px; }
@media (max-width: 768px) {
  .settings-wrap { max-width: 100%; }
  .settings-wrap .table-card form { padding: 16px !important; }
}

/* ══════════════════════════════════════════
   BOTTOM NAV — navigasi bawah mobile admin
══════════════════════════════════════════ */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: white;
  border-top: 1px solid var(--gray-200);
  z-index: 150;
  box-shadow: 0 -4px 16px rgba(0,0,0,.06);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-inner {
  display: flex;
  height: 58px;
  align-items: stretch;
  padding: 0 4px;
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--gray-400);
  font-size: 10px;
  font-weight: 600;
  border-radius: 10px;
  transition: color .15s, background .15s;
  padding: 6px 2px;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-item i { font-size: 18px; line-height: 1; }
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-item.active i {
  background: var(--primary-light);
  color: var(--primary);
  width: 36px; height: 24px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.bottom-nav-item:active { background: var(--gray-50); }

/* Sembunyikan paksa di desktop — sidebar sudah cukup sebagai navigasi */
@media (min-width: 769px) {
  .bottom-nav        { display: none !important; }
  .admin-body        { padding-bottom: 28px !important; }
  #btnCloseSidebar   { display: none !important; }
  .btn-hamburger     { display: none !important; }
}

/* Tampilkan hanya di mobile */
@media (max-width: 768px) {
  .bottom-nav        { display: block; }
  .admin-body        { padding-bottom: 74px !important; }
  #btnCloseSidebar   { display: flex !important; }
  .btn-hamburger     { display: flex !important; }
}

/* === UTILITIES === */
.text-muted { color: var(--gray-500) !important; }
.text-primary { color: var(--primary) !important; }
.fw-bold { font-weight: 700 !important; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mb-0 { margin-bottom: 0 !important; }
.mt-auto { margin-top: auto; }
.ms-auto { margin-left: auto; }
.w-100 { width: 100%; }
