/* Syariah Contract Dynamic Generator - Theme & Styles */
:root {
  --primary: #047857;
  --primary-dark: #064e3b;
  --primary-light: #10b981;
  --primary-subtle: #d1fae5;
  --accent-gold: #d97706;
  --accent-gold-light: #fef3c7;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius-lg: 12px;
  --radius-md: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

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

.sidebar {
  width: 280px;
  background-color: #0f172a; /* Warna Gelap Dark Slate modern */
  color: #ffffff;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  flex-shrink: 0;
  border-right: 1px solid #1e293b;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease;
  position: relative;
}

/* Collapsed Sidebar State */
.sidebar.collapsed {
  width: 78px;
  padding: 1.5rem 0.5rem;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 1.25rem;
  position: relative;
  transition: all 0.3s ease;
  min-height: 52px;
}

.sidebar-logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  overflow: hidden;
}

.sidebar.collapsed .sidebar-header {
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  justify-content: center;
}

.sidebar-collapse-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary-light);
}

.sidebar.collapsed .sidebar-collapse-btn {
  display: flex;
  width: 36px;
  height: 36px;
}

.sidebar.collapsed .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}

.sidebar-logo-full {
  width: 100%;
  max-width: 155px;
  height: auto;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.35));
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.sidebar-logo-mini {
  display: none;
}

.sidebar.collapsed .sidebar-logo-container {
  display: none;
}

.sidebar.collapsed .sidebar-logo-full {
  display: none;
}

.sidebar.collapsed .sidebar-logo-mini {
  display: none;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-item button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}

.nav-item button .nav-icon {
  font-size: 1.15rem;
  min-width: 24px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-item button .nav-icon img,
.nav-item button .nav-icon svg {
  width: 20px;
  height: 20px;
  object-fit: contain;
  filter: brightness(0) invert(0.85);
  transition: all 0.2s ease;
}

.nav-item button:hover .nav-icon img,
.nav-item button:hover .nav-icon svg,
.nav-item button.active .nav-icon img,
.nav-item button.active .nav-icon svg {
  filter: brightness(0) invert(1);
}

.dropdown-item-btn .dropdown-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  filter: brightness(0) invert(0.85);
  display: inline-block;
  vertical-align: middle;
}

.dropdown-item-btn:hover .dropdown-icon {
  filter: brightness(0) invert(1);
}

.feature-icon img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.sidebar.collapsed .nav-item button {
  padding: 0.75rem 0;
  justify-content: center;
  gap: 0;
}

.sidebar.collapsed .nav-item button .nav-text {
  display: none;
}

.nav-item button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

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

/* Dropdown Item Hover & Profile Footer Styling */
.dropdown-item-btn:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
}

#sidebar-user-menu-btn:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
}

.sidebar.collapsed #sidebar-user-menu-btn {
  padding: 0.5rem 0 !important;
  justify-content: center !important;
}

.sidebar.collapsed .sidebar-footer .nav-text {
  display: none !important;
}

#sidebar-user-dropdown.show {
  display: flex !important;
}

.sidebar.collapsed #sidebar-user-dropdown {
  left: 100% !important;
  bottom: 0 !important;
  margin-left: 10px !important;
  margin-bottom: 0 !important;
}

/* Tooltip on Collapsed Hover */
.sidebar.collapsed .nav-item button::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 12px;
  background: #1e293b;
  color: #ffffff;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, margin-left 0.2s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.1);
  z-index: 999;
}

.sidebar.collapsed .nav-item button:hover::after {
  opacity: 1;
  margin-left: 8px;
}

/* Toggle Fold Button in Topbar */
.btn-sidebar-toggle {
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s ease;
  margin-right: 0.75rem;
  flex-shrink: 0;
}

.btn-sidebar-toggle:hover {
  background: var(--primary-subtle);
  color: var(--primary-dark);
  border-color: var(--primary-light);
}

