/* ==========================================================
   PT. KISBIOKIM MEDIKA LABORATORI - ADMIN DASHBOARD CSS
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&family=Roboto:wght@300;400;500;700&display=swap');

:root {
  --admin-primary: #3957ed;
  --admin-primary-dark: #1b33b8;
  --admin-primary-light: #80c8f6;
  --admin-sidebar-bg: #0d1b3e;
  --admin-bg: #f4f8fc;
  --admin-card-bg: rgba(255, 255, 255, 0.9);
  --admin-border: rgba(226, 232, 240, 0.8);
  --admin-text-dark: #0f172a;
  --admin-text-muted: #64748b;
  --font-heading: 'Montserrat', sans-serif;
  --font-body: 'Roboto', sans-serif;
}

body.admin-body {
  font-family: var(--font-body);
  background: var(--admin-bg);
  color: #334155;
  margin: 0;
  display: flex;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Off-Canvas Backdrop for Mobile */
.admin-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.admin-sidebar-backdrop.active {
  display: block;
  opacity: 1;
}

/* Sidebar */
.admin-sidebar {
  width: 260px;
  background: var(--admin-sidebar-bg);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 50;
}

.admin-brand {
  padding: 22px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
}

.admin-sidebar-close {
  display: none;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

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

.admin-brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--admin-primary) 0%, var(--admin-primary-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.admin-brand-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.admin-brand-sub {
  font-size: 0.7rem;
  color: #94a3b8;
  letter-spacing: 0.5px;
}

.admin-nav {
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
  overflow-y: auto;
}

.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  color: #94a3b8;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.admin-nav-link i {
  font-size: 1.1rem;
  flex-shrink: 0;
}

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

.admin-nav-link.active {
  background: linear-gradient(135deg, var(--admin-primary) 0%, #2041db 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(57, 87, 237, 0.35);
}

.admin-user-profile {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-user-info {
  display: flex;
  flex-direction: column;
  margin-right: auto;
  min-width: 0;
}

.admin-user-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-user-role {
  font-size: 0.7rem;
  color: var(--admin-primary-light);
  margin-top: 2px;
}

.logout-btn {
  color: #f87171;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  margin-left: 16px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.logout-btn:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.logout-text {
  font-size: 0.78rem;
  font-weight: 700;
}

/* Main Content Area */
.admin-main {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

.admin-topbar {
  background: #ffffff;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--admin-border);
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.admin-topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.admin-topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.admin-sidebar-toggle {
  display: none;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  font-size: 1.35rem;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
}

.admin-sidebar-toggle:hover {
  background: #e2e8f0;
}

.admin-page-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--admin-text-dark);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-content {
  padding: 28px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  flex-grow: 1;
}

/* Card System */
.admin-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 26px;
  border: 1px solid var(--admin-border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
  margin-bottom: 24px;
  width: 100%;
  box-sizing: border-box;
}

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

.admin-card-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--admin-text-dark);
  margin: 0;
}

/* Responsive Product Form Grids */
.admin-product-form-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 28px;
  align-items: start;
}

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

.admin-category-sync-box {
  background: #f8fafc;
  padding: 18px;
  border-radius: 12px;
  border: 1.5px solid #e2e8f0;
  margin-bottom: 20px;
}

.admin-brand-url-box {
  background: #f0fdf4;
  padding: 18px;
  border-radius: 12px;
  border: 1.5px solid #bbf7d0;
  margin-bottom: 20px;
}

.admin-featured-box {
  background: #fffbeb;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1.5px solid #fde68a;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.admin-image-upload-box {
  margin-top: 12px;
  text-align: center;
  background: #ffffff;
  border: 1.5px dashed #cbd5e1;
  border-radius: 12px;
  padding: 16px;
}

.admin-form-actions {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

/* Responsive Table Wrapper */
.admin-table-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 20px;
  border-radius: 12px;
  border: 1px solid var(--admin-border);
  background: #ffffff;
}

.admin-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  white-space: normal;
}

.admin-table th {
  background: #f8fafc;
  padding: 14px 16px;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
  text-align: left;
  border-bottom: 1.5px solid #e2e8f0;
  white-space: nowrap;
}

