@import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,300;0,400;0,700;0,900;1,400;1,700&display=swap');

/* ==========================================================================
   MAULIA KAVLING - Admin Dashboard Stylesheet
   Font: LATO (Seluruh Halaman Admin) | Solid Architectural Styling (No Gradients)
   ========================================================================== */

:root {
  --admin-font: 'Lato', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --admin-primary: #dc2626;         /* Warna Merah Logo Brand (Vibrant & Tegas) */
  --admin-primary-dark: #991b1b;    /* Crimson Eksekutif (Header & Hover) */
  --admin-primary-deep: #7f1d1d;    /* Burgundy Tua (Topbar Gradient) */
  --admin-primary-hover: #b91c1c;   /* Red 700 */
  --admin-primary-light: #fef2f2;   /* Soft Red Tint Background */
  --admin-primary-border: #fecaca;  /* Border Merah Halus */
  --admin-primary-glow: rgba(220, 38, 38, 0.22);
  --admin-dark: #0f172a;
  --admin-light: #f8fafc;
  --admin-border: #e2e8f0;
  --admin-accent: #ea580c;
  --admin-success: #16a34a;
  --admin-danger: #dc2626;
  --admin-card: #ffffff;
  --admin-text: #1e293b;
  --admin-muted: #64748b;
  --radius-admin: 10px;
}

*, *::before, *::after {
  box-sizing: border-box;
  font-family: var(--admin-font);
}

html, body {
  overflow-x: clip;
  max-width: 100%;
}

html, body, body.admin-body,
button, input, select, textarea, h1, h2, h3, h4, h5, h6,
table, th, td, label, p, span, a, div {
  font-family: var(--admin-font) !important;
}

body.admin-body {
  background-color: #f1f5f9;
  color: var(--admin-text);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: clip;
}

/* ==========================================================================
   PROFESSIONAL EXECUTIVE ADMIN TOPBAR (MERAH LOGO BRAND)
   Fully Responsive: Sticky Bar, Desktop Segmented Menu & Mobile Offcanvas Drawer
   ========================================================================== */

.admin-topbar {
  background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 55%, #b91c1c 100%);
  color: #ffffff;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 14px rgba(127, 29, 29, 0.28), 0 1px 3px rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.admin-topbar-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Brand Section */
.admin-topbar-brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.admin-brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #ffffff;
  transition: opacity 0.15s;
}

.admin-brand-link:hover {
  opacity: 0.95;
}

.admin-brand-logo-img {
  max-height: 38px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
  background: #ffffff;
  padding: 3px 6px;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.admin-brand-initial-badge {
  background: #ffffff;
  color: #b91c1c;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 19px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.admin-brand-text-wrap {
  display: flex;
  flex-direction: column;
}

.admin-brand-title {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.6px;
  color: #ffffff;
  line-height: 1.15;
}

.admin-brand-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
}

.admin-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 800;
  color: #bbf7d0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-status-dot {
  width: 7px;
  height: 7px;
  background-color: #22c55e;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.35);
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.75; }
}

.admin-badge-portal {
  background: rgba(255, 255, 255, 0.16);
  color: #fee2e2;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Center Desktop Navigation Menu */
.admin-topbar-menu {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.18);
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.admin-nav-link {
  color: #fecaca;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 6px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s ease-in-out;
  white-space: nowrap;
}

.admin-nav-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
}

.admin-nav-link.active {
  background: #ffffff;
  color: #991b1b;
  font-weight: 900;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.admin-nav-link .nav-icon {
  font-size: 14px;
  line-height: 1;
}

/* Right Actions & Profile */
.admin-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.admin-topbar-btn-view {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  transition: all 0.15s;
}

.admin-topbar-btn-view:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.admin-user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.22);
  padding: 4px 12px 4px 4px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.admin-avatar-circle {
  width: 30px;
  height: 30px;
  background: #ffffff;
  color: #991b1b;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.admin-user-info {
  display: flex;
  flex-direction: column;
}

