/* =============================================================================
   SIM-LPPM IPMAFA — Custom CSS v2.0
   Design: Modern Emerald Identity, Pesantren IPMAFA Branding
   ============================================================================= */

/* =============================================================================
   CSS VARIABLES (Dark Mode Ready)
   ============================================================================= */
:root {
  /* --- Brand Colors (Emerald Identity) --- */
  --brand-900: #064e3b;
  --brand-800: #065f46;
  --brand-700: #047857;
  --brand-600: #059669;
  --brand-500: #10b981;
  --brand-400: #34d399;
  --brand-300: #6ee7b7;
  --brand-200: #a7f3d0;
  --brand-100: #d1fae5;
  --brand-50:  #ecfdf5;

  /* --- Sidebar Colors (Light Emerald Theme) --- */
  --sidebar-bg-start: #ffffff;
  --sidebar-bg-end:   #ffffff;
  --sidebar-border: rgba(0,0,0,0.08);
  --sidebar-text: var(--gray-600);
  --sidebar-text-hover: var(--brand-700);
  --sidebar-active-bg: rgba(16,185,129,0.12);
  --sidebar-active-border: var(--brand-500);

  /* --- Neutral Palette --- */
  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* --- Semantic Colors --- */
  --emerald-500: #10b981;
  --emerald-400: #34d399;
  --emerald-600: #059669;
  --amber-400: #fbbf24;
  --amber-500: #f59e0b;
  --red-500: #ef4444;
  --sky-400: #38bdf8;
  --sky-500: #0ea5e9;
  --purple-500: #8b5cf6;
  --purple-400: #a78bfa;

  /* --- Stat Card Tints (Light Theme) --- */
  --stat-blue-bg:   #ffffff;
  --stat-blue-text: #1e40af;
  --stat-blue-icon: #3b82f6;
  --stat-green-bg:   #ffffff;
  --stat-green-text: #065f46;
  --stat-green-icon: #10b981;
  --stat-amber-bg:   #ffffff;
  --stat-amber-text: #92400e;
  --stat-amber-icon: #f59e0b;
  --stat-purple-bg:   #ffffff;
  --stat-purple-text: #5b21b6;
  --stat-purple-icon: #8b5cf6;

  /* --- Layout --- */
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --topbar-height: 60px;

  /* --- Design Tokens --- */
  --border-radius: 12px;
  --border-radius-lg: 16px;
  --border-radius-xl: 20px;
  --border-color: var(--gray-200);
  --border-hairline: 1px solid var(--gray-200);
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

  /* --- Legacy Compat --- */
  --navy-700: var(--brand-700);
  --navy-800: var(--brand-800);
  --navy-900: var(--brand-900);
  --navy-600: var(--brand-600);
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  background: var(--gray-50);
  color: var(--gray-800);
  margin: 0;
  line-height: 1.6;
}

/* =============================================================================
   APP LAYOUT
   ============================================================================= */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* =============================================================================
   SIDEBAR
   ============================================================================= */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg-start);
  position: fixed;
  left: 0; top: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: var(--transition);
  border-right: 1px solid var(--sidebar-border);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.brand-logo {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-400));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.brand-text { display: flex; flex-direction: column; }
.brand-name { font-size: 15px; font-weight: 700; color: var(--brand-800); line-height: 1.2; }
.brand-sub { font-size: 11px; color: var(--gray-500); }

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  background: var(--gray-50);
  margin: 8px;
  border-radius: 10px;
  flex-shrink: 0;
  border: 1px solid var(--gray-100);
}

