/* =========================================================================
   SISTEM DIGITAL KORPS MUBALLIGH AR-RAHMAH
   Tema Visual: Islamic Royal Blue (#0F4C81) & Gold Amber (#D4AF37)
   Motto: Menyampaikan | Mengingatkan | Menginspirasi
   ========================================================================= */

:root {
  --primary-900: #082845;
  --primary-800: #0b3b60;
  --primary-700: #0F4C81;
  --primary-600: #1a62a3;
  --primary-500: #257bc7;
  --primary-100: #e2effa;
  --primary-50:  #f0f7fd;

  --gold-700: #997300;
  --gold-600: #bfa004;
  --gold-500: #D4AF37;
  --gold-400: #e8c652;
  --gold-100: #fef7db;
  --gold-50:  #fffdf5;

  --emerald-600: #059669;
  --emerald-100: #d1fae5;
  --emerald-50:  #ecfdf5;

  --rose-600: #e11d48;
  --rose-100: #ffe4e6;

  --amber-600: #d97706;
  --amber-100: #fef3c7;

  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50:  #f8fafc;
  --white:     #ffffff;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-serif: 'Amiri', 'Georgia', serif;

  --sidebar-width: 270px;
  --header-height: 70px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 76, 129, 0.12), 0 4px 6px -4px rgba(0,0,0,0.05);
  --shadow-gold: 0 4px 14px rgba(212, 175, 55, 0.25);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--slate-50);
  color: var(--slate-800);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--primary-900) 0%, var(--primary-800) 100%);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  box-shadow: 4px 0 20px rgba(0,0,0,0.15);
  transition: transform 0.3s ease;
}

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

.brand-emblem {
  width: 44px;
  height: 44px;
  background: radial-gradient(circle, var(--gold-400) 0%, var(--gold-600) 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 22px;
  color: var(--primary-900);
  box-shadow: var(--shadow-gold);
  border: 1px solid rgba(255,255,255,0.4);
}

.brand-title h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--gold-400);
}

.brand-title p {
  font-size: 11px;
  color: var(--slate-400);
  letter-spacing: 0.3px;
}

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

.nav-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.4);
  padding: 12px 14px 6px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: #cbd5e1;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.25) 0%, rgba(212, 175, 55, 0.05) 100%);
  color: var(--gold-400);
  font-weight: 600;
  border-left: 3px solid var(--gold-500);
}

.nav-item .icon {
  font-size: 18px;
  width: 22px;
  text-align: center;
}

.nav-item .badge {
  margin-left: auto;
  background: var(--rose-600);
  color: var(--white);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 700;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.15);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gold-500);
  color: var(--primary-900);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.user-info {
  flex: 1;
  overflow: hidden;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--white);
}

.user-role-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: var(--gold-400);
  text-transform: capitalize;
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top Header */
.top-header {
  height: var(--header-height);
  background: var(--white);
  border-bottom: 1px solid var(--slate-200);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-mobile-menu {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--slate-700);
}

.header-time-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-50);
  border: 1px solid var(--primary-100);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-700);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.demo-role-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--gold-50);
  border: 1px solid var(--gold-400);
  padding: 4px 10px;
  border-radius: var(--radius-md);
  font-size: 12px;
}

.demo-role-selector select {
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-900);
  outline: none;
  cursor: pointer;
}

/* Page Content */
.content-body {
  flex: 1;
  padding: 32px;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

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

.page-title-wrap h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-900);
}

.page-title-wrap p {
  font-size: 14px;
  color: var(--slate-500);
  margin-top: 2px;
}

/* Banner Identitas Poster */
.identity-hero {
  background: linear-gradient(135deg, var(--primary-900) 0%, var(--primary-700) 100%);
  color: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px 32px;
  margin-bottom: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(212, 175, 55, 0.3);
  position: relative;
  overflow: hidden;
}

.identity-hero::after {
  content: "الرحمة";
  font-family: var(--font-serif);
  font-size: 140px;
  position: absolute;
  right: 20px;
  top: -30px;
  color: rgba(255, 255, 255, 0.05);
  pointer-events: none;
  line-height: 1;
}

