/* ============================================================
   ISO Document Control System — Styles
   PT Exabytes Network Indonesia
   Theme: Clean Professional — Putih + Biru + Aksen Oranye
   ============================================================ */

/* ----- CSS Variables ----- */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #ea580c;
  --warning-light: #fff7ed;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --white: #ffffff;
  --sidebar-width: 260px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
  --transition: 0.2s ease;
}

/* ----- Reset & Base ----- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  display: flex;
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ----- Sidebar ----- */
#sidebar {
  width: var(--sidebar-width);
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon { font-size: 2rem; }
.brand-text h1 { font-size: 1rem; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.brand-text small { font-size: 0.7rem; color: var(--gray-500); }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--gray-600);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  text-decoration: none;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--gray-100);
  color: var(--gray-900);
  text-decoration: none;
}

.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.nav-icon { font-size: 1.1rem; width: 24px; text-align: center; }

.badge {
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  margin-left: auto;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gray-400);
  flex-shrink: 0;
}

.status-indicator.online { background: var(--success); }
.status-indicator.error { background: var(--danger); }

#status-text { font-size: 0.75rem; color: var(--gray-500); }

/* ----- Main Content ----- */
#main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 32px;
  max-width: calc(100vw - var(--sidebar-width));
  overflow-x: hidden;
}

.view { display: none; }
.view.active { display: block; }

/* ----- Page Header ----- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
}

.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ----- Cards ----- */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

.card-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.card-header h3 { font-size: 0.95rem; font-weight: 600; color: var(--gray-900); }

.card-body { padding: 24px; }

.card-footer {
  padding: 12px 24px;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}

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

.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform var(--transition);
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card.warning { border-left: 4px solid var(--warning); }
.stat-card.danger { border-left: 4px solid var(--danger); }

.stat-icon { font-size: 2rem; }

.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--gray-900); line-height: 1.2; }
.stat-label { font-size: 0.8rem; color: var(--gray-500); margin-top: 2px; }

/* ----- ISO Stats ----- */
.iso-stats { display: flex; flex-direction: column; gap: 16px; }

.iso-stat-item { display: flex; align-items: center; gap: 16px; }

.iso-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
  min-width: 140px;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.progress-fill.green { background: var(--success); }

.iso-count { font-size: 0.8rem; color: var(--gray-500); min-width: 80px; text-align: right; }

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

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

.btn-outline {
  background: var(--white);
  color: var(--gray-700);
  border-color: var(--gray-300);
}

.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-400); }

.btn-success {
  background: var(--success);
  color: var(--white);
  border-color: var(--success);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
  border-color: var(--danger);
}

.btn-sm { padding: 4px 10px; font-size: 0.78rem; }
.btn-lg { padding: 12px 24px; font-size: 0.95rem; }

/* ----- Forms ----- */
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 8px 12px;
  font-size: 0.875rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--gray-800);
  transition: border-color var(--transition);
  font-family: inherit;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

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

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }

.form-actions { display: flex; gap: 8px; }

/* ----- Filter Bar ----- */
.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding: 16px;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}

.filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}

.filter-group .form-input,
.filter-group .form-select {
  width: auto;
  min-width: 160px;
}

.filter-sort .form-select { width: auto; min-width: 140px; }

/* ----- Table ----- */
.table-wrapper { overflow-x: auto; }

.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.doc-table thead {
  background: var(--gray-50);
  border-bottom: 2px solid var(--gray-200);
}

.doc-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--gray-600);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.doc-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}

.doc-table tbody tr:hover { background: var(--gray-50); }

.doc-table .doc-name { font-weight: 600; color: var(--gray-900); }
.doc-table .doc-name a { color: var(--primary); }
.doc-table .doc-name a:hover { text-decoration: underline; }

/* ----- Status Badges ----- */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-active { background: var(--success-light); color: #15803d; }
.status-review { background: var(--warning-light); color: #c2410c; }
.status-overdue { background: var(--danger-light); color: #b91c1c; }
.status-draft { background: var(--gray-100); color: var(--gray-600); }

/* ----- Search Hero ----- */
.search-hero {
  padding: 24px 0;
  margin-bottom: 16px;
}

.search-input-group {
  display: flex;
  gap: 8px;
  max-width: 700px;
}

.search-input-lg {
  font-size: 1rem !important;
  padding: 14px 18px !important;
}

/* ----- Advanced Filters ----- */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.filter-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 4px;
}

.filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ----- Reminders ----- */
.reminder-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 4px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}

.reminder-tab {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--gray-600);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

.reminder-tab.active { background: var(--primary); color: var(--white); }

.reminder-tab:hover:not(.active) { background: var(--gray-100); }

.reminder-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.reminder-stat {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}

.rem-count { font-size: 1.75rem; font-weight: 800; }

.rem-label { font-size: 0.75rem; color: var(--gray-500); margin-top: 4px; }

.danger-text { color: var(--danger); }

/* ----- Modal ----- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(2px);
}

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 640px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 { font-size: 1.05rem; font-weight: 700; }

.modal-close {
  border: none;
  background: none;
  font-size: 1.2rem;
  color: var(--gray-400);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
}

.modal-close:hover { background: var(--gray-100); color: var(--gray-700); }

.modal-body { padding: 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 16px;
  font-size: 0.875rem;
}

.detail-label { font-weight: 600; color: var(--gray-600); }

/* ----- Toast ----- */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  min-width: 280px;
  max-width: 420px;
}

.toast-success { background: var(--success); color: var(--white); }
.toast-error { background: var(--danger); color: var(--white); }
.toast-info { background: var(--primary); color: var(--white); }
.toast-warning { background: var(--warning); color: var(--white); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ----- System Info ----- */
.system-info {
  background: var(--gray-900);
  color: #34d399;
  padding: 16px;
  border-radius: var(--radius);
  font-size: 0.8rem;
  line-height: 1.5;
  overflow-x: auto;
}

/* ----- Utilities ----- */
.text-muted { color: var(--gray-500); }
.text-center { text-align: center; }
.number { font-variant-numeric: tabular-nums; }

/* ----- Responsive ----- */
@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
  #sidebar { display: none; }
  #main-content { margin-left: 0; max-width: 100vw; padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-group { flex-direction: column; }
  .filter-group .form-input, .filter-group .form-select { width: 100%; }
  .reminder-tabs { flex-direction: column; }
  .search-input-group { flex-direction: column; }
}
