/* ==========================================================================
   SIMSURAT DESA v2.0 - Notion Minimalist Design System
   ========================================================================== */

:root {
  --bg-main: #ffffff;
  --bg-sidebar: #fbfbfb;
  --bg-hover: #f1f1ef;
  --bg-card: #ffffff;
  --border-dark: #222222;
  --border-subtle: #e1e1e0;
  --text-main: #111111;
  --text-muted: #666666;
  --accent-color: #222222;
  --accent-blue: #2563eb;
  --accent-green: #16a34a;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* App Container Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
  width: 250px;
  background-color: var(--bg-sidebar);
  border-right: 1.5px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 20px 10px;
  border-bottom: 1.5px solid var(--border-subtle);
  margin-bottom: 20px;
}

.brand-logo {
  width: 32px;
  height: 32px;
  background-color: var(--text-main);
  color: #ffffff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.brand-text h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text-main);
}

.brand-text p {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  list-style: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  user-select: none;
}

.nav-item:hover {
  background-color: var(--bg-hover);
  color: var(--text-main);
}

.nav-item.active {
  background-color: var(--bg-hover);
  color: var(--text-main);
  font-weight: 600;
  border: 1.5px solid var(--border-dark);
}

.nav-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px;
  border-top: 1.5px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-muted);
}

/* Main Content Area */
.main-content {
  flex: 1;
  padding: 32px 40px;
  max-width: 1200px;
  overflow-y: auto;
}

.view-header {
  margin-bottom: 28px;
}

.view-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-main);
  margin-bottom: 4px;
}

.view-subtitle {
  font-size: 13.5px;
  color: var(--text-muted);
}

.view-section {
  display: none;
}

.view-section.active {
  display: block;
  animation: fadeIn 0.2s ease-in-out;
}

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

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

.stat-card {
  background-color: var(--bg-card);
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

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

.stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.stat-icon {
  font-size: 18px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

/* Notion Callout / Action Banner */
.callout-banner {
  background-color: var(--bg-sidebar);
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.callout-text h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.callout-text p {
  font-size: 13px;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1.5px solid var(--border-dark);
  font-family: inherit;
}

.btn-primary {
  background-color: var(--text-main);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: #333333;
  border-color: #333333;
}

.btn-secondary {
  background-color: var(--bg-card);
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: var(--bg-hover);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-danger {
  background-color: #ef4444;
  color: #ffffff;
  border-color: #dc2626;
}

/* Form Styles & Containers */
.form-container {
  background-color: var(--bg-card);
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-md);
  padding: 24px 28px;
  margin-bottom: 24px;
}

.form-section-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-group {
  margin-bottom: 18px;
  position: relative;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-label .required {
  color: #ef4444;
  margin-left: 2px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text-main);
  background-color: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.15s ease;
}

.form-control:focus {
  border-color: var(--border-dark);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2022222' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* Autocomplete Dropdown */
.autocomplete-wrapper {
  position: relative;
}

.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background-color: var(--bg-card);
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-md);
  max-height: 250px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: var(--shadow-md);
  display: none;
}

.autocomplete-dropdown.active {
  display: block;
}

.autocomplete-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background-color 0.1s ease;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover {
  background-color: var(--bg-hover);
}

.autocomplete-name {
  font-size: 13.5px;
  font-weight: 600;
}

.autocomplete-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Identity Summary Card */
.identity-card {
  background-color: var(--bg-sidebar);
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-top: 12px;
  display: none;
}

.identity-card.active {
  display: block;
}

.identity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.identity-field {
  font-size: 12px;
}

.identity-field .label {
  color: var(--text-muted);
  font-weight: 500;
}

.identity-field .val {
  color: var(--text-main);
  font-weight: 600;
  margin-top: 2px;
}

/* Dynamic Input Grid */
.dynamic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

/* Notion Data Table */
.table-wrapper {
  background-color: var(--bg-card);
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.table-toolbar {
  padding: 14px 18px;
  border-bottom: 1.5px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background-color: var(--bg-sidebar);
}

.search-input-wrapper {
  position: relative;
  width: 300px;
}

.search-input-wrapper input {
  padding-left: 32px;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.notion-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.notion-table th {
  background-color: var(--bg-sidebar);
  padding: 10px 16px;
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1.5px solid var(--border-subtle);
}

.notion-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
}

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

.notion-table tbody tr:hover {
  background-color: var(--bg-hover);
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-dark);
  background-color: var(--bg-sidebar);
}

.badge-code {
  font-family: monospace;
  background-color: #f3f4f6;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background-color: var(--bg-card);
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-lg);
  width: 95%;
  max-width: 1000px;
  height: 90vh;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

#modal-pejabat .modal-card {
  height: auto;
  max-width: 520px;
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1.5px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-sidebar);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
}

.modal-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 0;
  flex: 1;
  height: calc(90vh - 130px);
  background-color: #525659;
}

.modal-body iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.modal-footer {
  padding: 14px 24px;
  border-top: 1.5px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background-color: var(--bg-sidebar);
}

/* Empty State */
.empty-state {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
}

/* Responsive Utilities */
@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1.5px solid var(--border-subtle);
    padding: 12px 16px;
  }

  .nav-menu {
    flex-direction: row;
    overflow-x: auto;
  }

  .main-content {
    padding: 20px 16px;
  }

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

/* Placeholder Guide Grid & Cards */
.placeholder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.placeholder-card {
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  background-color: var(--bg-surface);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.placeholder-card:hover {
  border-color: var(--border-dark);
  background-color: var(--bg-hover);
  transform: translateY(-1px);
}

.placeholder-chip {
  display: inline-block;
  font-family: monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  background-color: #f1f1ef;
  border: 1px solid var(--border-dark);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.placeholder-desc {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 4px;
}

.placeholder-sample {
  font-size: 11.5px;
  color: var(--text-muted);
  font-style: italic;
}