.admin-user-name {
  font-size: 12px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.15;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-user-role {
  font-size: 10px;
  color: #fca5a5;
  font-weight: 600;
}

.admin-topbar-logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(0, 0, 0, 0.25);
  color: #fecaca;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  transition: all 0.15s;
}

.admin-topbar-logout-btn:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #ef4444;
}

/* Mobile Toggle Hamburger Button */
.admin-mobile-toggle-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  transition: background-color 0.15s;
}

.admin-mobile-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

.admin-mobile-toggle-btn .hamburger-bar {
  width: 18px;
  height: 2px;
  background-color: #ffffff;
  border-radius: 2px;
  transition: transform 0.2s;
}

/* ==========================================================================
   MOBILE OFF-CANVAS DRAWER
   ========================================================================== */

.admin-mobile-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease-in-out, visibility 0.25s ease-in-out;
}

.admin-mobile-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.admin-mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 300px;
  max-width: 86vw;
  background: #ffffff;
  z-index: 1100;
  box-shadow: -6px 0 28px rgba(0, 0, 0, 0.25);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.admin-mobile-drawer.open {
  transform: translateX(0);
}

.admin-drawer-header {
  background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.admin-drawer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-drawer-brand-name {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.5px;
}

.admin-drawer-close-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}

.admin-drawer-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.admin-drawer-profile {
  background: #f8fafc;
  padding: 14px 18px;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-drawer-avatar {
  width: 36px;
  height: 36px;
  background: #991b1b;
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
}

.admin-drawer-profile-text {
  display: flex;
  flex-direction: column;
}

.admin-drawer-profile-text strong {
  font-size: 13px;
  color: var(--admin-dark);
}

.admin-drawer-profile-text small {
  font-size: 11px;
  color: var(--admin-muted);
}

.admin-drawer-nav {
  padding: 16px 14px;
  flex: 1;
}

.admin-drawer-nav-section {
  font-size: 10px;
  font-weight: 800;
  color: var(--admin-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
  padding-left: 8px;
}

.admin-drawer-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--admin-text);
  text-decoration: none;
  margin-bottom: 4px;
  transition: all 0.15s;
}

.admin-drawer-link:hover {
  background: #f1f5f9;
  color: var(--admin-primary);
}

.admin-drawer-link.active {
  background: #fef2f2;
  color: #991b1b;
  border-left: 3px solid #dc2626;
  font-weight: 800;
}

.admin-drawer-link .drawer-icon {
  font-size: 16px;
  line-height: 1;
}

.admin-drawer-footer {
  padding: 16px;
  border-top: 1px solid var(--admin-border);
  background: #fafafa;
}

.admin-drawer-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 16px;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  border: 1px solid #fecaca;
  transition: all 0.15s;
}

.admin-drawer-logout-btn:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}

/* Fallback Legacy admin-nav */
.admin-nav {
  background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 55%, #b91c1c 100%);
  color: #ffffff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.admin-brand {
  font-size: 15px;
  font-weight: 900;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.5px;
}

