/* ==========================================================================
   TECHNOVA — TECHNICAL SERVICE MANAGEMENT
   Calm Modern Gradient Design System
   ========================================================================== */

:root {
  --bg-page: linear-gradient(145deg, #f8fafc 0%, #eef4f7 52%, #e6f0f2 100%);
  --bg-surface: rgba(255, 255, 255, 0.86);
  --bg-surface-solid: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-sidebar: linear-gradient(180deg, #0f172a 0%, #132a3a 60%, #0f4c5c 100%);
  --brand-gradient: linear-gradient(135deg, #0f4c5c 0%, #167a8a 55%, #14b8a6 100%);
  --brand-soft: rgba(15, 76, 92, 0.08);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-color: rgba(15, 23, 42, 0.09);

  --accent: #0f766e;
  --accent-hover: #0d5f59;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0284c7;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 10px 28px rgba(15, 23, 42, 0.08);
  --shadow-modal: 0 24px 60px rgba(15, 23, 42, 0.22);

  --sidebar-w: 260px;
  --topbar-h: 64px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html, body {
  height: 100%;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--bg-page);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* ---------------- Login Screen ---------------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at 15% 20%, rgba(20, 184, 166, 0.14), transparent 45%),
              radial-gradient(circle at 85% 80%, rgba(15, 76, 92, 0.18), transparent 50%),
              #f1f5f9;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 32px 28px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.login-brand img { width: 46px; height: 46px; border-radius: 12px; }
.login-brand h1 { font-size: 20px; font-weight: 800; letter-spacing: 0.4px; color: #0f172a; }
.login-brand p { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; }
.login-tagline {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 20px;
  padding: 8px 12px;
  background: var(--brand-soft);
  border-radius: var(--radius-sm);
}

/* ---------------- App Shell ---------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 40;
  transition: transform 0.25s ease;
}

.sidebar-header {
  padding: 20px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-header img { width: 36px; height: 36px; border-radius: 10px; }
.sidebar-title { font-weight: 800; font-size: 16px; color: #fff; letter-spacing: 0.5px; }
.sidebar-sub { font-size: 10px; color: #94a3b8; letter-spacing: 0.6px; }

.sidebar-nav {
  flex: 1;
  padding: 14px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #cbd5e1;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.nav-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-item.active {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.24), rgba(15, 118, 110, 0.36));
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(94, 234, 212, 0.25);
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
}

.user-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.user-pill strong { display: block; color: #fff; font-size: 13px; }
.user-pill span {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(94, 234, 212, 0.18);
  color: #5eead4;
  font-weight: 600;
}

.session-timer { font-size: 11px; color: #94a3b8; margin-bottom: 10px; }

/* ---------------- Main Area & Topbar ---------------- */
.main-area {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-left h2 { font-size: 17px; font-weight: 700; color: var(--text-primary); }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.net-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
}
.net-badge .dot { width: 7px; height: 7px; border-radius: 50%; }
.net-badge.online { background: #ecfdf5; color: #047857; }
.net-badge.online .dot { background: #10b981; }
.net-badge.offline { background: #fef2f2; color: #b91c1c; }
.net-badge.offline .dot { background: #ef4444; }

.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  background: #eff6ff;
  color: #1d4ed8;
}

.content-wrap {
  padding: 22px 24px 80px;
  max-width: 1380px;
  width: 100%;
  margin: 0 auto;
}

/* ---------------- Cards & Grids ---------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.kpi-card {
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.kpi-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.kpi-value { font-size: 28px; font-weight: 800; margin: 6px 0 4px; color: var(--text-primary); }
.kpi-sub { font-size: 11.5px; color: var(--text-secondary); }

.panel {
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 20px;
}

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

.panel-header h3 { font-size: 15.5px; font-weight: 700; }

/* ---------------- Buttons & Inputs ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.16s ease;
  text-decoration: none;
}

.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--brand-gradient); color: #fff; box-shadow: 0 4px 12px rgba(15, 76, 92, 0.22); }
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-secondary { background: #fff; color: var(--text-primary); border-color: var(--border-color); }
.btn-secondary:hover { background: var(--bg-subtle); }
.btn-danger { background: #fee2e2; color: #b91c1c; }
.btn-danger:hover { background: #fecaca; }
.btn-success { background: #d1fae5; color: #047857; }
.btn-success:hover { background: #a7f3d0; }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }

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

.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.input, select.input, textarea.input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.15);
  background: #fff;
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color 0.16s, box-shadow 0.16s;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.search-wrap {
  position: relative;
  min-width: 220px;
  flex: 1;
}

.search-wrap .input { padding-right: 34px; }
.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
}

/* ---------------- Tables & Badges ---------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border-color); }
th {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  font-weight: 700;
  background: rgba(241, 245, 249, 0.7);
}
tr:hover td { background: rgba(15, 76, 92, 0.025); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.b-pending { background: #fef3c7; color: #b45309; }
.b-progress { background: #e0f2fe; color: #0369a1; }
.b-waiting { background: #ede9fe; color: #6d28d9; }
.b-completed { background: #d1fae5; color: #047857; }
.b-breached { background: #fee2e2; color: #b91c1c; }
.b-warning { background: #ffedd5; color: #c2410c; }
.b-ontrack { background: #ccfbf1; color: #0f766e; }

/* Kode Jadwal Teknisi: - (Masuk), O (Off), AL (Cuti) */
.sch-masuk { background: #d1fae5; color: #047857; }
.sch-off { background: #e2e8f0; color: #475569; }
.sch-al { background: #fee2e2; color: #b91c1c; }

/* ---------------- Photo Capture Box ---------------- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.photo-card {
  border: 1.5px dashed rgba(15, 76, 92, 0.28);
  border-radius: var(--radius-md);
  padding: 14px;
  background: rgba(248, 250, 252, 0.8);
  text-align: center;
}

.photo-preview {
  width: 100%;
  height: 170px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 10px;
  background: #e2e8f0;
}

.photo-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------------- Modern Modal & Toast ---------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
  animation: fadeIn 0.18s ease;
}

.modal-box {
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  padding: 24px;
  animation: slideUp 0.2s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.modal-close {
  background: var(--bg-subtle);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.toast-container {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 340px;
}

.toast {
  background: #0f172a;
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  border-left: 4px solid #14b8a6;
  animation: slideUp 0.2s ease;
}
.toast.error { border-left-color: #ef4444; }
.toast.warning { border-left-color: #f59e0b; }

/* ---------------- Mobile Bottom Nav ---------------- */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-color);
  z-index: 45;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  justify-content: space-around;
}

.mobile-nav button {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
}
.mobile-nav button.active { color: var(--accent); }
.mobile-nav button svg { width: 20px; height: 20px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .topbar { padding: 0 14px; }
  .content-wrap { padding: 16px 14px 88px; }
  .mobile-nav { display: flex; }
}

@media print {
  .sidebar, .topbar, .mobile-nav, .no-print { display: none !important; }
  .main-area { margin-left: 0 !important; }
  body { background: #fff !important; }
}
