/* =====================================================
   IT Asset Management - Main Stylesheet
   ===================================================== */

:root {
  --sidebar-bg: #1e293b;
  --sidebar-active: #3b82f6;
  --sidebar-hover: #334155;
  --sidebar-text: #cbd5e1;
  --sidebar-text-active: #ffffff;

  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --success: #10b981;
  --success-dark: #059669;
  --danger: #ef4444;
  --danger-dark: #dc2626;
  --warning: #f59e0b;
  --warning-dark: #d97706;
  --info: #06b6d4;

  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;

  --radius: 8px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg:
    0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

html,
body {
  height: 100%;
  /* Cegah horizontal scroll di level page; tabel yang terlalu lebar
       tetap bisa scroll internal lewat .table-wrap */
  overflow-x: clip;
  max-width: 100vw;
}

/* Smooth scroll untuk anchor link / scroll programatik */
html {
  scroll-behavior: smooth;
}
.sidebar {
  scroll-behavior: smooth;
}
.main {
  scroll-behavior: smooth;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
  background-color: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

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

.sidebar {
  width: 260px;
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-brand {
  padding: 20px 24px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-brand .logo {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-size: 16px;
  overflow: hidden;
}
.sidebar-brand .logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}

.sidebar-nav {
  padding: 16px 12px;
  list-style: none;
}
.sidebar-nav .nav-section {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  padding: 16px 12px 8px;
}
.sidebar-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
  font-weight: 500;
  overflow: hidden;
  transition:
    background-color 1.25s cubic-bezier(0.4, 0, 0.2, 1),
    color 1.25s cubic-bezier(0.4, 0, 0.2, 1),
    transform 1.25s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 1.25s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Left indicator bar - slides in on hover/active */
.sidebar-nav a::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--sidebar-active);
  transform: scaleY(0);
  transform-origin: center;
  opacity: 0;
  transition:
    transform 1.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 1.25s ease;
}
.sidebar-nav a:hover {
  background-color: var(--sidebar-hover);
  color: #fff;
  transform: translateX(2px);
}
.sidebar-nav a:hover::before {
  transform: scaleY(0.5);
  opacity: 0.6;
}
.sidebar-nav a.active {
  background-color: var(--sidebar-active);
  color: var(--sidebar-text-active);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
  animation: nav-active-in 1.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.sidebar-nav a.active::before {
  background: #fff;
  transform: scaleY(1);
  opacity: 1;
}
.sidebar-nav a.active .ui-icon {
  animation: nav-icon-pop 1.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.sidebar-nav .icon {
  width: 18px;
  display: inline-grid;
  place-items: center;
  transition: transform 1.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar-nav a:hover .icon {
  transform: scale(1.08);
}

@keyframes nav-active-in {
  0% {
    transform: translateX(-6px);
    opacity: 0.6;
  }
  60% {
    transform: translateX(2px);
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}
@keyframes nav-icon-pop {
  0% {
    transform: scale(0.85);
  }
  60% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
  }
}

/* Honor user's motion preference */
@media (prefers-reduced-motion: reduce) {
  .sidebar-nav a,
  .sidebar-nav a::before,
  .sidebar-nav .icon {
    transition: none;
    animation: none;
  }
  .sidebar-nav a:hover {
    transform: none;
  }
}

.main {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
}

.topbar {
  background-color: var(--card);
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar h1 {
  font-size: 18px;
  font-weight: 600;
}
.topbar .user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.topbar .user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
}
/*  */
.content {
  padding: 28px;
  flex: 1;
  animation: content-enter 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Animasi masuk konten tiap kali pindah halaman — tidak terlihat "lompat". */
@keyframes content-enter {
  0% {
    opacity: 0;
    transform: translateY(12px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Honor user motion preference */
@media (prefers-reduced-motion: reduce) {
  html,
  .sidebar,
  .main {
    scroll-behavior: auto;
  }
  .content {
    animation: none;
  }
}

/* =============== CARDS =============== */
.card {
  background-color: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h2 {
  font-size: 16px;
  font-weight: 600;
}
.card-body {
  padding: 22px;
}

/* =============== STAT CARDS (DASHBOARD) =============== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-size: 22px;
  color: #fff;
  flex-shrink: 0;
}
.stat-icon.blue {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}
.stat-icon.green {
  background: linear-gradient(135deg, #10b981, #059669);
}
.stat-icon.orange {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}
.stat-icon.red {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}
.stat-icon.purple {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}
.stat-icon.cyan {
  background: linear-gradient(135deg, #06b6d4, #0891b2);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}
.stat-value {
  font-size: 24px;
  font-weight: 700;
}

/* =============== PROGRESS BAR =============== */
.progress-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
}

/* =============== BUTTONS =============== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  font-family: inherit;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-dark);
}
.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover {
  background: var(--success-dark);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: var(--danger-dark);
}
.btn-warning {
  background: var(--warning);
  color: #fff;
}
.btn-warning:hover {
  background: var(--warning-dark);
}
.btn-secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: #f8fafc;
}
.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}

/* =============== FORMS =============== */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}
.form-group {
  margin-bottom: 18px;
}
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 13px;
  color: var(--text);
}
.form-group .required {
  color: var(--danger);
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
textarea.form-control {
  resize: vertical;
  min-height: 80px;
}
.form-actions {
  display: flex;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}

/* =============== TABLES =============== */
.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table thead th {
  background: #f8fafc;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td {
  border-bottom: none;
}
.table tbody tr:hover {
  background: #f8fafc;
}
.table .actions {
  display: flex;
  gap: 6px;
  white-space: nowrap;
}

/* =============== BADGES =============== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-success {
  background: #d1fae5;
  color: #065f46;
}
.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}
.badge-warning {
  background: #fef3c7;
  color: #92400e;
}
.badge-info {
  background: #cffafe;
  color: #155e75;
}
.badge-gray {
  background: #e2e8f0;
  color: #475569;
}

/* =============== ALERTS / FLASH =============== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 13px;
  border-left: 4px solid;
}
.alert-success {
  background: #ecfdf5;
  color: #065f46;
  border-color: var(--success);
}
.alert-danger {
  background: #fef2f2;
  color: #991b1b;
  border-color: var(--danger);
}
.alert-warning {
  background: #fffbeb;
  color: #92400e;
  border-color: var(--warning);
}
.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border-color: var(--primary);
}

/* =============== PAGE HEADER =============== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.page-header h2 {
  font-size: 20px;
  font-weight: 600;
}
.page-header .subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

/* =============== SEARCH BOX =============== */
.search-box {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}
.search-box input {
  flex: 1;
  max-width: 360px;
}

/* =============== LOGIN PAGE (GLASSMORPHISM) =============== */
.login-wrapper {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
  /* background:
        radial-gradient(ellipse at top left,  #2563eb 0%, transparent 55%),
        radial-gradient(ellipse at bottom right, #1e3a8a 0%, transparent 55%),
        linear-gradient(135deg, #1e40af 0%, #1d4ed8 45%, #1e3a8a 100%); */
  background:
    linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)),
    url("images/creative-abstract-mixed-coral-color-painting-with-marble-effect-panorama.jpg")
      center/cover no-repeat;
}

/* Decorative soft blobs di background */
.login-wrapper .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.75;
  animation: blob-float 14s ease-in-out infinite;
}
.login-wrapper .blob-1 {
  top: -120px;
  left: -100px;
  width: 420px;
  height: 420px;
  background: radial-gradient(
    circle,
    rgba(96, 165, 250, 0.55),
    transparent 70%
  );
  animation-delay: -2s;
}
.login-wrapper .blob-2 {
  bottom: -140px;
  right: -120px;
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.6), transparent 70%);
  animation-delay: -6s;
}
.login-wrapper .blob-3 {
  top: 18%;
  right: 12%;
  width: 230px;
  height: 230px;
  background: radial-gradient(
    circle,
    rgba(147, 197, 253, 0.45),
    transparent 70%
  );
  animation-delay: -4s;
}
.login-wrapper .blob-4 {
  bottom: 15%;
  left: 8%;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.5), transparent 70%);
  animation-delay: -9s;
}
@keyframes blob-float {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(30px, -20px) scale(1.08);
  }
  66% {
    transform: translate(-20px, 25px) scale(0.95);
  }
}