.admin-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  font-size: 0.88rem;
  color: #334155;
}

.admin-table tr:hover td {
  background: #fafcff;
}

/* Stats Cards */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.admin-stat-card {
  background: var(--admin-card-bg);
  border-radius: 14px;
  padding: 20px;
  border: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

.admin-stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-icon-blue {
  background: rgba(57, 87, 237, 0.12);
  color: var(--admin-primary);
}

.stat-icon-cyan {
  background: rgba(128, 200, 246, 0.2);
  color: #0284c7;
}

.stat-icon-green {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.stat-icon-amber {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

.admin-card-alt {
  background: var(--admin-card-bg);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  border: 1px solid var(--admin-border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
  padding: 24px;
  margin-bottom: 28px;
}

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

.admin-card-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--admin-text-dark);
}

/* Tables & Horizontal Scroll Container */
.admin-table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 20px;
}

.admin-table {
  width: 100%;
  min-width: 650px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th {
  background: #f8fafc;
  padding: 12px 16px;
  text-align: left;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--admin-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1.5px solid var(--admin-border);
}

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

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

.table-img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: contain;
  background: #ffffff;
  padding: 4px;
  border: 1px solid var(--admin-border);
}

/* Status Badges */
.badge-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-active {
  background: #dcfce7;
  color: #15803d;
}

.status-inactive {
  background: #fee2e2;
  color: #b91c1c;
}

/* Forms */
.admin-form-group {
  margin-bottom: 20px;
}

.admin-form-label {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--admin-text-dark);
  margin-bottom: 8px;
}

.admin-form-control {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--admin-border);
  font-family: var(--font-body);
  font-size: 0.92rem;
  outline: none;
  transition: all 0.2s;
  box-sizing: border-box;
}

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

/* Dynamic Variant Repeater */
.variant-repeater-box {
  background: #f8fafc;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  padding: 18px;
  margin-top: 14px;
}

.variant-row {
  display: grid;
  grid-template-columns: 2fr 1.5fr 1.5fr 1.5fr auto;
  gap: 10px;
  margin-bottom: 10px;
  align-items: center;
}

.btn-remove-row {
  background: #fee2e2;
  color: #dc2626;
  border: none;
  border-radius: 6px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-remove-row:hover {
  background: #fca5a5;
}

/* Login Page Styling */
.login-body {
  background: linear-gradient(135deg, #0b152d 0%, #172a58 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  margin: 0;
  font-family: var(--font-body);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-logo {
  width: 54px;
  height: 54px;
  background: linear-gradient(135deg, var(--admin-primary) 0%, var(--admin-primary-light) 100%);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0 auto 16px;
}

.alert-danger {
  background: #fee2e2;
  border: 1px solid #f87171;
  color: #991b1b;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.alert-success {
  background: #dcfce7;
  border: 1px solid #4ade80;
  color: #166534;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

/* ==========================================================
   ADMIN RESPONSIVE SYSTEM
   ========================================================== */
@media (max-width: 1024px) {
  .admin-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .admin-product-form-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .admin-content {
    padding: 22px;
  }
}

@media (max-width: 992px) {
  /* Sidebar transforms to Off-Canvas Drawer on Tablet and Mobile */
  .admin-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .admin-sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    height: 100vh;
    overflow-y: auto;
    transform: translateX(-100%);
    z-index: 999;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.4);
  }

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

@media (max-width: 768px) {
  .admin-content {
    padding: 16px;
  }

  .admin-card {
    padding: 18px 16px;
    border-radius: 14px;
  }

  .admin-form-row-2 {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .admin-card-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 14px;
  }

  .admin-card-header > div:last-child {
    width: 100%;
  }

  .admin-card-header a,
  .admin-card-header button {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .admin-form-actions {
    flex-direction: column-reverse;
    gap: 10px;
  }

  .admin-form-actions a,
  .admin-form-actions button {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .admin-topbar {
    padding: 12px 16px;
  }

  .admin-page-title {
    font-size: 1.1rem;
  }

  .badge-status-text {
    display: none;
  }
}

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

  .admin-content {
    padding: 12px;
  }

  .admin-topbar {
    padding: 10px 14px;
  }

  .admin-card {
    padding: 16px 12px;
  }
}
