/* =========================================================
   Admin Panel Styles
   ========================================================= */

:root {
  --brand: #1a56db;
  --brand-dark: #1e40af;
  --brand-light: #eff6ff;
  --accent: #0ea5e9;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --warning: #f59e0b;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --sidebar: #0f172a;
  --sidebar-hover: #1e293b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 8px rgba(15,23,42,.06);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text);
  background: var(--bg-soft);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

/* ===== Login ===== */
.login-body {
  min-height: 100vh;
  display: grid; place-items: center;
  background:
    radial-gradient(800px 400px at 20% 0%, rgba(26,86,219,.16), transparent 60%),
    radial-gradient(700px 500px at 100% 100%, rgba(14,165,233,.15), transparent 60%),
    #0f172a;
  padding: 40px 20px;
}
.login-box {
  background: #fff; border-radius: 18px; width: 100%; max-width: 420px;
  padding: 36px; box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand h1 { margin: 14px 0 4px; font-size: 1.4rem; }
.login-brand p { margin: 0; color: var(--text-muted); font-size: .9rem; }
.login-brand .logo-mark {
  width: 56px; height: 56px; border-radius: 14px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #fff; display: inline-grid; place-items: center; font-size: 1.2rem;
  box-shadow: 0 8px 20px rgba(26,86,219,.35);
}
.login-form label { display: block; font-size: .85rem; color: var(--text-muted); font-weight: 500; margin-bottom: 14px; }
.input-with-icon { position: relative; margin-top: 6px; }
.input-with-icon i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: .9rem; }
.input-with-icon input {
  width: 100%; padding: 12px 14px 12px 40px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .95rem;
  font-family: inherit; color: var(--text);
}
.input-with-icon input:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(26,86,219,.15);
}
.back-link { display: block; text-align: center; margin-top: 16px; font-size: .85rem; color: var(--text-muted); }
.back-link:hover { color: var(--brand); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-sm); font-weight: 600;
  font-size: .9rem; cursor: pointer; transition: all .15s; border: 1px solid transparent;
  font-family: inherit; line-height: 1;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-ghost { background: #fff; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-soft); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 10px; font-size: .82rem; }

/* ===== Shell ===== */
.admin-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.admin-sidebar {
  background: var(--sidebar); color: #cbd5e1;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px; padding: 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand .logo-mark {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #fff; display: grid; place-items: center;
}
.sidebar-brand strong { color: #fff; display: block; font-size: .95rem; }
.sidebar-brand small { color: #94a3b8; font-size: .75rem; }

.sidebar-nav { padding: 12px 0; flex: 1; }
.nav-group {
  padding: 16px 20px 6px; color: #64748b; font-size: .7rem;
  text-transform: uppercase; letter-spacing: .1em; font-weight: 700;
}
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; color: #cbd5e1; font-size: .9rem;
  transition: background .15s, color .15s;
}
.sidebar-nav a i { width: 18px; text-align: center; color: #94a3b8; }
.sidebar-nav a:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav a:hover i { color: #fff; }
.sidebar-nav a.active {
  background: linear-gradient(90deg, rgba(26,86,219,.25), transparent);
  color: #fff; border-left: 3px solid var(--brand); padding-left: 17px;
}
.sidebar-nav a.active i { color: #60a5fa; }

.sidebar-foot {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 14px 20px; display: flex; justify-content: space-between; font-size: .82rem;
}
.sidebar-foot a { color: #94a3b8; }
.sidebar-foot a:hover { color: #fff; }

.admin-main { display: flex; flex-direction: column; min-width: 0; }
.admin-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; background: #fff; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.admin-topbar h1 { margin: 0; font-size: 1.15rem; font-weight: 700; }
.sidebar-toggle {
  display: none; background: none; border: 0; font-size: 1.2rem; color: var(--text);
  margin-right: 12px; cursor: pointer;
}
.topbar-right { display: flex; align-items: center; gap: 14px; }
.top-link { color: var(--text-muted); font-size: .85rem; }
.top-link:hover { color: var(--brand); }
.user-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 4px 4px 8px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 999px;
}
.user-chip .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .8rem;
}
.user-chip .uname { font-weight: 600; font-size: .88rem; }
.logout-btn {
  width: 28px; height: 28px; border-radius: 50%; background: #fff;
  display: grid; place-items: center; color: var(--text-muted);
}
.logout-btn:hover { background: var(--danger-bg); color: var(--danger); }

.admin-content { padding: 28px; flex: 1; }

/* ===== Alerts ===== */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 20px;
  display: flex; align-items: center; gap: 10px; font-size: .92rem;
}
.alert.success { background: var(--success-bg); color: #065f46; border: 1px solid #a7f3d0; }
.alert.error { background: var(--danger-bg); color: #991b1b; border: 1px solid #fecaca; }

/* ===== Stat cards ===== */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px;
  margin-bottom: 24px;
}
.stat {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; display: flex; gap: 14px; align-items: center;
  transition: all .15s; color: var(--text);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #dbeafe; color: var(--text); }
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center;
  background: var(--brand-light); color: var(--brand); font-size: 1.1rem;
}
.stat-icon.orange { background: #fff7ed; color: #ea580c; }
.stat-icon.green  { background: var(--success-bg); color: var(--success); }
.stat-icon.blue   { background: #eff6ff; color: var(--brand); }
.stat-icon.purple { background: #faf5ff; color: #9333ea; }
.stat-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); font-weight: 600; }
.stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.stat-sub { font-size: .78rem; color: var(--success); font-weight: 600; }
.stat-primary .stat-icon { background: linear-gradient(135deg, var(--brand), var(--accent)); color: #fff; }

/* ===== Panels ===== */
.panel-grid { display: grid; grid-template-columns: 1fr 1.5fr; gap: 20px; }
@media (max-width: 980px) { .panel-grid { grid-template-columns: 1fr; } }
.panel {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.panel-head h2 { margin: 0; font-size: 1rem; display: flex; align-items: center; gap: 10px; }
.panel-head h2 i { color: var(--brand); }
.panel-body { padding: 16px 20px; }

.quick-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.qa {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-size: .9rem; font-weight: 500;
  transition: all .15s;
}
.qa:hover { background: var(--brand-light); border-color: #bfdbfe; color: var(--brand-dark); }
.qa i { color: var(--brand); width: 18px; text-align: center; }

/* ===== Tables ===== */
.data-table {
  width: 100%; border-collapse: collapse; font-size: .92rem;
}
.data-table th {
  text-align: left; padding: 10px 12px; background: var(--bg-soft);
  font-weight: 600; color: var(--text-muted); font-size: .78rem;
  text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--border);
}
.data-table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tr:hover { background: var(--bg-soft); }
.data-table .muted { color: var(--text-muted); }
.data-table .small { font-size: .82rem; }
.row-actions { white-space: nowrap; display: flex; gap: 6px; align-items: center; }

.row-unread { background: linear-gradient(90deg, rgba(26,86,219,.04), transparent); }
.dot-new { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); display: inline-block; }

.icon-chip {
  width: 34px; height: 34px; border-radius: 8px;
  display: inline-grid; place-items: center;
  background: var(--brand-light); color: var(--brand);
}

.badge {
  display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: .74rem;
  font-weight: 600; border: 0; cursor: pointer; font-family: inherit;
}
.badge-green { background: var(--success-bg); color: #065f46; }
.badge-gray  { background: #e2e8f0; color: #475569; }

.empty { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty i { font-size: 2.5rem; color: #cbd5e1; margin-bottom: 10px; }
.empty p { margin: 6px 0 0; }

.wa-link { color: #16a34a; }

/* ===== Forms ===== */
.form-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
}
.form-section-title {
  margin: 10px 0 16px; font-size: .92rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .08em; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}
.form-section-title i { color: var(--brand); }
.form-row { margin-bottom: 18px; }
.form-row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 720px) { .form-row.two { grid-template-columns: 1fr; } }
.form-row label { display: block; font-size: .88rem; color: var(--text); font-weight: 600; }
.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="url"],
.form-row input[type="tel"],
.form-row input[type="number"],
.form-row input[type="password"],
.form-row textarea,
.form-row select {
  width: 100%; padding: 10px 12px; margin-top: 6px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: .95rem; font-family: inherit; color: var(--text); background: #fff;
  transition: border .15s, box-shadow .15s;
}
.form-row input[type="file"] { margin-top: 6px; font-size: .88rem; }
.form-row input:focus, .form-row textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(26,86,219,.15);
}
.form-row textarea { resize: vertical; }
.form-row small { display: block; margin-top: 4px; font-size: .78rem; font-weight: 400; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.checkbox input { accent-color: var(--brand); }

/* Card-style checkbox (used for floating button toggles) */
.checkbox-card {
  display: block; cursor: pointer; margin-top: 6px;
  border: 2px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px; transition: all .15s; background: #fff;
}
.checkbox-card input { position: absolute; opacity: 0; pointer-events: none; }
.checkbox-card .cc-body { display: flex; align-items: center; gap: 12px; }
.checkbox-card .cc-icon {
  width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center;
  color: #fff; font-size: 1.1rem; flex-shrink: 0;
}
.checkbox-card .cc-icon.wa { background: #25D366; }
.checkbox-card .cc-icon.tg { background: #229ED9; }
.checkbox-card strong { display: block; font-size: .95rem; }
.checkbox-card small { display: block; font-weight: 400; font-size: .8rem; margin-top: 2px; }
.checkbox-card:has(input:checked) { border-color: var(--brand); background: var(--brand-light); }
.checkbox-card:hover { border-color: #bfdbfe; }

.image-preview {
  margin-top: 10px; padding: 10px; background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.image-preview img { max-height: 120px; border-radius: 6px; margin-bottom: 8px; }

.form-actions {
  display: flex; gap: 10px; padding-top: 16px; border-top: 1px solid var(--border);
  margin-top: 8px;
}

.page-head {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 12px;
}

/* ===== SERP Preview ===== */
.serp-preview {
  font-family: Arial, sans-serif;
  padding: 16px; background: #fff; border: 1px solid var(--border); border-radius: 8px;
  max-width: 600px;
}
.serp-url { color: #202124; font-size: .82rem; }
.serp-title { color: #1a0dab; font-size: 1.15rem; margin: 4px 0; text-decoration: underline; }
.serp-desc  { color: #4d5156; font-size: .88rem; line-height: 1.45; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 50;
    transform: translateX(-100%); transition: transform .25s;
  }
  .admin-sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: inline-block; }
  .admin-content { padding: 20px; }
}