/* Card utama - frosted glass */
.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 36px 34px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* Fallback untuk browser lama tanpa backdrop-filter */
@supports not (backdrop-filter: blur(1px)) {
  .login-card {
    background: rgba(30, 58, 138, 0.75);
  }
}

.login-card .brand {
  text-align: center;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.login-card .brand .logo {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
}
.login-card .brand .logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}

/* Stacked variant — image above title, larger logo */
.login-card .brand--stacked {
  flex-direction: column;
  gap: 16px;
  margin-bottom: 28px;
}
.login-card .brand--stacked .logo--lg {
  width: 128px;
  height: 128px;
  border-radius: 18px;
}
.login-card .brand--stacked .brand__title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.login-card h1 {
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 22px;
}

.login-card .form-group {
  margin-bottom: 16px;
}
.login-card .form-group label {
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
}
.login-card .form-control {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  padding: 11px 14px;
  color: #0f172a;
  font-size: 14px;
  transition:
    background 0.2s,
    border-color 0.2s,
    box-shadow 0.2s;
}
.login-card .form-control::placeholder {
  color: #94a3b8;
}
.login-card .form-control:focus {
  background: #fff;
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.22);
  outline: none;
}

/* Password field + eye toggle */
.login-card .password-wrap {
  position: relative;
}
.login-card .password-wrap .form-control {
  padding-right: 42px;
}
.login-card .password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  color: #64748b;
  padding: 6px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  transition:
    color 0.2s,
    background 0.2s;
}
.login-card .password-toggle:hover {
  color: #0f172a;
  background: rgba(15, 23, 42, 0.06);
}
.login-card .password-toggle svg {
  width: 18px;
  height: 18px;
}

