/* ==========================================================================
   AzES - MODERN GLOBAL STYLESHEET (azes-style.css)
   Sistem Pengurusan Pemasangan Peranti (Modern SaaS Edition)
   ========================================================================== */

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

:root {
  /* Palet Warna Primer & Aksen Moden */
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-glow: rgba(79, 70, 229, 0.15);

  /* Latar Belakang & Permukaan */
  --bg-main: #f8fafc;
  --surface: #ffffff;
  --surface-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-focus: #818cf8;

  /* Tipografi */
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  /* Status Warna Beraksen Neon/Soft */
  --pending: #d97706;
  --pending-bg: #fffbeb;
  --pending-border: #fde68a;

  --in-progress: #2563eb;
  --in-progress-bg: #eff6ff;
  --in-progress-border: #bfdbfe;

  --completed: #059669;
  --completed-bg: #ecfdf5;
  --completed-border: #a7f3d0;

  --danger: #e11d48;
  --danger-bg: #fff1f2;
  --danger-border: #fecdd3;

  /* Struktur, Bayang & Radius */
  --radius: 14px;
  --radius-sm: 8px;
  --radius-pill: 9999px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.06), 0 4px 6px -4px rgb(0 0 0 / 0.05);
  --shadow-hover: 0 20px 25px -5px rgb(0 0 0 / 0.08), 0 8px 10px -6px rgb(0 0 0 / 0.04);
  
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   1. STRUKTUR SIDEBAR, TOPBAR & FOOTER LAYOUT
   ========================================================================== */
.layout-body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-main);
  min-height: 100vh;
}

.app-wrapper {
  display: flex;
  min-height: 100vh;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar Gelap Moden */
.app-sidebar {
  width: 270px;
  background-color: #090d16;
  background-image: radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.12) 0px, transparent 50%);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-right: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar-header {
  height: 70px;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: #ffffff;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.15rem;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.brand-text {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-close-btn {
  display: none;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.3rem;
}

/* Profil Pengguna Sidebar */
.sidebar-user-card {
  margin: 1.25rem 1rem 0.5rem 1rem;
  padding: 0.9rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.user-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.user-role {
  font-size: 0.72rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* Navigasi Sidebar */
.sidebar-nav {
  flex: 1;
  padding: 1.25rem 0.85rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.nav-section-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
  padding: 0.85rem 0.6rem 0.35rem 0.6rem;
  font-weight: 800;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 10px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-link i {
  width: 20px;
  font-size: 1.1rem;
  text-align: center;
  color: #64748b;
  transition: color 0.2s ease;
}

.sidebar-link:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.sidebar-link:hover i {
  color: #cbd5e1;
}

.sidebar-link.active {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.9), rgba(99, 102, 241, 0.8));
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

.sidebar-link.active i {
  color: #ffffff;
}

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

.sidebar-logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  background: rgba(225, 29, 72, 0.08);
  color: #fb7185;
  border: 1px solid rgba(225, 29, 72, 0.15);
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sidebar-logout-btn:hover {
  background: var(--danger);
  color: #ffffff;
  border-color: var(--danger);
}

/* 2. MAIN CONTENT AREA & TOPBAR */
.app-main-area {
  flex: 1;
  margin-left: 270px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-topbar {
  height: 70px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}

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

.topbar-toggle-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.topbar-toggle-btn:hover {
  background-color: var(--surface-hover);
  border-color: #cbd5e1;
}

.topbar-title {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

.topbar-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface-hover);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
}

/* 3. FOOTER */
.app-footer {
  margin-top: auto;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1.25rem 1.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-container {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}

/* Desktop Collapsed */
.app-wrapper.sidebar-collapsed .app-sidebar {
  transform: translateX(-100%);
}

.app-wrapper.sidebar-collapsed .app-main-area {
  margin-left: 0;
}

/* ==========================================================================
   2. KONTENA & KAD METRIK STATISTIK MODEN
   ========================================================================== */
.container {
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
  padding: 1.75rem;
}

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

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.35rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
  opacity: 0.8;
}

.stat-card:nth-child(1)::after { background: var(--pending); }
.stat-card:nth-child(2)::after { background: var(--in-progress); }
.stat-card:nth-child(3)::after { background: var(--completed); }
.stat-card:nth-child(4)::after { background: var(--primary); }

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-top: 0.25rem;
  line-height: 1;
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   3. BORANG CARIAN, PENAPIS & INPUT KAWALAN (FLOATING FILTER BAR)
   ========================================================================== */
.filter-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.15rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.filter-grid {
  display: grid;
  grid-template-columns: 2.2fr 1.2fr 1.2fr 1.2fr auto;
  gap: 0.85rem;
}

.input-control, .select-control {
  width: 100%;
  padding: 0.7rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  outline: none;
  background-color: #fafbfc;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.input-control:hover, .select-control:hover {
  background-color: var(--surface);
  border-color: #cbd5e1;
}

.input-control:focus, .select-control:focus {
  background-color: var(--surface);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

textarea.input-control {
  resize: vertical;
  min-height: 90px;
}

/* ==========================================================================
   4. BUTANG & LENCANA STATUS (MODERN BUTTONS & BADGES)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.15rem;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.btn-primary { 
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: #ffffff; 
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover { 
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
  background: var(--primary-hover);
}

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

.btn-outline:hover {
  background-color: var(--surface-hover);
  border-color: #cbd5e1;
  color: var(--primary);
}

.btn-danger { 
  background: var(--danger-bg); 
  color: var(--danger); 
  border: 1px solid var(--danger-border);
}

.btn-danger:hover {
  background: var(--danger);
  color: #ffffff;
  border-color: var(--danger);
}

.btn-sm { 
  padding: 0.4rem 0.75rem; 
  font-size: 0.8rem; 
  border-radius: var(--radius-sm);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge-pending { 
  background: var(--pending-bg); 
  color: var(--pending); 
  border: 1px solid var(--pending-border);
}

.badge-in_progress { 
  background: var(--in-progress-bg); 
  color: var(--in-progress); 
  border: 1px solid var(--in-progress-border);
}

.badge-completed { 
  background: var(--completed-bg); 
  color: var(--completed); 
  border: 1px solid var(--completed-border);
}

/* ==========================================================================
   5. JADUAL MODERN ELEVATED TABLE & MOBILE CARDS
   ========================================================================== */
.table-responsive {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

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

.custom-table td {
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  vertical-align: middle;
  background-color: var(--surface);
  transition: background-color 0.15s ease;
}

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

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

/* Badge ID Khas */
.custom-table td:first-child,
.mobile-card-header span:first-child {
  font-family: var(--font-mono);
  font-weight: 700;
}

.mobile-card-list {
  display: none;
}

/* ==========================================================================
   6. BORANG RESPANSIF (MODERN CARD FORM)
   ========================================================================== */
.form-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 2rem;
  box-shadow: var(--shadow-md);
}

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

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.45rem;
  color: var(--text-main);
}

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

.form-row-location {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
}

/* ==========================================================================
   7. MODAL PENGESAHAN TUKAR STATUS (POPUP)
   ========================================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

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

.modal-content {
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 440px;
  width: 100%;
  padding: 1.75rem;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  border: 1px solid var(--border);
  text-align: center;
  animation: modalScale 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScale {
  from {
    transform: scale(0.92);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--pending-bg);
  color: var(--pending);
  border: 1px solid var(--pending-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

.modal-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.55;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

/* ==========================================================================
   8. PAGINATION BERNOMBOR & PEMBAIKAN SAIZ IKON
   ========================================================================== */
nav[role="navigation"] svg {
  width: 18px !important;
  height: 18px !important;
  display: inline-block;
  vertical-align: middle;
}

.custom-pagination-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.25rem 0 0.5rem 0;
}

.pagination-info {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 500;
}

.pagination-info span {
  font-weight: 700;
  color: var(--text-main);
}

.pagination-list {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}

.page-item .page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-main);
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.page-item:not(.active):not(.disabled) .page-link:hover {
  background-color: var(--surface-hover);
  border-color: #cbd5e1;
  color: var(--primary);
  transform: translateY(-1px);
}