.user-avatar { font-size: 28px; color: var(--gray-400); flex-shrink: 0; }
.user-info { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-size: 12px; font-weight: 600; color: var(--gray-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.role-admin { background: rgba(239,68,68,0.2) !important; color: #fca5a5 !important; border: 1px solid rgba(239,68,68,0.3) !important; }
.role-ketua { background: rgba(251,191,36,0.2) !important; color: #fde68a !important; border: 1px solid rgba(251,191,36,0.3) !important; }
.role-dosen { background: rgba(16,185,129,0.2) !important; color: #6ee7b7 !important; border: 1px solid rgba(16,185,129,0.3) !important; }
.role-reviewer { background: rgba(14,165,233,0.2) !important; color: #7dd3fc !important; border: 1px solid rgba(14,165,233,0.3) !important; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

/* --- Sidebar Nav Sections (Collapsible) --- */
.nav-section {
  padding: 4px 0;
  margin-bottom: 4px;
}
.nav-section + .nav-section {
  border-top: 1px solid var(--sidebar-border);
  padding-top: 8px;
  margin-top: 4px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gray-400);
  padding: 6px 20px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}
.nav-section-label:hover {
  color: var(--gray-600);
}
.nav-section-label .collapse-icon {
  font-size: 10px;
  transition: transform 0.2s;
}
.nav-section.collapsed .collapse-icon {
  transform: rotate(-90deg);
}
.nav-section.collapsed .nav-section-items {
  display: none;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  margin: 4px 12px;
  border-radius: 12px;
  border-left: none;
}

.sidebar-nav .nav-link i { font-size: 16px; flex-shrink: 0; width: 20px; }
.sidebar-nav .nav-link:hover {
  color: var(--sidebar-text-hover);
  background: var(--gray-50);
}
.sidebar-nav .nav-link.active {
  color: var(--sidebar-text-hover);
  background: var(--sidebar-active-bg);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(16,185,129,0.1);
}

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

/* =============================================================================
   MAIN CONTENT
   ============================================================================= */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: var(--transition);
}

/* =============================================================================
   TOPBAR
   ============================================================================= */
.topbar {
  height: var(--topbar-height);
  background: transparent;
  border-bottom: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-breadcrumb { flex: 1; }

/* -- Search bar in topbar -- */
.topbar-search {
  position: relative;
  width: 240px;
}
.topbar-search input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  background: #fff;
  color: var(--gray-700);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.topbar-search input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.1);
  background: #fff;
}
.topbar-search input::placeholder { color: var(--gray-400); }
.topbar-search .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 14px;
  pointer-events: none;
}

/* -- Profile Dropdown in Topbar -- */
.topbar-profile {
  position: relative;
}
.topbar-profile-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border: none;
  border-radius: 24px;
  background: #fff;
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px;
  color: var(--gray-700);
  box-shadow: var(--shadow-sm);
}
.topbar-profile-btn:hover {
  background: #fdfdfd;
  box-shadow: var(--shadow-md);
}
.topbar-profile-btn .avatar-sm {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-400));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.topbar-profile-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 200px;
  background: #fff;
  border: var(--border-hairline);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  padding: 6px;
  display: none;
  z-index: 200;
}
.topbar-profile-menu.show { display: block; }
.topbar-profile-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: var(--gray-700);
  text-decoration: none;
  font-size: 13px;
  border-radius: 6px;
  transition: var(--transition);
}
.topbar-profile-menu a:hover {
  background: var(--gray-50);
  color: var(--brand-700);
}
.topbar-profile-menu a.text-danger:hover { background: #fef2f2; }
.topbar-profile-menu .divider {
  height: 1px;
  background: var(--gray-200);
  margin: 4px 0;
}

.btn-icon {
  width: 36px; height: 36px;
  border: none; background: var(--gray-100);
  border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--gray-600);
  transition: var(--transition);
}
.btn-icon:hover { background: var(--gray-200); }

/* =============================================================================
   PAGE CONTENT
   ============================================================================= */
.page-content { flex: 1; padding: 24px; }

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

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-800);
  margin: 0;
}

.page-subtitle {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 2px;
}

/* =============================================================================
   CARDS — Hairline Border, No Heavy Shadow
   ============================================================================= */
.card {
  border: none;
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  background: #fff;
}

.card-header {
  border-bottom: var(--border-hairline);
  background: transparent;
  border-radius: 20px 20px 0 0 !important;
  padding: 16px 24px;
  font-weight: 700;
  color: var(--gray-800);
}

/* =============================================================================
   STAT CARDS — Colored Tint Backgrounds
   ============================================================================= */
