/* ============================================
   Jelajahin - Main Stylesheet (Google Clone)
   ============================================ */

/* ---- Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

/* ---- CSS Variables (Google Light Mode) ---- */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f2f2f2;
  --bg-hover: #f8f9fa;
  --text-primary: #202124;
  --text-secondary: #4d5156;
  --text-muted: #70757a;
  --link-title: #1a0dab;
  --link-title-visited: #681da8;
  --link-url: #202124;
  --border-color: #dfe1e5;
  --border-focus: #dfe1e5;
  --input-bg: #ffffff;
  --input-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
  --footer-bg: #f2f2f2;
  --footer-border: #dadce0;
  --btn-bg: #f8f9fa;
  --btn-border: #f8f9fa;
  --btn-hover-border: #dadce0;
  --btn-hover-shadow: 0 1px 1px rgba(0,0,0,0.1);
  --tab-active: #1a73e8;
  --accent-blue: #1a73e8;
  
  /* Admin vars kept for compatibility */
  --toast-success: #16a34a;
  --toast-error: #dc2626;
  --toast-bg: #ffffff;
  --overlay-bg: rgba(0, 0, 0, 0.4);
  --card-bg: #ffffff;
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --card-shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.10);
  --danger: #dc2626;
  --radius-md: 12px;
  --radius-lg: 16px;
  --transition-fast: 0.15s ease;
}

