/* ==========================================================
   HIMPAUDI KECAMATAN CIBARUSAH - MODERN DESIGN SYSTEM
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', sans-serif;

  /* Primary Palette (HIMPAUDI Teal & Royal Blue) */
  --primary: #0284c7;
  --primary-dark: #0369a1;
  --primary-light: #e0f2fe;
  --primary-subtle: #f0f9ff;
  
  --secondary: #0d9488;
  --secondary-dark: #0f766e;
  --secondary-light: #ccfbf1;

  --accent-warm: #f59e0b;
  --accent-warm-light: #fef3c7;
  
  --success: #10b981;
  --success-light: #d1fae5;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --info: #06b6d4;
  --info-light: #cffafe;

  /* Neutral tones */
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #0f172a;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;

  /* Elevations */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.05);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.05);
  --shadow-glow: 0 0 20px rgba(2, 132, 199, 0.15);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Reset & Viewport Fit */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

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

img, video, iframe {
  max-width: 100%;
  height: auto;
}

h1, h2, h3, h4, h5, h6, .brand-font {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0f172a;
  word-break: break-word;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}
a:hover {
  color: var(--primary-dark);
}

/* ==========================================================
   LAYOUT STRUCTURE: Sidebar & Main Wrapper
   ========================================================== */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

/* Sidebar */
.app-sidebar {
  width: 280px;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: var(--transition);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
  overflow-y: auto;
}

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

.sidebar-logo-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #0284c7 0%, #0d9488 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.4);
}

.sidebar-brand-title {
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: 11px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

/* Navigation Links */
.sidebar-nav {
  padding: 20px 14px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #64748b;
  font-weight: 700;
  padding: 16px 12px 6px;
}

.nav-link-custom {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  color: #94a3b8;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.nav-link-custom i {
  font-size: 17px;
  width: 22px;
  text-align: center;
  color: #64748b;
  transition: var(--transition);
}

.nav-link-custom:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

.nav-link-custom:hover i {
  color: #38bdf8;
}

.nav-link-custom.active {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.25) 0%, rgba(13, 148, 136, 0.25) 100%);
  color: #ffffff;
  font-weight: 600;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.nav-link-custom.active i {
  color: #38bdf8;
}

.sidebar-user {
  padding: 16px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar-badge {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
}

/* Main Content Area */
.app-main {
  margin-left: 280px;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-body);
  transition: var(--transition);
  max-width: 100%;
  overflow-x: hidden;
}

/* Top Navbar */
.app-topbar {
  height: 70px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  width: 100%;
  max-width: 100%;
}

.topbar-title {
  display: flex;
  flex-direction: column;
}

.topbar-heading {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}

.topbar-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.app-container {
  padding: 32px;
  flex: 1;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* ==========================================================
   CARDS & STAT WIDGETS
   ========================================================== */
.card-custom {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  transition: var(--transition);
  margin-bottom: 24px;
}

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

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

.card-title-main {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Stat Cards */
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 22px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 18px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

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

.stat-icon-wrapper {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.stat-icon-blue {
  background: #e0f2fe;
  color: #0284c7;
}

.stat-icon-teal {
  background: #ccfbf1;
  color: #0d9488;
}

.stat-icon-amber {
  background: #fef3c7;
  color: #d97706;
}

.stat-icon-emerald {
  background: #d1fae5;
  color: #059669;
}

.stat-icon-purple {
  background: #ede9fe;
  color: #7c3aed;
}

.stat-number {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
  color: #0f172a;
  font-family: var(--font-heading);
}

.stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Badges */
.badge-custom {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-full);
}

.badge-success { background: var(--success-light); color: #065f46; }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-danger { background: var(--danger-light); color: #991b1b; }
.badge-info { background: var(--info-light); color: #155e75; }
.badge-primary { background: var(--primary-light); color: #075985; }
.badge-secondary { background: #f1f5f9; color: #475569; }

/* Buttons */
.btn-custom {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  font-family: var(--font-main);
}

.btn-primary-custom {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.25);
}
.btn-primary-custom:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-success-custom {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.25);
}
.btn-success-custom:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #ffffff;
}

.btn-outline-custom {
  background: #ffffff;
  border-color: var(--border-color);
  color: var(--text-main);
}
.btn-outline-custom:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}

.btn-sm-custom {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

/* Form Styles */
.form-group {
  margin-bottom: 18px;
}

.form-label-custom {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.form-control-custom, .form-select-custom {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: #ffffff;
  color: #1e293b;
  transition: var(--transition);
}

.form-control-custom:focus, .form-select-custom:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

/* Tables */
.table-responsive-custom {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.table-custom {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  font-size: 14px;
}

.table-custom th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}

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

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

/* Alert Boxes */
.alert-custom {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.alert-success { background: #dcfce7; color: #14532d; border: 1px solid #bbf7d0; }
.alert-danger { background: #fee2e2; color: #7f1d1d; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #78350f; border: 1px solid #fde68a; }
.alert-info { background: #e0f2fe; color: #0c4a6e; border: 1px solid #bae6fd; }

/* Scanner QR Styling */
.scanner-card-view {
  background: #0f172a;
  color: #fff;
  border-radius: var(--radius-xl);
  padding: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

.scanner-video-box {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #1e293b;
  border: 2px dashed rgba(56, 189, 248, 0.4);
  position: relative;
}

.scanner-laser-line {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #38bdf8, #34d399, transparent);
  box-shadow: 0 0 15px #38bdf8;
  animation: scanLaser 2s infinite ease-in-out;
  pointer-events: none;
}

@keyframes scanLaser {
  0% { top: 5%; opacity: 0.3; }
  50% { top: 90%; opacity: 1; }
  100% { top: 5%; opacity: 0.3; }
}

/* Landing Page Hero */
.hero-gradient {
  background: linear-gradient(135deg, #0369a1 0%, #0d9488 50%, #0f172a 100%);
  color: #ffffff;
  padding: 80px 20px 60px;
  position: relative;
  overflow: hidden;
}

.hero-gradient::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.2) 0%, transparent 70%);
  border-radius: 50%;
}

/* Responsive Rules */
@media (max-width: 991px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.show {
    transform: translateX(0);
  }
  .app-main {
    margin-left: 0;
  }
  .app-container {
    padding: 20px 16px;
  }
  .app-topbar {
    padding: 0 16px;
  }
}

/* Password Input with Embedded Eye Toggle */
.password-wrapper {
  position: relative;
  width: 100%;
  display: block;
}
.password-wrapper input[type="password"],
.password-wrapper input[type="text"] {
  width: 100%;
  padding-right: 44px !important;
}
.password-toggle-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  transition: var(--transition);
  z-index: 5;
}
.password-toggle-btn:hover {
  color: var(--primary);
}

