/* ==========================================================================
   ENTERPRISE ADMIN CMS STYLESHEET
   Media Digital Publikasi Indonesia
   Modern Academic SaaS Dashboard Design (Clean, Authoritative & Accessible)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

:root {
  --admin-bg: #f8fafc;
  --admin-sidebar-bg: #090e1a;
  --admin-sidebar-hover: #1e293b;
  --admin-sidebar-active: #0284c7;
  --admin-card-bg: #ffffff;
  --admin-border: #e2e8f0;
  --admin-text-main: #0f172a;
  --admin-text-muted: #64748b;
  --admin-primary: #0284c7;
  --admin-primary-hover: #0369a1;
  --admin-primary-light: #e0f2fe;
  --admin-success: #16a34a;
  --admin-success-light: #dcfce7;
  --admin-danger: #dc2626;
  --admin-danger-light: #fee2e2;
  --admin-warning: #d97706;
  --admin-warning-light: #fef3c7;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

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

body.admin-body {
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--admin-bg);
  color: var(--admin-text-main);
  min-height: 100vh;
  margin: 0;
  padding: 0;
  display: flex;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ================= Admin Layout Wrapper ================= */
.admin-wrapper {
  display: flex;
  width: 100vw;
  min-height: 100vh;
}

/* ================= Sidebar Navigation ================= */
.admin-sidebar {
  width: 270px;
  background-color: var(--admin-sidebar-bg);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid #1e293b;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
  transition: all 0.3s ease;
}

.admin-sidebar::-webkit-scrollbar {
  width: 4px;
}
.admin-sidebar::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}

.admin-brand {
  padding: 1.25rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  border-bottom: 1px solid #1e293b;
}

.admin-brand .brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
  color: #fff;
  font-weight: 900;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
  flex-shrink: 0;
}

.admin-brand h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.2;
}

.admin-brand p {
  font-size: 0.72rem;
  color: #94a3b8;
  margin: 0;
}

.admin-nav {
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex-grow: 1;
}

.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  color: #94a3b8;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
}

.admin-nav-link i,
.admin-nav-link svg {
  width: 17px;
  height: 17px;
  stroke-width: 2;
  flex-shrink: 0;
  transition: color 0.15s;
}

.admin-nav-link:hover {
  background-color: var(--admin-sidebar-hover);
  color: #f8fafc;
}

.admin-nav-link.active {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

.admin-nav-link.active i,
.admin-nav-link.active svg {
  color: #ffffff;
}

/* User Box in Sidebar Footer */
.admin-user-box,
.admin-user-profile {
  padding: 1rem 1.1rem;
  border-top: 1px solid #1e293b;
  background: #090e1a;
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-user-box .user-avatar,
.user-avatar-badge {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.admin-user-box .user-info {
  flex-grow: 1;
  min-width: 0;
}

.admin-user-box .user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.admin-user-box .user-role {
  font-size: 0.7rem;
  color: #38bdf8;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.03em;
}

.btn-logout {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: #1e293b;
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border: 1px solid #334155;
  transition: all 0.2s;
  flex-shrink: 0;
}

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

.btn-logout svg,
.btn-logout i {
  width: 15px;
  height: 15px;
}

/* ================= Main Admin Content Area ================= */
.admin-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-y: auto;
  height: 100vh;
  background-color: var(--admin-bg);
}

/* Topbar Header */
.admin-topbar,
.admin-header {
  background: #ffffff;
  border-bottom: 1px solid var(--admin-border);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.topbar-left {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.topbar-left h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--admin-text-main);
  letter-spacing: -0.02em;
  margin: 0;
}

.topbar-left span {
  font-size: 0.8rem;
  color: var(--admin-text-muted);
}

.topbar-right {
  display: flex;
  gap: 0.65rem;
  align-items: center;
}

/* Content Container */
.admin-content-inner,
.admin-content-area {
  padding: 1.75rem 2rem 3rem;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* ================= Dashboard Overview Stats ================= */
.admin-stats-grid,
.stats-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card,
.stat-card-admin {
  background: #ffffff;
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}

.stat-card:hover,
.stat-card-admin:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: var(--admin-primary-light);
  color: var(--admin-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.stat-icon svg,
.stat-icon i {
  width: 22px;
  height: 22px;
}

.stat-card h3 {
  font-size: 1.75rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.1;
  margin: 0 0 0.15rem;
}

.stat-card p {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--admin-text-muted);
  margin: 0;
}

/* Section Box Card */
.admin-card-box {
  background: #ffffff;
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.admin-card-box h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.35rem;
}

.admin-card-box p.lead-text {
  font-size: 0.85rem;
  color: var(--admin-text-muted);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

/* ================= Data Tables ================= */
.table-responsive-container {
  background: #ffffff;
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-md);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.86rem;
}

.admin-table thead {
  background-color: #f8fafc;
  border-bottom: 1px solid var(--admin-border);
}

.admin-table th {
  padding: 0.85rem 1.15rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.admin-table td {
  padding: 0.9rem 1.15rem;
  border-bottom: 1px solid var(--admin-border);
  vertical-align: middle;
  color: #334155;
}

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

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

/* Badges */
.badge,
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: #e0f2fe;
  color: #0369a1;
  white-space: nowrap;
}

.badge-primary {
  background: #0284c7;
  color: #ffffff;
}

.badge-outline {
  background: transparent;
  border: 1px solid #cbd5e1;
  color: #64748b;
}

.badge-green {
  background: #dcfce7;
  color: #15803d;
}

.badge-purple {
  background: #f3e8ff;
  color: #7e22ce;
}

/* ================= Filter Toolbar ================= */
.admin-filter-bar {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  flex-wrap: wrap;
}

/* ================= Forms & Inputs ================= */
.admin-form-card {
  background: #ffffff;
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-md);
  padding: 1.75rem 2rem;
  box-shadow: var(--shadow-sm);
  margin-top: 1.75rem;
}

.admin-form-card h4 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
}

.form-control {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--admin-text-main);
  background: #ffffff;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  font-family: inherit;
}