/* ---- Dark Mode (Google Dark Mode) ---- */
[data-theme="dark"] {
  --bg-primary: #202124;
  --bg-secondary: #171717;
  --bg-hover: #303134;
  --text-primary: #bdc1c6;
  --text-secondary: #bdc1c6;
  --text-muted: #9aa0a6;
  --link-title: #8ab4f8;
  --link-title-visited: #c58af9;
  --link-url: #bdc1c6;
  --border-color: #5f6368;
  --border-focus: #5f6368;
  --input-bg: #202124;
  --input-shadow: 0 1px 6px rgba(23, 24, 24, 0.28);
  --footer-bg: #171717;
  --footer-border: #3c4043;
  --btn-bg: #303134;
  --btn-border: #303134;
  --btn-hover-border: #5f6368;
  --tab-active: #8ab4f8;
  
  /* Admin vars */
  --toast-bg: #303134;
  --overlay-bg: rgba(0, 0, 0, 0.7);
  --card-bg: #303134;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: auto; -webkit-text-size-adjust: 100%; }
body {
  font-family: arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 14px;
  display: flex;
  flex-direction: column;
}
a { text-decoration: none; color: var(--link-title); }
button, input { font-family: inherit; outline: none; border: none; }
img { max-width: 100%; height: auto; }

/* ============================================
   HOMEPAGE
   ============================================ */
.navbar-home {
  display: flex;
  justify-content: flex-end;
  padding: 12px 24px;
}
.navbar-actions { display: flex; align-items: center; gap: 15px; }
.top-link { font-size: 13px; color: var(--text-primary); }
.top-link:hover { text-decoration: underline; }
.grid-icon { color: var(--text-muted); display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; fill: currentColor; }
.grid-icon:hover { background: var(--bg-hover); }
.profile-circle { width: 32px; height: 32px; border-radius: 50%; background: #9c27b0; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 16px; }

.homepage {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 50px;
  flex: 1; /* Pushes footer to bottom */
}

.logo-container { margin-bottom: 30px; }
.google-logo { max-height: 92px; }

.search-container {
  width: 100%;
  max-width: 584px;
  margin: 0 auto;
  padding: 0 20px;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  height: 46px;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 0 8px 0 14px;
  margin: 0 auto;
}
.search-input-wrap:hover, .search-input-wrap:focus-within {
  box-shadow: var(--input-shadow);
  border-color: rgba(223,225,229,0);
}
.search-input-wrap .search-icon { color: #9aa0a6; margin-right: 10px; display: flex; align-items: center; width: 20px; height: 20px; fill: currentColor; }
.search-input-wrap input { flex: 1; height: 100%; background: transparent; font-size: 16px; color: var(--text-primary); }
.search-action-icons { display: flex; align-items: center; gap: 12px; padding-right: 8px; }
.search-action-icon { display: flex; align-items: center; justify-content: center; cursor: pointer; width: 24px; height: 24px; }
.search-submit-btn { display: none; }

.search-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
}
.google-btn {
  background-color: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--text-primary);
  font-size: 14px;
  padding: 0 16px;
  height: 36px;
  border-radius: 4px;
  cursor: pointer;
}
.google-btn:hover {
  box-shadow: var(--btn-hover-shadow);
  border-color: var(--btn-hover-border);
  color: #202124;
}

.language-offer { text-align: center; margin-top: 28px; font-size: 13px; color: var(--text-primary); }
.language-offer a { color: var(--link-title); margin: 0 2px; }
.language-offer a:hover { text-decoration: underline; }

/* Google Footer */
.google-footer {
  background: var(--footer-bg);
  color: var(--text-muted);
  font-size: 14px;
}
.footer-top {
  padding: 15px 30px;
  border-bottom: 1px solid var(--footer-border);
}
.footer-bottom {
  display: flex;
  justify-content: space-between;
  padding: 15px 30px;
  flex-wrap: wrap;
}
.footer-left a, .footer-right a {
  color: var(--text-muted);
  margin-right: 28px;
}
.footer-right a { margin-right: 0; margin-left: 28px; }
.footer-left a:hover, .footer-right a:hover { text-decoration: underline; }

/* ============================================
   SEARCH RESULTS PAGE (search.html)
   ============================================ */
.search-header {
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
  position: sticky;
  top: 0;
  z-index: 100;
}
.search-header-top {
  display: flex;
  align-items: center;
  padding: 12px 24px 0 24px;
}
@media (max-width: 768px) {
  .search-header-top { 
    flex-wrap: wrap; 
    padding: 12px 16px 12px 16px; 
    position: relative;
    gap: 0;
  }
  .search-logo-link { 
    width: 100% !important; 
    display: flex;
    justify-content: center;
    margin-bottom: 16px !important; 
  }
  .search-header-right {
    position: absolute;
    top: 12px;
    right: 16px;
    margin-left: 0 !important;
  }
  .search-bar-container { 
    width: 100%;
    flex: 0 0 100%;
    max-width: 100%;
  }
}

.search-logo-link { 
  width: 116px; /* 140px offset - 24px padding = 116px */
  margin-right: 0;
  display: flex;
  margin-bottom: 8px;
}
.search-logo { height: 30px; object-fit: contain; }

.search-bar-container { flex: 1; max-width: 692px; }
.search-bar-form .search-input-wrap {
  margin: 0;
  height: 44px;
  box-shadow: var(--input-shadow);
  border-color: rgba(223,225,229,0);
}
.search-bar-form .search-input-wrap:hover { box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28); }
.search-bar-form .search-icon { display: none; } /* Hidden in header */
@media (max-width: 768px) {
  .search-bar-form .search-icon { display: flex !important; padding-left: 14px; align-items: center; width: 20px; height: 20px; color: #9aa0a6; fill: currentColor; }
  .search-bar-form .search-input-wrap {
    box-shadow: 0 2px 5px 1px rgba(0,0,0,0.1);
    border: 1px solid transparent; /* Remove visible border for mobile */
  }
  .mobile-hide, .desktop-only { display: none !important; }
}
.search-bar-form .clear-btn { color: var(--text-muted); fill: currentColor; }
.search-bar-form .sep {
  width: 1px;
  height: 28px;
  background-color: var(--border-color);
  margin: 0 4px;
}
.search-bar-form .search-submit-btn { background: transparent; cursor: pointer; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }

.search-header-right { display: flex; align-items: center; gap: 15px; margin-left: auto; }
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
  .search-bar-container { max-width: 100%; }
}

.search-tabs {
  margin-left: 140px; /* Aligned with results */
  padding-top: 8px;
}
@media (max-width: 768px) { 
  .search-tabs { 
    margin-left: 0; 
    padding: 0 16px 4px 16px; 
    overflow-x: auto; 
    white-space: nowrap; 
  } 
  .tabs-container { gap: 12px; }
  .tab { padding: 10px 8px; }
  .tab.active {
    color: var(--text-primary) !important;
    border-bottom: 3px solid var(--text-primary) !important;
  }
}
.tabs-container {
  display: flex;
  gap: 20px;
}
.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 4px 10px 4px;
  color: var(--text-muted);
  font-size: 13px;
  fill: currentColor;
  border-bottom: 3px solid transparent;
}
.tab svg { width: 16px; height: 16px; }
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--tab-active); border-bottom-color: var(--tab-active); }