.stat-card {
  border-radius: 20px;
  padding: 24px;
  border: none;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: #fff;
}
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.stat-card .stat-icon {
  font-size: 36px;
  opacity: 1;
  color: var(--brand-500);
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(16,185,129,0.1);
  width: 56px; height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.stat-card .stat-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1;
  margin-bottom: 6px;
}
.stat-card .stat-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-600);
}

/* Colored tint variants (now just affects the icon color) */
.stat-card.blue { border-color: transparent; }
.stat-card.blue .stat-icon { color: var(--stat-blue-icon); background: rgba(59,130,246,0.1); }

.stat-card.green, .stat-card.emerald { border-color: transparent; }
.stat-card.green .stat-icon, .stat-card.emerald .stat-icon { color: var(--stat-green-icon); background: rgba(16,185,129,0.1); }

.stat-card.amber { border-color: transparent; }
.stat-card.amber .stat-icon { color: var(--stat-amber-icon); background: rgba(245,158,11,0.1); }

.stat-card.purple { border-color: transparent; }
.stat-card.purple .stat-icon { color: var(--stat-purple-icon); background: rgba(139,92,246,0.1); }

/* Legacy sky variant */
.stat-card.sky { border-color: transparent; }
.stat-card.sky .stat-icon { color: var(--stat-blue-icon); background: rgba(59,130,246,0.1); }

/* =============================================================================
   EMPTY STATE
   ============================================================================= */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
}
.empty-state .empty-icon {
  font-size: 48px;
  color: var(--gray-300);
  margin-bottom: 12px;
}
.empty-state .empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 4px;
}
.empty-state .empty-desc {
  font-size: 13px;
  color: var(--gray-400);
  margin-bottom: 16px;
  max-width: 280px;
}

/* =============================================================================
   TABLES
   ============================================================================= */
.table { font-size: 13px; }
.table thead th {
  background: var(--gray-50);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--gray-600);
  border-bottom: 2px solid var(--gray-200);
  padding: 12px 16px;
}
.table td { padding: 12px 16px; vertical-align: middle; border-color: var(--gray-100); }
.table tbody tr:hover { background: var(--gray-50); }

/* =============================================================================
   BADGES & STATUS
   ============================================================================= */
.badge { font-weight: 500; font-size: 11px; padding: 4px 8px; border-radius: 6px; }
.status-badge { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; letter-spacing: 0.3px; }

/* =============================================================================
   FORMS — Emerald Focus Ring
   ============================================================================= */
.form-control, .form-select {
  border-radius: 8px;
  border: 1.5px solid var(--gray-200);
  font-size: 13px;
  padding: 8px 12px;
  transition: var(--transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.form-label { font-weight: 500; font-size: 13px; color: var(--gray-700); margin-bottom: 4px; }
.form-text { font-size: 12px; color: var(--gray-500); }

/* =============================================================================
   BUTTONS — Emerald Primary
   ============================================================================= */
.btn { border-radius: 8px; font-weight: 500; font-size: 13px; padding: 8px 16px; transition: var(--transition); }
.btn-primary { background: var(--brand-700); border-color: var(--brand-700); }
.btn-primary:hover { background: var(--brand-800); border-color: var(--brand-800); }
.btn-primary:focus { box-shadow: 0 0 0 3px rgba(16,185,129,0.2); }
.btn-success { background: var(--emerald-600); border-color: var(--emerald-600); }
.btn-success:hover { background: var(--emerald-500); border-color: var(--emerald-500); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon-only { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; }

/* =============================================================================
   ALERTS
   ============================================================================= */
.flash-container .alert { border-radius: 10px; font-size: 13px; }

/* =============================================================================
   WORKFLOW TIMELINE
   ============================================================================= */
.workflow-timeline {
  position: relative;
  padding-left: 24px;
}
.workflow-timeline::before {
  content: '';
  position: absolute;
  left: 7px; top: 0; bottom: 0;
  width: 2px;
  background: var(--gray-200);
}
.workflow-step {
  position: relative;
  margin-bottom: 16px;
}
.workflow-step::before {
  content: '';
  position: absolute;
  left: -21px; top: 4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--gray-300);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--gray-300);
}
.workflow-step.done::before { background: var(--brand-500); box-shadow: 0 0 0 2px var(--brand-500); }
.workflow-step.active::before { background: var(--brand-700); box-shadow: 0 0 0 2px var(--brand-700); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{box-shadow:0 0 0 2px var(--brand-700)} 50%{box-shadow:0 0 0 4px rgba(5,150,105,0.3)} }

/* =============================================================================
   LOGIN PAGE — Split Screen
   ============================================================================= */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  background: var(--gray-50);
}

