/* ==========================================================================
   Admin Panel Stylesheet — LPM Universitas Sultan Muhammad Syafiuddin Sambas
   ========================================================================== */

:root {
  --admin-primary: #0f766e;
  --admin-primary-dark: #0d4a44;
  --admin-primary-light: #f0fdfa;
  --admin-accent: #f59e0b;
  --admin-accent-dark: #d97706;
  --admin-sidebar-bg: #092623;
  --admin-sidebar-hover: #134e48;
  --admin-sidebar-active: #0f766e;
  --admin-text-main: #1e293b;
  --admin-text-muted: #64748b;
  --admin-border: #e2e8f0;
  --admin-bg: #f8fafc;
  --admin-card: #ffffff;
  --admin-radius: 12px;
  --admin-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --admin-shadow: 0 4px 12px rgba(15, 118, 110, 0.08);
  --admin-shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--admin-bg);
  color: var(--admin-text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* Sidebar */
.admin-sidebar {
  width: 270px;
  background-color: var(--admin-sidebar-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  transition: transform 0.25s ease;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

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

.sidebar-brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--admin-accent), #d97706);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.35);
}

.sidebar-brand-icon svg {
  width: 22px;
  height: 22px;
}

.sidebar-brand-title {
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.25;
  color: #f1f5f9;
}

.sidebar-brand-sub {
  font-size: 0.6875rem;
  color: #94a3b8;
  margin-top: 2px;
  letter-spacing: 0.02em;
}

.sidebar-nav {
  flex: 1;
  padding: 1.25rem 0.875rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.nav-section-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  padding: 0.5rem 0.75rem 0.25rem;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.admin-nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.admin-nav-item:hover {
  background-color: var(--admin-sidebar-hover);
  color: #fff;
  transform: translateX(3px);
}

.admin-nav-item.active {
  background: linear-gradient(135deg, var(--admin-primary), #0d9488);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.4);
}

.admin-nav-item.active svg {
  opacity: 1;
}

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

.admin-user-pill {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--admin-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  color: #fff;
}

.user-meta {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #f1f5f9;
}

.user-role {
  font-size: 0.6875rem;
  color: #94a3b8;
}

/* Main Area */
.admin-main {
  flex: 1;
  margin-left: 270px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Topbar */
.admin-topbar {
  height: 68px;
  background-color: #fff;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 40;
}

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

.sidebar-toggle-btn {
  display: none;
  background: #f8fafc;
  border: 1px solid var(--admin-border);
  padding: 0;
  border-radius: 8px;
  cursor: pointer;
  color: var(--admin-text-main);
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.sidebar-toggle-btn svg {
  width: 20px;
  height: 20px;
  color: #1e293b;
  flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
  background-color: #f1f5f9;
}

.sidebar-close-btn {
  display: none;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 0.375rem;
  margin-left: auto;
  border-radius: 6px;
  align-items: center;
  justify-content: center;
}

.sidebar-close-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-close-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  z-index: 45;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.topbar-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #0f172a;
}

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

.btn-view-site {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--admin-primary-light);
  color: var(--admin-primary);
  border: 1px solid rgba(15, 118, 110, 0.25);
  padding: 0.5rem 0.875rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
  line-height: 1;
}

.btn-view-site svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn-view-site * {
  pointer-events: none;
}

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

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: #fef2f2;
  color: #ef4444;
  border: 1px solid #fee2e2;
  padding: 0.5rem 0.875rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1;
}

.btn-logout svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn-logout * {
  pointer-events: none;
}

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

/* Page Content */
.admin-content {
  padding: 2rem;
  flex: 1;
}

/* Alerts */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.alert svg {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  flex-shrink: 0;
}

.alert-success {
  background-color: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.alert-error {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

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

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

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

.stat-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-wrap svg {
  width: 26px;
  height: 26px;
}

.stat-icon-teal {
  background-color: #ccfbf1;
  color: #0f766e;
}

.stat-icon-amber {
  background-color: #fef3c7;
  color: #b45309;
}

.stat-icon-blue {
  background-color: #e0f2fe;
  color: #0369a1;
}

.stat-icon-emerald {
  background-color: #d1fae5;
  color: #047857;
}

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

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

/* Card Panel */
.admin-card {
  background-color: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  box-shadow: var(--admin-shadow-sm);
  margin-bottom: 2rem;
  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;
  flex-wrap: wrap;
  gap: 1rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}

.card-subtitle {
  font-size: 0.8125rem;
  color: var(--admin-text-muted);
  margin-top: 2px;
}

.card-body {
  padding: 1.5rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.125rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-primary {
  background-color: var(--admin-primary);
  color: #fff;
  box-shadow: 0 2px 4px rgba(15, 118, 110, 0.25);
}

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

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--admin-border);
  color: var(--admin-text-main);
}

.btn-outline:hover {
  background-color: #f1f5f9;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  border-radius: 6px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #f8fafc;
  border: 1px solid var(--admin-border);
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-icon:hover {
  background-color: #e2e8f0;
  color: #0f172a;
}

.btn-icon-danger:hover {
  background-color: #fee2e2;
  color: #dc2626;
  border-color: #fecaca;
}

.btn-icon-success:hover {
  background-color: #d1fae5;
  color: #059669;
  border-color: #a7f3d0;
}

.btn-icon svg {
  width: 15px;
  height: 15px;
}

/* Tables */
.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-color: #f8fafc;
  color: #475569;
  font-weight: 600;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--admin-border);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

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

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

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

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

.badge-info {
  background-color: #e0f2fe;
  color: #0369a1;
}

.badge-warning {
  background-color: #fef3c7;
  color: #b45309;
}

.badge-muted {
  background-color: #f1f5f9;
  color: #64748b;
}

.badge-primary {
  background-color: #ede9fe;
  color: #6d28d9;
}

.badge-teal {
  background-color: #ccfbf1;
  color: #0f766e;
}

.badge-indigo {
  background-color: #e0e7ff;
  color: #4338ca;
}

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

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.375rem;
}

.form-control {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: inherit;
  color: #0f172a;
  background-color: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

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

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.5rem;
}

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

.modal-dialog {
  background-color: #fff;
  border-radius: var(--admin-radius);
  box-shadow: var(--admin-shadow-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalScaleUp 0.2s ease-out;
}

.modal-dialog-lg {
  max-width: 820px;
}

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

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

.modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #0f172a;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: #64748b;
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
}

.modal-close:hover {
  color: #0f172a;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  background-color: #f8fafc;
}

/* Login Page Specific */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top right, #134e48, #092623);
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border-radius: 16px;
  padding: 2.5rem 2rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

.login-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo-box {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--admin-primary), var(--admin-primary-dark));
  border-radius: 14px;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  box-shadow: 0 8px 16px rgba(15, 118, 110, 0.3);
}