/* Results Container */
.search-page-g { min-height: 100vh; padding-bottom: 20px; }
.results-container-g {
  margin-left: 140px;
  max-width: 652px;
  padding-top: 12px;
}
@media (max-width: 768px) { .results-container-g { margin-left: 16px; padding-right: 16px; } }

.results-info-g {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 18px;
}

/* Result Item */
.result-item { margin-bottom: 28px; }
.result-header-g { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.result-site-g { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.result-favicon-g { width: 26px; height: 26px; border-radius: 50%; object-fit: contain; background: #f1f3f4; padding: 2px; }
.result-site-info-g { display: flex; flex-direction: column; }
.result-sitename-g { font-size: 14px; color: var(--text-primary); line-height: 1.2; }
.result-url-g { font-size: 12px; color: var(--link-url); line-height: 1.2; }
.result-options-g { color: var(--text-muted); cursor: pointer; padding: 0 4px; }

.result-body-g { display: flex; gap: 16px; }
.result-content-g { flex: 1; }
.result-title-g {
  font-size: 20px;
  color: var(--link-title);
  display: inline-block;
  line-height: 1.3;
  margin-bottom: 4px;
  font-family: arial, sans-serif;
}
.result-title-g:visited { color: var(--link-title-visited); }
.result-title-g:hover { text-decoration: underline; }
.result-description-g { font-size: 14px; color: var(--text-secondary); line-height: 1.58; }

.result-image-g { width: 104px; height: 104px; flex-shrink: 0; margin-top: 6px; }
.result-image-g img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }

/* Skeleton */
.skeleton-result { margin-bottom: 28px; animation: pulse 1.5s infinite; }
.skeleton-header { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.skeleton-favicon { width: 26px; height: 26px; border-radius: 50%; background: var(--border-color); }
.skeleton-url-box { display: flex; flex-direction: column; gap: 4px; }
.skeleton-url { width: 100px; height: 12px; background: var(--border-color); border-radius: 4px; }
.skeleton-title { width: 80%; height: 24px; background: var(--border-color); border-radius: 4px; margin-bottom: 8px; }
.skeleton-desc { width: 100%; height: 16px; background: var(--border-color); border-radius: 4px; margin-bottom: 4px; }
.skeleton-desc.short { width: 70%; }
@keyframes pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

.no-results { margin-top: 30px; font-size: 16px; }
.no-results h2 { color: var(--text-primary); font-weight: normal; margin-bottom: 12px; }

/* SERP Footer */
.google-more-btn {
  background: var(--footer-bg);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  color: var(--text-primary);
  padding: 10px 24px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.google-more-btn:hover { background: var(--bg-hover); }

.serp-footer {
  background: var(--footer-bg);
  color: var(--text-muted);
  font-size: 14px;
  width: 100%;
}
.serp-footer-content {
  padding-bottom: 10px;
}
.serp-footer-row {
  padding: 12px 140px;
  border-bottom: 1px solid var(--footer-border);
}
@media (max-width: 768px) { .serp-footer-row { padding: 12px 16px; } }
.serp-footer-top { font-size: 13px; }
.serp-location-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}
.location-dot {
  width: 10px; height: 10px; border-radius: 50%; background: #70757a;
}
.serp-update-location { color: var(--link-title); }
.serp-links-row {
  border-bottom: none;
  display: flex;
  gap: 20px;
  padding-bottom: 0;
}
@media (max-width: 768px) { .serp-links-row { flex-wrap: wrap; } }
.serp-links-row a { color: var(--text-muted); }
.serp-links-row a:hover { color: var(--text-primary); }



/* ============================================
   ADMIN PANEL
   ============================================ */
.admin-page {
  padding-top: 80px;
  min-height: 100vh;
}

.admin-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

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

.admin-header h1 {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.admin-header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
}
.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: var(--danger-hover);
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.35);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
}

/* ---- Stats Cards ---- */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--card-shadow);
  transition: all var(--transition-fast);
}

.stat-card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-card .stat-icon.blue {
  background: #eff6ff;
  color: #2563eb;
}
.stat-card .stat-icon.green {
  background: #ecfdf5;
  color: #16a34a;
}
.stat-card .stat-icon.purple {
  background: #f5f3ff;
  color: #7c3aed;
}