.role-badge {
  background: rgba(217, 119, 6, 0.2);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold-light);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.role-badge label {
  font-size: 0.7rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.role-select {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

/* Main Content Area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  height: 100vh;
}

.top-bar {
  background: var(--bg-card);
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.top-bar h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-main);
  padding: 0.4rem 0.75rem;
  border-radius: 20px;
  border: 1px solid var(--border-color);
}

.dot-online {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
}

.content-body {
  padding: 2rem;
  flex: 1;
}

/* UI Cards & Elements */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.grid-cols-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.grid-cols-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.icon-green { background: var(--primary-subtle); color: var(--primary-dark); }
.icon-gold { background: var(--accent-gold-light); color: var(--accent-gold); }
.icon-blue { background: #dbeafe; color: #1d4ed8; }

.stat-val {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
}

.stat-lbl {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Forms & Rules Engine */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-subtle);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

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

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

.btn-gold {
  background: var(--accent-gold);
  color: #ffffff;
}

.btn-gold:hover {
  background: #b45309;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background: #f1f5f9;
}

/* Syariah Validation Panel */
.syariah-checker-panel {
  background: #f0fdf4;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-top: 1.5rem;
}

.checker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #a7f3d0;
}

.score-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.9rem;
}

.score-high { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.score-medium { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.score-low { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.5rem 0;
  font-size: 0.875rem;
}

.check-icon {
  font-weight: bold;
  margin-top: 2px;
}

.check-pass { color: var(--success); }
.check-fail { color: var(--danger); }
.check-warn { color: var(--warning); }

/* Document Preview / Akad Paper */
.document-paper {
  background: #ffffff;
  padding: 3rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-md);
  color: #1e293b;
  max-width: 800px;
  margin: 0 auto;
  font-family: 'Times New Roman', Times, serif;
  line-height: 1.7;
}

/* Hanging Indent / Numbering List Format Bertingkat ala MS Word Notaris */
.doc-numbered-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 0.65rem;
  text-align: justify;
  text-justify: inter-word;
  line-height: 1.6;
}

/* Level 1: Angka Utama (1. atau (1)) -> Rata Kiri Standar */
.doc-level-1 {
  margin-left: 0rem;
}
.doc-level-1 > .doc-numbered-num {
  width: 2.2rem;
  min-width: 2.2rem;
}

/* Level 2: Sub-Butir Huruf Kecil / Angka Kurung (a. , b. , (a)) -> Menjorok ke Dalam 1.5rem */
.doc-level-2 {
  margin-left: 1.8rem;
}
.doc-level-2 > .doc-numbered-num {
  width: 1.8rem;
  min-width: 1.8rem;
}

/* Level 3: Sub-Sub Butir (i. , (i) , - ) -> Menjorok ke Dalam 3.5rem */
.doc-level-3 {
  margin-left: 3.5rem;
}
.doc-level-3 > .doc-numbered-num {
  width: 1.6rem;
  min-width: 1.6rem;
}

.doc-numbered-num {
  flex-shrink: 0;
  text-align: left;
  font-weight: normal;
}

.doc-numbered-body {
  flex: 1;
  text-align: justify;
  text-justify: inter-word;
}

.doc-header {
  text-align: center;
  border-bottom: 2px solid #000;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.doc-header h2 {
  font-size: 1.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.doc-stamp {
  display: inline-block;
  border: 2px dashed var(--primary);
  color: var(--primary);
  padding: 0.5rem 1rem;
  font-family: sans-serif;
  font-weight: bold;
  font-size: 0.8rem;
  border-radius: 4px;
  margin-top: 1rem;
  transform: rotate(-3deg);
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.data-table th, .data-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
}

.data-table th {
  background-color: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
}

/* ==========================================
   LANDING PAGE & AUTHENTICATION STYLING
   ========================================== */

#landing-page-container {
  width: 100%;
  min-height: 100vh;
  background: #ffffff;
  color: var(--text-main);
  position: relative;
  z-index: 100;
  overflow-x: hidden;
  font-family: var(--font-family);
}

.landing-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 3rem;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.landing-hero {
  padding: 5rem 2rem 4rem 2rem;
  text-align: center;
  background: radial-gradient(circle at 50% 20%, rgba(4, 120, 87, 0.08) 0%, rgba(255, 255, 255, 1) 70%);
  position: relative;
}

.landing-hero h1 {
  font-size: 3.25rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.15;
  letter-spacing: -0.02em;
  max-width: 850px;
  margin: 0 auto 1.25rem auto;
}

.landing-hero h1 span {
  background: linear-gradient(135deg, var(--primary), var(--accent-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.landing-hero p {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto 2rem auto;
  line-height: 1.6;
}

.landing-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  max-width: 1200px;
  margin: 3rem auto;
  padding: 0 1.5rem;
}

.feature-box {
  background: #ffffff;
  border: 1px solid var(--border-color);
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.feature-box:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.feature-icon {
  font-size: 2.2rem;
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--primary-subtle);
  margin-bottom: 1.25rem;
}

.auth-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-card {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-color);
}

@media (max-width: 768px) {
  .landing-nav { padding: 1rem 1.5rem; }
  .landing-hero h1 { font-size: 2.25rem; }
  .landing-hero { padding: 3rem 1rem 2rem 1rem; }
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-info { background: #dbeafe; color: #1e40af; }

/* Print styles */
@media print {
  .sidebar, .top-bar, .no-print {
    display: none !important;
  }
  .main-content {
    height: auto;
    overflow: visible;
  }
  .document-paper {
    box-shadow: none;
    border: none;
    width: 100%;
    max-width: 100%;
    padding: 0;
  }
}