/* Left panel — Form */
.login-form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  min-height: 100vh;
}

.login-card {
  background: #fff;
  border-radius: var(--border-radius-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 440px;
  border: var(--border-hairline);
  box-shadow: var(--shadow-sm);
  position: relative;
  z-index: 1;
}

.login-logo {
  width: 72px; height: 72px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 2px solid var(--gray-200);
  background: #fff;
}
.login-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--brand-800);
  margin-bottom: 4px;
}
.login-subtitle {
  font-size: 13px;
  color: var(--gray-500);
  line-height: 1.5;
}
.login-value-text {
  font-size: 12px;
  color: var(--brand-600);
  font-weight: 500;
  margin-top: 4px;
}

/* Right panel — Decorative */
.login-deco-panel {
  flex: 1;
  background: linear-gradient(135deg, var(--brand-800) 0%, var(--brand-900) 60%, #032015 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 48px;
  position: relative;
  overflow: hidden;
  color: #fff;
}
.login-deco-panel::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(16,185,129,0.15) 0%, transparent 70%);
  top: -150px; right: -150px;
  pointer-events: none;
}
.login-deco-panel::after {
  content: '';
  position: absolute;
  width: 350px; height: 350px;
  background: radial-gradient(circle, rgba(52,211,153,0.1) 0%, transparent 70%);
  bottom: -100px; left: -100px;
  pointer-events: none;
}

.deco-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 420px;
}
.deco-icon {
  font-size: 80px;
  margin-bottom: 24px;
  opacity: 0.9;
  text-shadow: 0 4px 24px rgba(0,0,0,0.2);
}
.deco-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.3;
}
.deco-tagline {
  font-size: 15px;
  line-height: 1.7;
  opacity: 0.8;
  margin-bottom: 32px;
}
.deco-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}
.deco-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  opacity: 0.85;
}
.deco-feature i {
  font-size: 18px;
  color: var(--brand-400);
  width: 24px;
  text-align: center;
}

/* =============================================================================
   PAGE FOOTER
   ============================================================================= */
.page-footer {
  text-align: center;
  padding: 12px 24px;
  font-size: 11px;
  color: var(--gray-500);
  border-top: var(--border-hairline);
  background: #fff;
}

/* =============================================================================
   SIDEBAR OVERLAY (Mobile)
   ============================================================================= */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1039;
  backdrop-filter: blur(2px);
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */
@media (max-width: 767.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.show {
    transform: translateX(0);
  }
  .sidebar-overlay.show {
    display: block;
  }
  .main-content {
    margin-left: 0;
  }
  .page-content { padding: 16px; }

  /* Login: hide deco panel on mobile */
  .login-deco-panel {
    display: none !important;
  }
  .login-form-panel {
    padding: 24px 16px;
  }
  .login-card { padding: 32px 24px; }
  .topbar-search { display: none; }
}

@media (max-width: 991.98px) {
  .topbar-search { width: 180px; }
}

/* =============================================================================
   UTILITIES
   ============================================================================= */
.text-navy { color: var(--brand-700) !important; }
.text-emerald { color: var(--emerald-500) !important; }
.bg-navy { background-color: var(--brand-700) !important; }
.rounded-xl { border-radius: 12px !important; }
.shadow-hover { transition: var(--transition); }
.shadow-hover:hover { box-shadow: var(--shadow-md) !important; }

/* Truncate */
.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 6px;
}
@keyframes skeleton-loading { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* File upload drop zone */
.dropzone {
  border: 2px dashed var(--gray-300);
  border-radius: 10px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--gray-50);
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--brand-500);
  background: rgba(16, 185, 129, 0.04);
}
