/* 
 * Kas Organisasi Nihongo no Bunkatsu (N2B)
 * Japanese Minimalist Modernism (Shibui & Ma) Design System
 */

:root {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, "Courier New", monospace;

  /* Colors */
  --bg: #f8f9ff;
  --surface: #f8f9ff;
  --surface-low: #eff4ff;
  --surface-container: #e5eeff;
  --surface-high: #dce9ff;
  --surface-card: #ffffff;
  --border: #e2e8f0;
  --border-light: #f1f5f9;

  --text-main: #0b1c30;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  --primary: #0f172a;
  --primary-hover: #1e293b;
  --primary-container: #131b2e;
  --primary-light: #dae2fd;

  --secondary: #e11d48; /* Torii Crimson */
  --secondary-bg: #fff1f2;
  --secondary-border: #fecdd3;

  --tertiary: #059669; /* Tokiwa Emerald */
  --tertiary-bg: #ecfdf5;
  --tertiary-border: #a7f3d0;

  --warning: #d97706; /* Amber */
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;

  --wa-green: #25d366;
  --wa-dark: #075e54;
  --wa-bg: #e5ddd5;
  --wa-bubble-in: #ffffff;
  --wa-bubble-out: #dcf8c6;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Typography Helpers */
.font-mono, .num-mono {
  font-family: var(--font-mono);
  font-feature-settings: "tnum" 1;
}

/* Sidebar Navigation */
.app-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 270px;
  background-color: #ffffff;
  border-right: 1px solid var(--border);
  z-index: 50;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-header {
  height: 80px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-light);
}

.logo-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #0f172a, #e11d48);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.5px;
  box-shadow: 0 2px 8px rgba(225, 29, 72, 0.3);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  margin-bottom: 4px;
  cursor: pointer;
  border: 1px solid transparent;
}

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

.nav-item.active {
  background-color: var(--primary-container);
  color: #ffffff;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.nav-item.active .nav-icon {
  color: #ffffff;
}

.nav-item .nav-desc {
  font-size: 11px;
  opacity: 0.75;
  display: block;
}

/* Header */
.app-header {
  position: fixed;
  top: 0;
  left: 270px;
  right: 0;
  height: 80px;
  background-color: rgba(248, 249, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  gap: 20px;
}

.main-content {
  margin-left: 270px;
  padding-top: 80px;
  padding: 104px 32px 48px 32px;
  min-height: 100vh;
}

/* Card Containers */
.card {
  background-color: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

/* Status Chips */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.badge-lunas {
  background-color: var(--tertiary-bg);
  color: var(--tertiary);
  border: 1px solid var(--tertiary-border);
}
.badge-lunas .badge-dot { background-color: var(--tertiary); }

.badge-kurang {
  background-color: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}
.badge-kurang .badge-dot { background-color: var(--warning); }

.badge-belum {
  background-color: var(--secondary-bg);
  color: var(--secondary);
  border: 1px solid var(--secondary-border);
}
.badge-belum .badge-dot { background-color: var(--secondary); }

.badge-neutral {
  background-color: var(--surface-low);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  text-decoration: none;
  line-height: 1.4;
}

.btn:active {
  transform: scale(0.98);
}

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

.btn-secondary {
  background-color: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background-color: var(--surface-low);
}

.btn-danger {
  background-color: var(--secondary);
  color: #ffffff;
}
.btn-danger:hover {
  background-color: #be123c;
}

.btn-wa {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.btn-wa:hover {
  background-color: #25d366;
  color: #ffffff;
  border-color: #25d366;
}

.btn-wa-solid {
  background-color: #25d366;
  color: #ffffff;
  font-weight: 700;
}
.btn-wa-solid:hover {
  background-color: #20ba59;
}

/* Tables */
.table-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: #ffffff;
}

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

.data-table th {
  background-color: var(--surface);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background-color: #f8fafc;
}

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

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-box {
  background-color: #ffffff;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-box {
  transform: scale(1) translateY(0);
}

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

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background-color: var(--surface);
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background-color: var(--surface-low);
  color: var(--text-main);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}

.form-control:focus {
  border-color: var(--primary);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.1);
}

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

.input-prefix {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  padding: 0 14px;
  background-color: var(--surface-container);
  border-top-left-radius: var(--radius-md);
  border-bottom-left-radius: var(--radius-md);
  display: flex;
  align-items: center;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
}

.input-with-prefix {
  padding-left: 58px !important;
}

/* WhatsApp Live Preview Simulator */
.wa-preview-screen {
  background-color: #efeae2;
  background-image: radial-gradient(#d1c7b7 1px, transparent 1px);
  background-size: 16px 16px;
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wa-bubble {
  max-width: 90%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  position: relative;
  white-space: pre-wrap;
  word-break: break-word;
}

.wa-bubble-out {
  align-self: flex-end;
  background-color: var(--wa-bubble-out);
  border-top-right-radius: 2px;
}

.wa-bubble-time {
  font-size: 10px;
  color: rgba(0,0,0,0.45);
  text-align: right;
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

/* Lock Screen / Privacy Gate */
.privacy-gate {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top right, #1e293b, #0f172a);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: white;
}

.privacy-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 40px 32px;
  border-radius: 24px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.pin-display-dots {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 24px 0;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  transition: all 0.2s ease;
}

.pin-dot.filled {
  background-color: #e11d48;
  border-color: #e11d48;
  box-shadow: 0 0 12px rgba(225, 29, 72, 0.8);
  transform: scale(1.15);
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 20px;
}

.keypad-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: white;
  border-radius: 14px;
  font-size: 20px;
  font-weight: 600;
  font-family: var(--font-mono);
  padding: 16px 0;
  cursor: pointer;
  transition: all 0.15s ease;
}

.keypad-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.keypad-btn:active {
  transform: scale(0.95);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #0f172a;
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInUp 0.3s ease;
}

.toast.success { border-left: 4px solid var(--tertiary); }
.toast.error { border-left: 4px solid var(--secondary); }
.toast.warning { border-left: 4px solid var(--warning); }

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

/* Responsive */
@media (max-width: 1024px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.open {
    transform: translateX(0);
  }
  .app-header {
    left: 0;
  }
  .main-content {
    margin-left: 0;
    padding: 96px 16px 40px 16px;
  }
}