.admin-menu {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-menu a {
  color: #fecaca;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 4px;
  transition: all 0.15s;
}

.admin-menu a:hover, .admin-menu a.active {
  background-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.admin-container {
  max-width: 1320px;
  margin: 24px auto;
  padding: 0 18px;
}

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

.stat-card {
  background-color: var(--admin-card);
  border-radius: var(--radius-admin);
  padding: 20px;
  border: 1px solid var(--admin-border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--admin-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-val {
  font-size: 28px;
  font-weight: 900;
  color: var(--admin-primary);
  margin: 6px 0;
}

.stat-sub {
  font-size: 12px;
  color: var(--admin-muted);
}

/* Panels */
.admin-card {
  background-color: var(--admin-card);
  border-radius: var(--radius-admin);
  border: 1px solid var(--admin-border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  margin-bottom: 24px;
  overflow: hidden;
}

.admin-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-card-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--admin-dark);
}

.admin-card-body {
  padding: 20px;
  overflow-x: auto;
}

/* Tables */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.admin-table th {
  background-color: #f8fafc;
  padding: 12px 14px;
  font-weight: 800;
  color: var(--admin-muted);
  border-bottom: 2px solid var(--admin-border);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.admin-table td {
  padding: 14px;
  border-bottom: 1px solid var(--admin-border);
  vertical-align: middle;
}

.admin-table tr:hover {
  background-color: #fcfdfe;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.badge-success { background-color: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.badge-warning { background-color: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.badge-danger { background-color: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-info { background-color: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-primary { background-color: var(--admin-primary-light); color: var(--admin-primary); border: 1px solid var(--admin-primary-border); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--admin-primary);
  color: #ffffff;
  border-color: var(--admin-primary);
  box-shadow: 0 1px 3px var(--admin-primary-glow);
}
.btn-primary:hover {
  background-color: var(--admin-primary-hover);
  border-color: var(--admin-primary-hover);
  box-shadow: 0 4px 12px var(--admin-primary-glow);
}

.btn-outline {
  border-color: var(--admin-border);
  color: var(--admin-text);
  background-color: #ffffff;
}
.btn-outline:hover { background-color: #f1f5f9; }

.btn-danger {
  background-color: #fee2e2;
  color: #b91c1c;
  border-color: #fecaca;
}
.btn-danger:hover { background-color: #ef4444; color: #ffffff; }

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

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

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--admin-dark);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--admin-dark);
  background-color: #ffffff;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px var(--admin-primary-glow);
}

.form-hint {
  font-size: 12px;
  color: var(--admin-muted);
  margin-top: 4px;
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 13px;
  font-weight: 700;
}
.alert-success { background-color: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.alert-danger { background-color: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

/* CTWA Click Meter */
.click-badge {
  background-color: var(--admin-primary-light);
  color: var(--admin-primary);
  border: 1px solid var(--admin-primary-border);
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================================================
   PROFESSIONAL & RESPONSIVE FORM COMPONENTS (LATO THEME)
   ========================================================================== */

/* Layout & Grid Structure */
.form-layout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 992px) {
  .form-layout-grid {
    grid-template-columns: minmax(0, 1fr) 340px;
    align-items: start;
  }
}

.form-main-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-sidebar-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (min-width: 992px) {
  .form-sidebar-col {
    position: sticky;
    top: 24px;
  }
}

/* Responsive Grid Rows */
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) {
  .form-row-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) {
  .form-row-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 860px) {
  .form-row-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Section Cards */
.form-section-card {
  background: #ffffff;
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
  overflow: hidden;
  transition: border-color 0.2s;
}

.form-section-card:hover {
  border-color: #cbd5e1;
}

.form-section-header {
  padding: 16px 20px;
  background: #f8fafc;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-section-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--admin-dark);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.form-section-title .section-icon {
  font-size: 16px;
  line-height: 1;
}

.form-section-subtitle {
  font-size: 12px;
  color: var(--admin-muted);
  margin-top: 2px;
}

.form-section-body {
  padding: 20px;
}

/* Enhanced Inputs */
.form-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--admin-dark);
}

.form-label .required-mark {
  color: var(--admin-danger);
  margin-left: 2px;
}

.form-label-desc {
  font-size: 11px;
  font-weight: 500;
  color: var(--admin-muted);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  color: #0f172a;
  background-color: #ffffff;
  transition: all 0.15s ease-in-out;
  box-sizing: border-box;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(12, 74, 52, 0.12);
  background-color: #ffffff;
}

.form-input::placeholder, .form-textarea::placeholder {
  color: #94a3b8;
}

/* Input Groups */
.input-addon-group {
  display: flex;
  align-items: stretch;
  width: 100%;
}

.input-addon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  background-color: #f1f5f9;
  border: 1px solid #cbd5e1;
  font-weight: 800;
  font-size: 13px;
  color: #475569;
  user-select: none;
}

.input-addon-prefix {
  border-right: none;
  border-radius: 8px 0 0 8px;
}

.input-addon-suffix {
  border-left: none;
  border-radius: 0 8px 8px 0;
}

.input-addon-group .form-input {
  border-radius: 0;
}

.input-addon-group .form-input:first-child {
  border-radius: 8px 0 0 8px;
}

.input-addon-group .form-input:last-child {
  border-radius: 0 8px 8px 0;
}

.input-addon-group .form-input:focus {
  z-index: 2;
}

/* Upload Dropzone & File Pickers */
.dropzone-box {
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  padding: 18px;
  background-color: #f8fafc;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.dropzone-box:hover, .dropzone-box.drag-over {
  border-color: var(--admin-primary);
  background-color: #f0fdf4;
}

.dropzone-box input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone-icon {
  font-size: 28px;
  margin-bottom: 6px;
  display: block;
}

.dropzone-text {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 4px;
}

.dropzone-sub {
  font-size: 11px;
  color: #64748b;
}

/* File Selected Badge */
.file-selected-pill {
  display: none;
  margin-top: 10px;
  padding: 6px 12px;
  background-color: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 6px;
  font-size: 12px;
  color: #065f46;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Live Thumbnail Preview Box */
.thumb-preview-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
  padding: 12px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.thumb-preview-img {
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  flex-shrink: 0;
}

.thumb-preview-meta {
  font-size: 12px;
  color: #475569;
  overflow: hidden;
}

/* Existing Media Grid */
.existing-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

@media (min-width: 640px) {
  .existing-media-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

.media-manage-card {
  position: relative;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  transition: all 0.15s ease;
}

.media-manage-card:hover {
  border-color: #94a3b8;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.media-manage-card.to-delete {
  opacity: 0.5;
  background: #fef2f2;
  border-color: #fca5a5;
  text-decoration: line-through;
}

.media-manage-preview {
  position: relative;
  height: 96px;
  background: #0f172a;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-manage-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-type-tag {
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 9px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.media-type-tag.img-tag {
  background: rgba(12, 74, 52, 0.85);
  color: #ffffff;
}

.media-type-tag.video-tag {
  background: rgba(180, 83, 9, 0.9);
  color: #ffffff;
}

.media-manage-toggle {
  margin-top: 8px;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.media-manage-toggle input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--admin-primary);
  width: 15px;
  height: 15px;
}

/* SERP Google Preview */
.serp-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px 16px;
  font-family: Arial, sans-serif;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.serp-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #202124;
  margin-bottom: 4px;
}

.serp-meta .serp-favicon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #0c4a34;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
}

.serp-url {
  font-size: 12px;
  color: #4d5156;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.serp-title {
  font-size: 17px;
  font-weight: 400;
  color: #1a0dab;
  line-height: 1.3;
  margin-bottom: 4px;
  text-decoration: none;
  display: block;
}

.serp-title:hover {
  text-decoration: underline;
}

.serp-snippet {
  font-size: 13px;
  color: #4d5156;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Quota Visual Progress Bar */
.quota-meter-wrapper {
  margin-top: 10px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 10px 12px;
}

.quota-meter-bar-track {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 6px;
}

.quota-meter-bar-fill {
  height: 100%;
  background-color: var(--admin-primary);
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Sticky Action Bar for Mobile & Desktop */
.form-action-bar {
  background: #ffffff;
  border-top: 1px solid var(--admin-border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-radius: 0 0 10px 10px;
}

@media (max-width: 640px) {
  .form-action-bar {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .form-action-bar .btn {
    width: 100%;
    justify-content: center;
    padding: 12px 16px;
  }
}

/* Top Sticky Page Title Header */
.form-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.form-header-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-header-nav-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: color 0.15s;
}

.form-header-nav-back:hover {
  color: var(--admin-primary);
}

.form-header-h1 {
  font-size: 24px;
  font-weight: 900;
  color: #0f172a;
  margin: 0;
  letter-spacing: -0.3px;
}

.form-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
}

/* ==========================================================================
   DASHBOARD CHARTS, METRICS & EXECUTIVE KPI STYLES
   ========================================================================== */

/* Executive KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: #ffffff;
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.kpi-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--admin-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.kpi-val {
  font-size: 26px;
  font-weight: 900;
  color: #0f172a;
  line-height: 1.1;
  margin-bottom: 8px;
}

.kpi-meta {
  font-size: 12px;
  color: var(--admin-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
}

.trend-up {
  background-color: #ecfdf5;
  color: #059669;
}

.trend-down {
  background-color: #fef2f2;
  color: #dc2626;
}

/* Charts Layout Grid */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (min-width: 992px) {
  .charts-grid {
    grid-template-columns: 2fr 1fr;
  }
}

.chart-card {
  background: #ffffff;
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  padding: 20px;
  display: flex;
  flex-direction: column;
}

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

.chart-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--admin-dark);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.chart-subtitle {
  font-size: 12px;
  color: var(--admin-muted);
  margin-top: 2px;
}

.chart-canvas-wrapper {
  position: relative;
  width: 100%;
  min-height: 260px;
  flex: 1;
}

/* Mini Progress Bar in Table */
.progress-mini-track {
  width: 100%;
  height: 6px;
  background-color: #f1f5f9;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}

.progress-mini-fill {
  height: 100%;
  background-color: var(--admin-primary);
  border-radius: 3px;
}

/* Device Breakdown Bar */
.device-breakdown-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin: 12px 0;
}

.device-fill-mobile {
  background-color: var(--admin-primary);
  height: 100%;
}

.device-fill-desktop {
  background-color: #3b82f6;
  height: 100%;
}

/* ==========================================================================
   ADVANCED MOBILE & TABLET RESPONSIVENESS ENHANCEMENTS
   ========================================================================== */

/* Topbar shrink safety on tablet & mobile */
.admin-topbar-brand {
  min-width: 0;
  flex: 0 1 auto;
}

.admin-brand-text-wrap {
  min-width: 0;
}

.admin-brand-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1024px) {
  .admin-topbar-brand {
    flex: 1 1 auto;
  }
  .admin-topbar-menu,
  .admin-topbar-btn-view,
  .admin-user-chip,
  .admin-topbar-logout-btn {
    display: none !important;
  }
  .admin-mobile-toggle-btn {
    display: inline-flex !important;
  }
}

/* Form Header Bar Responsive */
.form-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .admin-container {
    padding: 16px 12px;
    margin: 12px auto;
  }

  .form-input,
  .form-select,
  .form-textarea {
    font-size: 16px;
  }

  .form-header-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .form-header-bar > div:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }

  .form-header-bar > div:last-child .btn {
    flex: 1 1 auto;
    justify-content: center;
    text-align: center;
  }

  .form-header-h1 {
    font-size: 20px !important;
  }

  /* Stats & KPI Grid Responsiveness on Mobile */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  .stat-card {
    padding: 14px 12px !important;
  }

  .stat-val {
    font-size: 22px !important;
  }

  .kpi-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Tabs Scrollable Touch Feedback */
  .settings-nav-tabs {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    gap: 4px;
  }

  .settings-tab-btn {
    padding: 10px 14px;
    font-size: 13px;
  }

  /* Admin Cards & Tables */
  .admin-card-header {
    padding: 14px 16px;
  }

  .admin-card-body {
    padding: 14px;
    -webkit-overflow-scrolling: touch;
  }

  .admin-table th, .admin-table td {
    padding: 10px 10px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr !important;
  }

  .admin-topbar-inner {
    padding: 0 12px;
  }

  .admin-brand-title {
    font-size: 13px;
    max-width: 180px;
  }

  .form-section-header,
  .form-section-body {
    padding: 14px;
  }

  .thumb-preview-wrapper {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .login-box {
    padding: 26px 18px !important;
    border-radius: 14px !important;
  }
}

/* Print Optimization */
@media print {
  .admin-topbar, .admin-nav, .btn, #pwdModal, .form-header-bar a, .admin-mobile-drawer, .admin-mobile-backdrop {
    display: none !important;
  }
  .admin-container {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .admin-card, .chart-card, .kpi-card {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    break-inside: avoid;
  }
}