.login-card .btn {
  width: 100%;
  justify-content: center;
  padding: 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  margin-top: 6px;
}
.login-card .btn-primary {
  background: #81111e;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.35);
}
.login-card .btn-primary:hover {
  background: #c1192c;
  transform: translateY(-1px);
}

.login-card .alert-danger {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-left: 3px solid #f87171;
  color: #fef2f2;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

.login-hint {
  text-align: center;
  margin-top: 22px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}
.login-hint strong {
  color: #fff;
}

@media (prefers-reduced-motion: reduce) {
  .login-wrapper .blob {
    animation: none;
  }
}

/* =============== PAGINATION =============== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    font-size: 13px;
}
.pagination-info {
    color: var(--text-muted);
}
.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}
.pagination-page {
    color: var(--text-muted);
    padding: 0 8px;
}
.pagination .btn.is-disabled {
    opacity: 0.45;
    pointer-events: none;
    cursor: default;
}

/* =============== EMPTY STATE =============== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state .icon {
  font-size: 40px;
  margin-bottom: 10px;
  opacity: 0.4;
}

/* =============== ICONS =============== */
.ui-icon {
  display: inline-block;
  vertical-align: -3px;
  flex-shrink: 0;
}
.btn .ui-icon {
  vertical-align: -3px;
}
.sidebar-nav .ui-icon {
  vertical-align: middle;
}

/* =============== HAMBURGER TOGGLE + BACKDROP =============== */
.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  padding: 0;
  margin-right: 8px;
  transition: background-color 0.2s ease;
}
.sidebar-toggle:hover {
  background: #f8fafc;
}
.sidebar-toggle svg {
  width: 20px;
  height: 20px;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
  z-index: 99;
}
.sidebar-backdrop.open {
  opacity: 1;
  visibility: visible;
}

