/* ==========================================================================
   DIREKTORI AKTA NIKAH - HIGH DENSITY STYLESHEET (style.css)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;500&family=Roboto:wght@300;400;500;700&display=swap');

:root {
  --primary-color: #1a73e8;
  --primary-hover: #1557b0;
  --primary-dark: #174ea6;
  --primary-light: #e8f0fe;
  --text-primary: #202124;
  --text-secondary: #5f6368;
  --text-disabled: #70757a;
  --bg-page: #f1f3f4;
  --bg-card: #ffffff;
  --bg-zebra: #fafafa;
  --bg-hover: #f1f7fe;
  --border-color: #dadce0;
  --border-light: #e8eaed;
  --shadow-subtle: 0 1px 2px 0 rgba(60,64,67,0.15);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --transition-fast: 0.15s ease-in-out;
}

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

body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.4;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.app-container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* HIGH DENSITY HEADER */
.app-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 24px;
  min-height: 52px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.header-title h1 {
  font-size: 17px;
  font-weight: 500;
  color: #3c4043;
  letter-spacing: -0.2px;
}

/* HEADER INTEGRATED STATS */
.stats-container {
  display: flex;
  align-items: center;
  gap: 20px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.stat-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-disabled);
}

.stat-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1.2;
}

.stat-value.text-status {
  font-size: 11px;
  font-weight: 500;
  color: #137333;
  background: #e6f4ea;
  padding: 2px 8px;
  border-radius: 10px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Mode Switcher pill */
.mode-toggle {
  display: inline-flex;
  background: #f1f3f4;
  padding: 2px;
  border-radius: 16px;
  border: 1px solid var(--border-color);
}

.mode-btn {
  border: none;
  background: transparent;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mode-btn.active {
  background: var(--bg-card);
  color: var(--primary-dark);
  box-shadow: 0 1px 2px rgba(0,0,0,0.12);
}

.btn-docs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--primary-dark);
  border: 1px solid rgba(26,115,232,0.3);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-docs:hover {
  background: #d2e3fc;
}

/* ENDPOINT BAR */
.endpoint-bar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.endpoint-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.endpoint-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-grow: 1;
  max-width: 500px;
}

.endpoint-input {
  width: 100%;
  height: 28px;
  padding: 4px 8px;
  font-family: monospace;
  font-size: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #f1f3f4;
  outline: none;
}

.endpoint-input:focus {
  border-color: var(--primary-color);
  background: #fff;
}

/* HIGH DENSITY FILTER CARD */
.filter-card {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 24px;
}

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

.filter-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-reset {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f8f9fa;
  color: #3c4043;
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-reset:hover {
  background: #f1f3f4;
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 12px;
}

@media (min-width: 640px) {
  .filter-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .filter-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 10px;
  color: var(--text-disabled);
  pointer-events: none;
}

.form-control {
  width: 100%;
  height: 32px;
  padding: 4px 10px 4px 32px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-primary);
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control.no-icon {
  padding-left: 10px;
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(26,115,232,0.15);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235f6368' 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 8px center;
  padding-right: 28px;
  cursor: pointer;
}

/* TABLE CONTAINER & CARD */
.table-card {
  margin: 16px 24px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-subtle);
  overflow: hidden;
  position: relative;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  max-height: calc(100vh - 280px);
  min-height: 350px;
  overflow-y: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  table-layout: fixed;
}

.data-table thead {
  position: sticky;
  top: 0;
  background: #ffffff;
  z-index: 10;
}

.data-table th {
  background: #ffffff;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 12px;
  padding: 10px 16px;
  border-bottom: 2px solid var(--border-light);
  user-select: none;
}

.data-table th.sortable {
  cursor: pointer;
  transition: background var(--transition-fast);
}

.data-table th.sortable:hover {
  background: #f8f9fa;
}

.th-content {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sort-icon {
  color: var(--text-disabled);
  font-size: 11px;
  transition: color var(--transition-fast);
}

.data-table th.active-sort .sort-icon {
  color: var(--primary-color);
}

.data-table td {
  padding: 9px 16px;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid #f1f3f4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Zebra Striping */
.data-table tbody tr:nth-child(even) {
  background-color: var(--bg-zebra);
}

/* Hover Row Effect */
.data-table tbody tr:hover {
  background-color: var(--bg-hover) !important;
}

/* Specific Column Styling */
.col-no {
  width: 50px;
  text-align: center;
  color: var(--text-disabled);
  font-weight: 500;
}

.col-akta {
  font-family: 'Roboto Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--primary-dark);
}

.col-kelurahan {
  display: inline-block;
  background: #e8f0fe;
  color: #1967d2;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 20;
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

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

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--primary-light);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
  padding: 48px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.empty-icon {
  width: 56px;
  height: 56px;
  background: #f1f3f4;
  color: var(--text-disabled);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state h3 {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

.empty-state p {
  font-size: 12px;
  color: var(--text-secondary);
  max-width: 360px;
}

/* PAGINATION FOOTER */
.pagination-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
}

.pagination-info {
  font-size: 12px;
  color: var(--text-secondary);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  height: 30px;
  min-width: 30px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #3c4043;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.page-btn:hover:not(:disabled) {
  background: #f8f9fa;
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.page-btn.active {
  background: var(--primary-color);
  color: #ffffff;
  border-color: var(--primary-color);
}

.page-btn:disabled {
  color: var(--text-disabled);
  border-color: #e8eaed;
  cursor: not-allowed;
  opacity: 0.5;
}

/* FOOTER SYNC INFORMATION */
.app-footer {
  height: 40px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: auto;
}

.sync-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34a853;
  display: inline-block;
}

/* MODAL / DRAWER */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

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

.modal-content {
  background: var(--bg-card);
  width: 100%;
  max-width: 880px;
  max-height: 88vh;
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-page);
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 500;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 2px 6px;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tabs-nav {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  background: #f1f3f4;
  border: 1px solid var(--border-color);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tab-btn.active {
  background: var(--primary-color);
  color: #ffffff;
  border-color: var(--primary-color);
}

.code-container {
  position: relative;
  background: #1e1e1e;
  color: #d4d4d4;
  border-radius: var(--radius-md);
  padding: 14px;
  font-family: 'Roboto Mono', monospace;
  font-size: 11px;
  overflow-x: auto;
  max-height: 420px;
}

.btn-copy-code {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255,255,255,0.15);
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-copy-code:hover {
  background: rgba(255,255,255,0.3);
}

.docs-section h3 {
  font-size: 15px;
  font-weight: 500;
  color: var(--primary-dark);
  margin-top: 10px;
  margin-bottom: 6px;
}

.docs-section p, .docs-section ol, .docs-section ul {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
}

.docs-section ol, .docs-section ul {
  padding-left: 20px;
}

.badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  background: #e8f0fe;
  color: #1a73e8;
}