.login-logo-box svg {
  width: 28px;
  height: 28px;
}

.login-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
}

.login-sub {
  font-size: 0.8125rem;
  color: var(--admin-text-muted);
  margin-top: 0.375rem;
}

/* Responsive */
@media (max-width: 900px) {
  .admin-sidebar {
    transform: translateX(-100%);
    box-shadow: 12px 0 35px rgba(0, 0, 0, 0.4);
    z-index: 50;
  }
  .admin-sidebar.open {
    transform: translateX(0);
  }
  .admin-main {
    margin-left: 0;
  }
  .sidebar-toggle-btn {
    display: inline-flex;
  }
  .sidebar-close-btn {
    display: inline-flex;
  }
  .admin-topbar {
    padding: 0 1.25rem;
    height: 62px;
  }
  .admin-content {
    padding: 1.25rem;
  }
}

@media (max-width: 640px) {
  .admin-topbar {
    padding: 0 0.875rem;
    height: 58px;
  }

  .topbar-left {
    gap: 0.625rem;
    min-width: 0;
  }

  .topbar-title {
    font-size: 0.9375rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
  }

  .topbar-right {
    gap: 0.375rem;
    flex-shrink: 0;
  }

  /* Compact button styling on mobile topbar */
  .btn-view-site span,
  .btn-logout span {
    display: none;
  }

  .btn-view-site,
  .btn-logout {
    padding: 0.5rem;
    border-radius: 8px;
  }

  .btn-view-site svg,
  .btn-logout svg {
    width: 17px;
    height: 17px;
  }

  .admin-content {
    padding: 0.875rem;
  }

  /* 2x2 Stats Grid on Mobile */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.625rem;
    margin-bottom: 1.25rem;
  }

  .stat-card {
    padding: 0.875rem;
    gap: 0.625rem;
    flex-direction: column;
    align-items: flex-start;
  }

  .stat-icon-wrap {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  .stat-icon-wrap svg {
    width: 20px;
    height: 20px;
  }

  .stat-val {
    font-size: 1.25rem;
  }

  .stat-lbl {
    font-size: 0.6875rem;
    line-height: 1.2;
  }

  /* Card and Panel spacing */
  .admin-card {
    margin-bottom: 1.25rem;
    border-radius: 10px;
  }

  .card-header {
    padding: 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .card-header > div:last-child {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .card-body {
    padding: 1rem;
  }

  /* Modals on Mobile */
  .modal-backdrop {
    padding: 0.75rem;
  }

  .modal-dialog {
    max-width: 100%;
    border-radius: 12px;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 1rem;
  }
}