.form-control-sm {
  padding: 0.45rem 0.7rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.form-control:focus {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

select.form-control {
  cursor: pointer;
}

textarea.form-control {
  resize: vertical;
}

/* ================= Buttons ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  border: 1px solid transparent;
  font-family: inherit;
}

.btn svg,
.btn i {
  width: 14px;
  height: 14px;
  stroke-width: 2.2;
}

.btn-primary {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

.btn-primary:hover {
  background: #0369a1;
  border-color: #0369a1;
}

.btn-outline {
  background: #ffffff;
  color: #475569;
  border-color: #cbd5e1;
}

.btn-outline:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}

.btn-success {
  background: #16a34a;
  color: #ffffff;
  border-color: #16a34a;
}
.btn-success:hover {
  background: #15803d;
  border-color: #15803d;
}

.btn-danger {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}
.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}

/* ================= 20 Template Grid ================= */
.admin-templates-grid,
.template-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.template-card,
.template-item-card {
  background: #ffffff;
  border: 2px solid var(--admin-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
}

.template-card:hover,
.template-item-card:hover {
  border-color: #0284c7;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.template-card.active-template,
.template-item-card.active {
  border-color: #16a34a;
  box-shadow: 0 0 0 1px #16a34a;
}

.template-color-preview {
  height: 60px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.template-info {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.template-info h4 {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.35rem;
}

.template-info p {
  font-size: 0.8rem;
  color: #64748b;
  line-height: 1.4;
  margin-bottom: 0.75rem;
}

/* ================= Modals ================= */
.admin-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: none !important;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.admin-modal.active {
  display: flex !important;
}

.admin-modal-content {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  border: 1px solid #e2e8f0;
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 1.75rem 2rem;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.admin-modal-header {
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.admin-modal-header .close-btn,
.admin-modal-header .btn-close-modal {
  background: none;
  border: none;
  font-size: 1.75rem;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  padding: 0;
}

.admin-modal-header .close-btn:hover,
.admin-modal-header .btn-close-modal:hover {
  color: #0f172a;
}

/* ================= Pagination & Toast Styles ================= */
.admin-pagination-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.15rem;
  background: #ffffff;
  border-top: 1px solid var(--admin-border);
  flex-wrap: wrap;
  gap: 1rem;
}

.admin-pagination-info {
  font-size: 0.8rem;
  color: var(--admin-text-muted);
}

.admin-pagination {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--admin-border);
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.page-btn:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f172a;
}

.page-btn.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 2px 4px rgba(2, 132, 199, 0.25);
}

.page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Toast Notification (Hidden by default, shown ONLY when triggered) */
.admin-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #ffffff;
  padding: 0.85rem 1.4rem;
  border-radius: 10px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.35);
  display: none !important;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.88rem;
  font-weight: 500;
  z-index: 10000;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid #334155;
}

.admin-toast.show {
  display: flex !important;
  opacity: 1 !important;
  transform: translateY(0) !important;
  pointer-events: auto !important;
}

.admin-toast.toast-success {
  background: #064e3b;
  border-color: #059669;
  color: #ecfdf5;
}

.admin-toast.toast-danger {
  background: #7f1d1d;
  border-color: #dc2626;
  color: #fef2f2;
}

/* Responsive */
@media (max-width: 1024px) {
  .admin-sidebar {
    width: 240px;
  }
  .admin-topbar,
  .admin-header {
    padding: 1rem 1.25rem;
  }
  .admin-content-inner,
  .admin-content-area {
    padding: 1.25rem 1.25rem 2rem;
  }
}

@media (max-width: 768px) {
  .admin-wrapper {
    flex-direction: column;
  }
  .admin-sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid #1e293b;
  }
  .admin-nav {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
  }
  .admin-nav::-webkit-scrollbar {
    height: 3px;
  }
  .admin-nav-link {
    padding: 0.5rem 0.85rem;
    font-size: 0.8rem;
    white-space: nowrap;
    border-radius: 6px;
    flex-shrink: 0;
  }
  .admin-user-box {
    display: none;
  }
  .topbar-right {
    display: none;
  }
  .admin-stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 480px) {
  .admin-stats-grid {
    grid-template-columns: 1fr !important;
  }
  .admin-topbar,
  .admin-header {
    padding: 0.85rem 1rem;
  }
  .admin-content-inner,
  .admin-content-area {
    padding: 1rem 1rem 2rem;
  }
}