[data-theme="dark"] .stat-card .stat-icon.blue {
  background: #1e3a5f;
}
[data-theme="dark"] .stat-card .stat-icon.green {
  background: #14532d;
}
[data-theme="dark"] .stat-card .stat-icon.purple {
  background: #3b0764;
}

.stat-card .stat-info h3 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.stat-card .stat-info p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---- Keywords Table ---- */
.keywords-table-wrap {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

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

.keywords-table-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.search-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--input-bg);
}

.search-filter input {
  border: none;
  background: transparent;
  font-size: 0.85rem;
  color: var(--text-primary);
  width: 180px;
}

.search-filter input::placeholder {
  color: var(--text-muted);
}

.keywords-table {
  width: 100%;
  border-collapse: collapse;
}

.keywords-table th {
  text-align: left;
  padding: 14px 24px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
  background: var(--admin-sidebar);
}

.keywords-table td {
  padding: 14px 24px;
  font-size: 0.92rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.keywords-table tr:hover td {
  background: var(--result-hover-bg);
}

.keywords-table tr:last-child td {
  border-bottom: none;
}

.keyword-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 0.85rem;
  font-weight: 600;
}

.result-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 0.82rem;
  font-weight: 700;
}

.actions-cell {
  display: flex;
  gap: 8px;
}

.empty-table {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-table .empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-table p {
  font-size: 0.95rem;
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--overlay-bg);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

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

.modal {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.3s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  background: var(--card-bg);
  z-index: 1;
}

.modal-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--result-hover-bg);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  position: sticky;
  bottom: 0;
  background: var(--card-bg);
}

/* ---- Form Styles ---- */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.form-group label .required {
  color: var(--danger);
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-md);
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control::placeholder {
  color: var(--text-muted);
}

textarea.form-control {
  min-height: 80px;
  resize: vertical;
}

.form-help {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ---- Result Items in Form ---- */
.result-form-items {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.result-form-item {
  background: var(--admin-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  position: relative;
  animation: fadeIn 0.3s ease;
}

.result-form-item .result-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.result-form-item .result-item-header span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-blue);
}

.result-form-item .remove-result-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--danger);
  font-size: 1rem;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
}

.result-form-item .remove-result-btn:hover {
  background: rgba(220, 38, 38, 0.1);
}

.result-form-item .form-group {
  margin-bottom: 12px;
}

.result-form-item .form-group:last-child {
  margin-bottom: 0;
}

.add-result-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.add-result-btn:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  background: var(--badge-bg);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  background: var(--toast-bg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  border-left: 4px solid var(--toast-success);
  animation: slideInRight 0.3s ease;
  min-width: 300px;
  max-width: 450px;
}

.toast.error {
  border-left-color: var(--toast-error);
}

.toast.success {
  border-left-color: var(--toast-success);
}

.toast .toast-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.toast .toast-message {
  font-size: 0.9rem;
  color: var(--text-primary);
  flex: 1;
}

.toast .toast-close {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  flex-shrink: 0;
}