.hero-quote {
  font-style: italic;
  color: var(--gold-400);
  font-size: 14px;
  margin-top: 6px;
}

.hero-motto {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--slate-300);
  text-transform: uppercase;
  margin-top: 8px;
  font-weight: 600;
}

/* Metric Cards Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.metric-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--slate-200);
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--gold-400);
}

.metric-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.metric-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.metric-icon.blue { background: var(--primary-100); color: var(--primary-700); }
.metric-icon.gold { background: var(--gold-100); color: var(--gold-700); }
.metric-icon.green { background: var(--emerald-100); color: var(--emerald-600); }
.metric-icon.rose { background: var(--rose-100); color: var(--rose-600); }

.metric-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--slate-900);
  line-height: 1;
  margin-bottom: 4px;
}

.metric-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-700);
}

.metric-desc {
  font-size: 11px;
  color: var(--slate-500);
  margin-top: 6px;
}

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

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

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-900);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 24px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
}

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

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

.btn-gold {
  background: var(--gold-500);
  color: var(--primary-900);
  box-shadow: var(--shadow-sm);
}

.btn-gold:hover {
  background: var(--gold-600);
  color: var(--white);
}

.btn-secondary {
  background: var(--slate-100);
  color: var(--slate-700);
  border: 1px solid var(--slate-200);
}

.btn-secondary:hover {
  background: var(--slate-200);
}

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

.btn-danger:hover {
  background: #be123c;
}

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

/* Status Badges */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-status.aktif, .badge-status.terlaksana, .badge-status.terverifikasi {
  background: var(--emerald-100);
  color: var(--emerald-600);
}

.badge-status.final, .badge-status.dikonfirmasi {
  background: var(--primary-100);
  color: var(--primary-700);
}

.badge-status.ditawarkan, .badge-status.prospek, .badge-status.menunggu {
  background: var(--gold-100);
  color: var(--gold-700);
}

.badge-status.draf, .badge-status.jeda {
  background: var(--slate-100);
  color: var(--slate-600);
}

.badge-status.ditolak, .badge-status.dibatalkan, .badge-status.nonaktif {
  background: var(--rose-100);
  color: var(--rose-600);
}

.badge-status.diganti, .badge-status.arsip {
  background: #ede9fe;
  color: #6d28d9;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.data-table th {
  background: var(--slate-50);
  color: var(--slate-600);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--slate-200);
  white-space: nowrap;
}

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

.data-table tbody tr:hover {
  background-color: var(--primary-50);
}

/* Filter Controls */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.search-input {
  flex: 1;
  min-width: 240px;
  position: relative;
}

.search-input input, .form-control {
  width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-md);
  font-size: 13px;
  outline: none;
  background: var(--white);
  transition: var(--transition);
}

.search-input input:focus, .form-control:focus {
  border-color: var(--primary-600);
  box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.15);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--slate-200);
}

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

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary-900);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--slate-400);
  cursor: pointer;
}

.modal-body {
  padding: 24px;
}

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

/* Form Groups */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 6px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.toast {
  background: var(--slate-900);
  color: var(--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: slideUp 0.3s ease;
}

.toast.success { border-left: 4px solid var(--emerald-600); }
.toast.error { border-left: 4px solid var(--rose-600); }
.toast.warning { border-left: 4px solid var(--gold-500); }

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

/* Conflict Alert Box */
.conflict-alert {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #9f1239;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--white);
  border-top: 1px solid var(--slate-200);
  z-index: 50;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.mobile-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--slate-500);
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
}

.mobile-nav-btn.active {
  color: var(--primary-700);
  font-weight: 700;
}

/* Responsiveness */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .main-wrapper {
    margin-left: 0;
    padding-bottom: 70px;
  }

  .btn-mobile-menu {
    display: block;
  }

  .content-body {
    padding: 16px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .mobile-bottom-nav {
    display: flex;
  }
}