/* =============== RESPONSIVE =============== */

/* Tablet & smaller: sidebar jadi overlay */
@media (max-width: 900px) {
  .sidebar-toggle {
    display: inline-flex;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main {
    margin-left: 0;
    min-width: 0; /* allow children to shrink inside flex */
  }

  .topbar {
    padding: 10px 14px;
    gap: 8px;
  }
  .topbar h1 {
    font-size: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .content {
    padding: 16px;
    min-width: 0;
  }

  .card {
    max-width: 100%;
  }
  .card-body {
    padding: 16px;
  }

  /* Page header: title di atas, action button di bawah */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .page-header > a,
  .page-header > div:last-child {
    width: auto;
  }

  /* Form rows: auto-fit sudah ada, tapi kurangi min */
  .form-row {
    grid-template-columns: 1fr;
  }

  /* Search box: stack vertikal, semua full-width */
  .search-box {
    flex-direction: column;
    align-items: stretch;
  }
  .search-box > * {
    max-width: none !important;
    width: 100%;
  }
  .search-box input {
    max-width: none;
  }

  /* Dashboard side-by-side layout jadi stacked */
  .content > div[style*="grid-template-columns: 2fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* Phone: rapihkan lebih lanjut */
@media (max-width: 640px) {
  body {
    font-size: 13px;
  }

  .topbar {
    padding: 8px 10px;
  }
  /* Sembunyikan nama user di topbar, cukup avatar */
  .topbar .user-info > div:not(.user-avatar) {
    display: none;
  }

  .content {
    padding: 12px;
  }

  .page-header h2 {
    font-size: 17px;
  }
  .page-header .subtitle {
    font-size: 12px;
  }

  /* Paksa tabel bisa scroll horizontal sendiri saat konten melebihi viewport */
  .table-wrap {
    margin: 0 -4px; /* extend ke edge card-body untuk ruang scroll lebih lega */
  }
  .table thead th,
  .table tbody td {
    padding: 8px 10px;
    font-size: 12px;
  }
  .table thead th {
    white-space: nowrap;
  }

  /* Stat grid: satu kolom */
  .stat-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .stat-card {
    padding: 16px;
  }
  .stat-value {
    font-size: 20px;
  }

  /* Card padding lebih kecil */
  .card-body {
    padding: 16px;
  }
  .card-header {
    padding: 14px 16px;
  }

  /* Form actions: tombol full-width, stacked */
  .form-actions {
    flex-direction: column;
    gap: 8px;
  }
  .form-actions .btn {
    width: 100%;
    justify-content: center;
  }

  /* Table actions: wrap kalau banyak tombol */
  .table .actions {
    flex-wrap: wrap;
    gap: 4px;
  }
  .table thead th,
  .table tbody td {
    padding: 10px 12px;
  }

  /* Login card: padding kurangi */
  .login-card {
    padding: 24px 20px;
  }
}

/* Honor motion preference */
@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .sidebar-backdrop,
  .sidebar-toggle {
    transition: none;
  }
}

/* Consumable show — dynamic colors via class (avoid Blade in style attr) */
.qty-display { color: var(--text); }
.qty-display.is-low { color: var(--danger); }
.adj-amount.is-positive { color: var(--success-dark); }
.adj-amount.is-negative { color: var(--danger-dark); }

/* Profile dropdown trigger (replaces old static .user-info display) */
.profile-wrap { position: relative; }

.profile-trigger {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 10px 6px 6px;
    background: transparent; border: 1px solid transparent; border-radius: 999px;
    cursor: pointer; font-family: inherit; color: inherit;
    transition: background .15s ease, border-color .15s ease;
}
.profile-trigger:hover,
.profile-trigger[aria-expanded="true"] {
    background: rgba(0, 0, 0, 0.04);
    border-color: var(--border);
}
.profile-trigger__meta { text-align: left; line-height: 1.2; }
.profile-trigger__name { font-weight: 600; font-size: 14px; }
.profile-trigger__role { color: var(--text-muted); font-size: 12px; }
.profile-trigger__caret {
    display: inline-flex; color: var(--text-muted);
    transition: transform .2s ease;
}
.profile-trigger[aria-expanded="true"] .profile-trigger__caret {
    transform: rotate(180deg);
}

/* Dropdown panel */
.profile-dropdown {
    position: absolute; top: calc(100% + 8px); right: 0;
    min-width: 240px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    border: 1px solid var(--border); border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.06);
    padding: 8px; z-index: 1000;
    opacity: 0; transform: translateY(-6px); pointer-events: none;
    transition: opacity .15s ease, transform .15s ease;
}
.profile-dropdown.open {
    opacity: 1; transform: translateY(0); pointer-events: auto;
}

.profile-dropdown__header { padding: 10px 12px 8px; }
.profile-dropdown__name { font-weight: 600; font-size: 14px; }
.profile-dropdown__email { color: var(--text-muted); font-size: 12px; word-break: break-all; }
.profile-dropdown__divider { height: 1px; background: var(--border); margin: 6px 0; }

.profile-dropdown__item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 8px;
    text-decoration: none; color: var(--text); font-size: 14px;
    transition: background .12s ease, color .12s ease;
}
.profile-dropdown__item:hover { background: rgba(0, 0, 0, 0.05); }

.profile-dropdown__logout-form { margin: 0; }
.profile-dropdown__logout {
    width: 100%; background: none; border: none; text-align: left;
    cursor: pointer; font-family: inherit; font-size: 14px; color: var(--text);
}
.profile-dropdown__logout:hover {
    background: rgba(220, 38, 38, 0.08);
    color: var(--danger);
}

@media (max-width: 640px) {
    .profile-trigger__meta { display: none; }
    .profile-dropdown { right: 8px; min-width: 220px; }
}

/* Profile page (users/profile.blade.php) */
.profile-grid {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 10px 16px;
    font-size: 14px;
}
.profile-grid__label { color: var(--text-muted); }
.profile-grid__muted { color: var(--text-muted); }

/* Dashboard 2-col widgets — responsive collapse */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.dashboard-grid--2-1 { grid-template-columns: 2fr 1fr; }

@media (max-width: 900px) {
    .dashboard-grid,
    .dashboard-grid--2-1 {
        grid-template-columns: 1fr;
    }
}

/* Detail pages (asset/consumable/employee/profile) — responsive grid */
.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, var(--detail-left, 360px)) 1fr;
    gap: 20px;
    align-items: start;
}
.detail-grid--narrow { --detail-left: 320px; }

.detail-info-grid {
    display: grid;
    grid-template-columns: var(--info-label, 160px) 1fr;
    gap: 10px 16px;
    font-size: 14px;
}
.detail-info-grid--sm { --info-label: 130px; font-size: 14px; }
.detail-info-grid--xs { --info-label: 100px; font-size: 13px; gap: 8px 14px; }

@media (max-width: 640px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
    .detail-info-grid {
        grid-template-columns: 1fr;
        gap: 4px 0;
    }
    .detail-info-grid > :nth-child(odd) {
        margin-top: 8px;
        font-weight: 500;
    }
}

/* Login page — forgot password link */
.login-forgot {
    text-align: right;
    margin-top: -8px;
    margin-bottom: 14px;
}
.login-link {
    color: #93c5fd;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: color .15s ease, text-decoration-color .15s ease;
}
.login-link:hover,
.login-link:focus {
    color: #ffffff;
    text-decoration: underline;
    text-decoration-color: #ffffff;
    text-underline-offset: 2px;
}