.toast-exit {
  animation: slideOutRight 0.3s ease forwards;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  border-top: 1px solid var(--border-color);
  background: var(--admin-sidebar);
  padding: 20px 32px;
  transition: all var(--transition-normal);
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-copyright {
  font-size: 0.82rem;
  color: var(--text-muted);
}

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

.footer-links a {
  font-size: 0.82rem;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

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

/* ============================================
   CONFIRM DIALOG
   ============================================ */
.confirm-dialog {
  text-align: center;
  padding: 12px 0;
}

.confirm-dialog .confirm-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.confirm-dialog h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.confirm-dialog p {
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* ============================================
   IMPORT/EXPORT
   ============================================ */
.export-textarea {
  width: 100%;
  min-height: 200px;
  padding: 16px;
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-md);
  background: var(--input-bg);
  color: var(--text-primary);
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  resize: vertical;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100px);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ---- Staggered animation delay for result items ---- */
.result-item:nth-child(1) { animation-delay: 0s; }
.result-item:nth-child(2) { animation-delay: 0.05s; }
.result-item:nth-child(3) { animation-delay: 0.1s; }
.result-item:nth-child(4) { animation-delay: 0.15s; }
.result-item:nth-child(5) { animation-delay: 0.2s; }
.result-item:nth-child(6) { animation-delay: 0.25s; }
.result-item:nth-child(7) { animation-delay: 0.3s; }
.result-item:nth-child(8) { animation-delay: 0.35s; }
.result-item:nth-child(9) { animation-delay: 0.4s; }
.result-item:nth-child(10) { animation-delay: 0.45s; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .navbar {
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .navbar-brand {
    order: 1;
  }

  .navbar-brand span {
    display: none;
  }
  
  .navbar-actions {
    order: 2;
  }
  
  .navbar-brand img {
    height: 36px;
  }

  .navbar-actions {
    grid-area: actions;
    justify-self: end;
  }

  .navbar-search {
    order: 3;
    width: 100%;
    margin: 0;
    max-width: 100%;
  }
  
  .navbar-search .search-input-wrap .search-icon {
    display: flex;
  }
  
  .navbar-search .search-input-wrap input {
    padding-left: 0;
    font-size: 16px;
  }

  .admin-link span {
    display: none;
  }

  .theme-toggle {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    justify-content: center;
  }

  .theme-toggle span:not(.icon) {
    display: none;
  }
  
  .theme-toggle .icon {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .homepage {
    padding: 60px 16px 40px;
  }

  .logo-container img {
    max-width: 280px;
  }

  .search-input-wrap {
    height: 48px;
  }

  .search-btn {
    padding: 8px 18px;
    font-size: 0.88rem;
  }

  .quick-links {
    gap: 10px;
  }

  .quick-link-btn {
    padding: 10px 18px;
    font-size: 0.82rem;
  }

  .admin-header h1 {
    font-size: 1.4rem;
  }

  .admin-stats {
    grid-template-columns: 1fr;
  }

  .keywords-table-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .search-filter input {
    width: 100%;
  }

  .keywords-table {
    display: block;
    overflow-x: auto;
  }

  .modal {
    max-height: 92vh;
    border-radius: var(--radius-md);
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
  }

  .toast {
    min-width: unset;
    max-width: calc(100vw - 40px);
  }

  .result-item:hover {
    padding-left: 12px;
    margin: 0 -12px;
    padding-right: 12px;
  }
}

@media (max-width: 480px) {
  .admin-header-actions {
    width: 100%;
  }

  .admin-header-actions .btn {
    flex: 1;
    justify-content: center;
  }

  .actions-cell {
    flex-direction: column;
    gap: 4px;
  }
}


/* Error Shake Animation */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}
.error-shake {
  animation: shake 0.4s ease-in-out;
  border: 1px solid var(--danger-color) !important;
}

/* ============================================
   ADMIN DASHBOARD SIDEBAR LAYOUT
   ============================================ */

/* Wrapper for sidebar + content */
#adminContentWrapper {
  flex-direction: row;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: center;
}

.sidebar-user {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  border-bottom: 1px solid var(--border-color);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-blue);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.user-info h4 {
  margin: 0;
  font-size: 1rem;
  color: var(--text-primary);
}

.badge {
  font-size: 0.75rem;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  display: inline-block;
  margin-top: 4px;
}

.sidebar-nav {
  flex: 1;
  padding: 15px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow-y: auto;
}

.nav-item {
  padding: 12px 15px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition-fast);
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(26, 115, 232, 0.1);
  color: var(--accent-blue);
}

.sidebar-footer {
  padding: 15px;
  border-top: 1px solid var(--border-color);
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  overflow-y: auto;
}

.main-header {
  height: 70px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  flex-shrink: 0;
}

.main-header h2 {
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--text-primary);
}

.content-body {
  padding: 30px;
  flex: 1;
}

/* Make sure active sections display */
.admin-section {
  display: none;
  animation: slideInRight 0.3s ease;
}

.admin-section.active {
  display: block;
}

/* Responsive Sidebar */
@media (max-width: 768px) {
  #adminContentWrapper {
    flex-direction: column;
    overflow-y: auto;
  }
  .sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    padding: 10px;
  }
  .nav-item {
    padding: 8px 12px;
    white-space: nowrap;
  }
  .main-content {
    overflow-y: visible;
  }
  .content-body {
    padding: 15px;
  }
}