.page-item.active .page-link {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.page-item.disabled .page-link {
  background-color: #f8fafc;
  border-color: var(--border);
  color: #94a3b8;
  cursor: not-allowed;
  opacity: 0.6;
}

/* ==========================================================================
   9. ALERTS
   ========================================================================== */
.alert {
  padding: 0.9rem 1.15rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  box-shadow: var(--shadow-sm);
}

.alert-success { 
  background: var(--completed-bg); 
  color: var(--completed); 
  border: 1px solid var(--completed-border); 
}

.alert-danger { 
  background: var(--danger-bg); 
  color: var(--danger); 
  border: 1px solid var(--danger-border); 
}

/* ==========================================================================
   10. MEDIA QUERIES (RESPONSIF MOBILE & TABLET)
   ========================================================================== */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(3px);
  z-index: 95;
}

.sidebar-backdrop.active {
  display: block;
}

@media (max-width: 1024px) {
  .filter-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 992px) {
  .app-sidebar {
    transform: translateX(-100%);
  }

  .sidebar-close-btn {
    display: inline-block;
  }

  .app-main-area {
    margin-left: 0;
  }

  .app-wrapper.sidebar-mobile-open .app-sidebar {
    transform: translateX(0);
  }

  .topbar-title {
    font-size: 0.9rem;
  }
}

@media (max-width: 768px) {
  .table-responsive {
    display: none;
  }

  .mobile-card-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .mobile-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.15rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
  }

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

  .mobile-field {
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
    color: var(--text-muted);
  }

  .mobile-field strong {
    color: var(--text-main);
  }
}

@media (max-width: 640px) {
  .container {
    padding: 1.15rem;
  }

  .filter-grid {
    grid-template-columns: 1fr;
  }

  .form-card {
    padding: 1.35rem 1.15rem;
  }

  .form-row-2,
  .form-row-location {
    grid-template-columns: 1fr !important;
    gap: 0;
  }

  .form-btn-submit {
    width: 100% !important;
    padding: 0.85rem 1rem !important;
  }

  .custom-pagination-container {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .topbar-date {
    display: none;
  }

  .footer-container {
    flex-direction: column;
    text-align: center;
    justify-content: center;
  }
}