/* =========================================
   LPK CMS ADMIN PANEL - MODERN STYLESHEET
   ========================================= */

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

:root {
  --admin-sidebar-bg: #0f172a;
  --admin-sidebar-hover: #1e293b;
  --admin-sidebar-active: #3b82f6;
  --admin-sidebar-text: #94a3b8;
  --admin-sidebar-text-active: #ffffff;
  
  --admin-primary: #2563eb;
  --admin-primary-dark: #1d4ed8;
  --admin-accent: #e84040;
  
  --admin-bg: #f8fafc;
  --admin-card-bg: #ffffff;
  --admin-border: #e2e8f0;
  --admin-text-main: #0f172a;
  --admin-text-muted: #64748b;
  
  --admin-success: #10b981;
  --admin-warning: #f59e0b;
  --admin-danger: #ef4444;
  --admin-info: #06b6d4;

  --admin-radius-sm: 6px;
  --admin-radius: 10px;
  --admin-radius-lg: 14px;
  --admin-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --admin-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --admin-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  
  --sidebar-w: 260px;
  --header-h: 68px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--admin-bg);
  color: var(--admin-text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ======== LAYOUT ======== */
.admin-wrapper {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.admin-sidebar {
  width: var(--sidebar-w);
  background: var(--admin-sidebar-bg);
  color: #fff;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}

.sidebar-header {
  height: var(--header-h);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
  font-weight: 800;
  font-size: 1.15rem;
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.sidebar-badge {
  background: var(--admin-accent);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

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

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
  padding: 0.75rem 0.75rem 0.25rem;
  margin-top: 0.5rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--admin-radius-sm);
  color: var(--admin-sidebar-text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
}

.sidebar-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 2;
  opacity: 0.85;
}

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

.sidebar-link.active {
  background: var(--admin-primary);
  color: #fff;
  font-weight: 600;
}

.sidebar-link.active svg {
  opacity: 1;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.user-meta {
  font-size: 0.8rem;
  color: var(--admin-sidebar-text);
  overflow: hidden;
}
.user-name {
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* MAIN CONTENT */
.admin-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* TOP HEADER */
.admin-topbar {
  height: var(--header-h);
  background: #ffffff;
  border-bottom: 1px solid var(--admin-border);
  position: sticky;
  top: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-toggle-sidebar {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  color: var(--admin-text-main);
  border-radius: var(--admin-radius-sm);
}

.topbar-title h1 {
  font-size: 1.25rem;
  font-weight: 700;
}

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

/* CONTENT BODY */
.admin-content {
  padding: 2rem;
  flex: 1;
}

/* ======== UI COMPONENTS ======== */
.card {
  background: var(--admin-card-bg);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  box-shadow: var(--admin-shadow);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

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

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--admin-text-main);
}

.card-body {
  padding: 1.5rem;
}

/* STAT CARDS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--admin-shadow);
}

.stat-val {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.825rem;
  color: var(--admin-text-muted);
  font-weight: 500;
  margin-top: 0.25rem;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eff6ff;
  color: var(--admin-primary);
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--admin-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease-in-out;
  font-family: inherit;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.775rem;
}

.btn-primary {
  background: var(--admin-primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--admin-primary-dark);
}

.btn-secondary {
  background: #fff;
  color: var(--admin-text-main);
  border-color: var(--admin-border);
}
.btn-secondary:hover {
  background: #f1f5f9;
}

.btn-danger {
  background: var(--admin-danger);
  color: #fff;
}
.btn-danger:hover {
  background: #dc2626;
}

.btn-success {
  background: var(--admin-success);
  color: #fff;
}
.btn-success:hover {
  background: #059669;
}

/* TABLE */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.admin-table th {
  background: #f8fafc;
  color: var(--admin-text-muted);
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--admin-border);
  text-transform: uppercase;
  font-size: 0.725rem;
  letter-spacing: 0.05em;
}

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

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

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.725rem;
  font-weight: 600;
}

.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-info    { background: #e0f2fe; color: #0369a1; }
.badge-gray    { background: #f1f5f9; color: #475569; }

/* FORMS */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--admin-text-main);
}

.form-help {
  font-size: 0.75rem;
  color: var(--admin-text-muted);
  margin-top: 0.35rem;
}

.form-control, .form-select, textarea.form-control {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid var(--admin-border);
  border-radius: var(--admin-radius-sm);
  background: #fff;
  color: var(--admin-text-main);
  font-family: inherit;
  font-size: 0.875rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus, .form-select:focus, textarea.form-control:focus {
  outline: none;
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.form-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--admin-primary);
}

/* ALERTS */
.admin-alert {
  padding: 0.875rem 1.25rem;
  border-radius: var(--admin-radius-sm);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
}
.admin-alert-success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.admin-alert-error   { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

/* TAB SYSTEM */
.tabs-nav {
  display: flex;
  border-bottom: 1px solid var(--admin-border);
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}
.tab-btn {
  padding: 0.75rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--admin-text-muted);
  cursor: pointer;
  white-space: nowrap;
}
.tab-btn.active {
  color: var(--admin-primary);
  border-bottom-color: var(--admin-primary);
}
.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
}

/* THUMBNAIL PREVIEWS */
.img-preview-box {
  width: 80px;
  height: 80px;
  border-radius: var(--admin-radius-sm);
  border: 1px solid var(--admin-border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
}
.img-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* RESPONSIVE */
.admin-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  z-index: 998;
}
.admin-sidebar-backdrop.active {
  display: block;
}

@media (max-width: 1024px) {
  .admin-sidebar {
    transform: translateX(-100%);
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.25);
  }
  .admin-sidebar.open {
    transform: translateX(0);
  }
  .admin-main {
    margin-left: 0;
  }
  .btn-toggle-sidebar {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Susun form dan tabel secara vertikal pada tablet & ponsel */
  div[style*="grid-template-columns: 1fr 1.6fr"],
  div[style*="grid-template-columns: 1.1fr 1fr"],
  div[style*="grid-template-columns: 1.6fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }
}

@media (max-width: 768px) {
  .admin-topbar {
    padding: 0 1rem;
    height: 60px;
  }
  .topbar-title h1 {
    font-size: 1.05rem;
  }
  .admin-content {
    padding: 1rem;
  }
  .card-header {
    padding: 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .card-header .table-search-input {
    width: 100% !important;
  }
  .tabs-nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .tab-btn {
    white-space: nowrap;
    padding: 0.5rem 0.85rem;
    font-size: 0.825rem;
  }
}

@media (max-width: 480px) {
  .admin-topbar {
    padding: 0 0.75rem;
  }
  .admin-content {
    padding: 0.75rem;
  }
  .topbar-right .btn {
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
  }
  .admin-table th, .admin-table td {
    padding: 0.6rem 0.75rem;
    font-size: 0.8rem;
  }
}

/* ======== TINYMCE RICH TEXT EDITOR CUSTOM STYLES ======== */
.tox-tinymce {
  border-radius: var(--admin-radius-sm) !important;
  border: 1.5px solid var(--admin-border) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
  overflow: hidden;
}
.tox .tox-menubar {
  background: #f8fafc !important;
  border-bottom: 1px solid var(--admin-border) !important;
}
.tox .tox-toolbar, .tox .tox-toolbar__overflow, .tox .tox-toolbar__primary {
  background: #ffffff !important;
  border-bottom: 1px solid var(--admin-border) !important;
}
.tox .tox-statusbar {
  border-top: 1px solid var(--admin-border) !important;
  background: #f8fafc !important;
  color: var(--admin-text-muted) !important;
}
.tox .tox-mbtn:hover:not(:disabled):not(.tox-mbtn--active),
.tox .tox-tbtn:hover {
  background: #eff6ff !important;
  color: var(--admin-primary) !important;
}
