/* ==========================================================================
   KARTU PARTISIPASI MAHASISWA (UNISKA)
   Modern Minimalist Institutional Theme & Full Responsive Stylesheet
   ========================================================================== */

:root {
  /* Core Color Palette */
  --color-primary: #0f172a;       /* Dark Slate / Navy */
  --color-primary-hover: #1e293b;
  --color-surface: #ffffff;
  --color-background: #f8fafc;   /* Ultra-clean light background */
  --color-border: #e2e8f0;
  --color-border-subtle: #f1f5f9;
  --color-text-main: #0f172a;
  --color-text-muted: #64748b;
  --color-text-subtle: #94a3b8;

  /* Semantic Status Colors (From Mockup) */
  --color-status-approved: #70c050; /* Fresh Vivid Green */
  --color-status-waiting: #f5b041;  /* Warm Amber Orange */
  --color-status-declined: #e74c3c; /* Coral Red */

  /* UI Component Accents */
  --color-cta-card: #111827;      /* Midnight Black / Dark Navy */
  --color-cta-card-hover: #1f293d;
  --color-logout-bg: #fff1f2;
  --color-logout-border: #fecdd3;
  --color-logout-icon: #e11d48;

  /* Elevations & Shadows */
  --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
  --shadow-card-hover: 0 8px 24px -4px rgba(15, 23, 42, 0.08), 0 4px 8px -2px rgba(15, 23, 42, 0.03);
  --shadow-menu: 0 12px 32px -4px rgba(0, 0, 0, 0.12), 0 4px 10px -2px rgba(0, 0, 0, 0.04);
}

/* Base Resets & Global Styles */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--color-background);
  color: var(--color-text-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   1. NAVBAR & HEADER RESPONSIVE
   ========================================================================== */

.app-header {
  background-color: #ffffff;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 40;
  height: 64px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.app-header-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@media (min-width: 640px) {
  .app-header-container {
    padding: 0 24px;
  }
}

/* Institutional Brand */
.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
}

.header-brand-logo {
  height: 38px;
  width: auto;
  object-fit: contain;
  border-radius: 8px;
}

.header-brand-text {
  display: flex;
  flex-direction: column;
}

.header-brand-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-brand-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: -0.01em;
}

.header-brand-badge {
  font-size: 10px;
  font-weight: 600;
  background-color: #f1f5f9;
  color: #475569;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

.header-brand-subtitle {
  font-size: 11px;
  color: var(--color-text-muted);
  margin: 1px 0 0 0;
}

/* Responsive Rule 1: Sembunyikan teks institusi di Mobile, sisakan HANYA logo */
@media (max-width: 640px) {
  .header-brand-text {
    display: none !important;
  }
}

/* User Pill & Logout Section */
.header-user-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (min-width: 640px) {
  .header-user-section {
    gap: 12px;
  }
}

/* Pill User Ringkas */
.user-profile-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 12px 3px 4px;
  background-color: #ffffff;
  border: 1.5px solid var(--color-border);
  border-radius: 9999px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease-in-out;
  box-shadow: var(--shadow-subtle);
}

.user-profile-pill:hover {
  background-color: #f8fafc;
  border-color: #cbd5e1;
}

.user-profile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--color-border);
  background-color: #f1f5f9;
  flex-shrink: 0;
}

.user-profile-meta {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.user-profile-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.2;
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-profile-id {
  font-size: 10px;
  color: var(--color-text-muted);
  font-family: monospace;
  line-height: 1.2;
}

@media (max-width: 540px) {
  .user-profile-meta {
    display: none !important;
  }
  .user-profile-pill {
    padding: 3px 6px 3px 3px;
    gap: 4px;
  }
}

.user-profile-chevron {
  width: 14px;
  height: 14px;
  color: var(--color-text-subtle);
  flex-shrink: 0;
}

/* Tombol Logout Merah */
.header-btn-logout {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1.5px solid var(--color-logout-border);
  background-color: var(--color-logout-bg);
  color: var(--color-logout-icon);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  flex-shrink: 0;
}

.header-btn-logout:hover {
  background-color: #ffe4e6;
  border-color: #fda4af;
  transform: scale(1.03);
}

.header-btn-logout i,
.header-btn-logout svg {
  width: 17px;
  height: 17px;
}

/* ==========================================================================
   2. KOMPONEN DROPDOWN KUSTOM (FULL CSS)
   ========================================================================== */

.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  position: relative;
  z-index: 25;
}

.filter-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-primary);
  margin-right: 2px;
}

.custom-pill-dropdown {
  position: relative;
  display: inline-block;
}

.pill-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-radius: 9999px;
  border: 1.5px solid #cbd5e1;
  background-color: #ffffff;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  outline: none;
  user-select: none;
}

.pill-dropdown-trigger:hover {
  border-color: #94a3b8;
  background-color: #f8fafc;
  color: var(--color-primary);
}

.pill-dropdown-trigger[aria-expanded="true"] {
  border-color: var(--color-primary);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.pill-dropdown-chevron {
  width: 14px;
  height: 14px;
  color: var(--color-text-muted);
  transition: transform 0.2s ease;
  pointer-events: none;
}

.pill-dropdown-trigger[aria-expanded="true"] .pill-dropdown-chevron {
  transform: rotate(180deg);
  color: var(--color-primary);
}

.pill-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 200px;
  background-color: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  box-shadow: var(--shadow-menu);
  padding: 6px;
  z-index: 50;
  display: none;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.pill-dropdown-menu.show {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.pill-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
}

.pill-dropdown-item:hover {
  background-color: #f1f5f9;
  color: var(--color-primary);
  font-weight: 600;
}

.pill-dropdown-item.active {
  background-color: #f8fafc;
  color: var(--color-primary);
  font-weight: 700;
}

/* ==========================================================================
   3. TATA LETAK DASHBOARD MAHASISWA (MOBILE & DESKTOP MOCKUP)
   ========================================================================== */

.student-dashboard-layout {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
}

/* Desktop Layout (>= 1024px): 
   Sisi Kiri: Riwayat Partisipasi (Filter & Cards)
   Sisi Kanan: Sidebar Profil Mahasiswa & CTA Button */
@media (min-width: 1024px) {
  .student-dashboard-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    grid-template-areas: "main sidebar";
    gap: 32px;
    align-items: start;
  }

  .student-dashboard-main {
    grid-area: main;
  }

  .student-dashboard-sidebar {
    grid-area: sidebar;
    position: sticky;
    top: 84px;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
}

@media (min-width: 1280px) {
  .student-dashboard-layout {
    grid-template-columns: 1fr 370px;
    grid-template-areas: "main sidebar";
    gap: 40px;
  }
}

/* Mobile Layout (< 1024px):
   Atas: Kartu Profil & Ringkasan Statistik
   Tepat di Bawahnya: Tombol Hitam Rounded "+ Catat Partisipasimu"
   Di Bawahnya: Judul "Riwayat Partisipasi", Filter, dan Grid 2 Kolom */
@media (max-width: 1023px) {
  .student-dashboard-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }

  .student-dashboard-sidebar {
    order: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
  }

  .student-dashboard-main {
    order: 2;
    width: 100%;
  }
}

/* ==========================================================================
   4. SIDEBAR: KARTU PROFIL MAHASISWA & TOMBOL CTA
   ========================================================================== */

/* Kartu Profil Mahasiswa */
.student-profile-card {
  background-color: #ffffff;
  border: 1.5px solid var(--color-border);
  border-radius: 24px;
  padding: 22px;
  position: relative;
  box-shadow: var(--shadow-card);
}

.profile-card-print-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background-color: #ffffff;
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.profile-card-print-btn:hover {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
}

.profile-card-print-btn i,
.profile-card-print-btn svg {
  width: 16px;
  height: 16px;
}

.profile-identity-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-right: 36px; /* give room for print button */
}

.profile-avatar-wrap {
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}

.profile-avatar-img {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-border);
  background-color: #f1f5f9;
  transition: transform 0.2s ease;
}

.profile-avatar-wrap:hover .profile-avatar-img {
  transform: scale(1.05);
}

.profile-info-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1.25;
  margin: 0;
}

.profile-subtitle {
  font-size: 12px;
  color: var(--color-text-muted);
  font-family: monospace;
  margin: 0;
}

/* 3 Kolom Metrik Statistik Horizontal */
.profile-stats-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  border-top: 1px solid var(--color-border-subtle);
  padding-top: 16px;
}

.stat-col {
  text-align: center;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  display: block;
  margin-bottom: 4px;
}

.stat-num {
  font-size: 24px;
  font-weight: 800;
  font-family: monospace;
  line-height: 1;
  display: block;
}

.stat-num-total {
  color: var(--color-primary);
}

.stat-num-approved {
  color: var(--color-status-approved); /* Hijau */
}

.stat-num-pending {
  color: var(--color-status-waiting);  /* Oranye */
}

.stat-divider {
  width: 1px;
  height: 32px;
  background-color: var(--color-border);
}

/* Tombol Hitam Besar Rounded "+ Catat Partisipasimu" */
.cta-participation-card {
  background-color: var(--color-cta-card);
  border-radius: 20px;
  padding: 18px 20px;
  color: #ffffff;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(17, 24, 39, 0.15);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.cta-participation-card:hover {
  background-color: var(--color-cta-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(17, 24, 39, 0.22);
}

.cta-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cta-plus-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  flex-shrink: 0;
}

.cta-plus-icon i,
.cta-plus-icon svg {
  width: 14px;
  height: 14px;
}

.cta-title {
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.cta-desc {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.45;
  margin: 8px 0 0 0;
}

/* Pada Mobile, CTA disesuaikan rapi sebagai pill bar aksi utama */
@media (max-width: 1023px) {
  .cta-participation-card {
    padding: 14px 20px;
    align-items: center;
    text-align: center;
    border-radius: 9999px;
  }

  .cta-desc {
    display: none; /* Sembunyikan teks deskripsi di mobile agar compact sesuai mockup */
  }

  .cta-header {
    justify-content: center;
  }
}

/* ==========================================================================
   5. RIWAYAT PARTISIPASI & GRID KARTU (CARD ITEMS)
   ========================================================================== */

.student-history-header {
  margin-bottom: 18px;
}

.history-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--color-primary);
  margin: 0 0 12px 0;
  letter-spacing: -0.02em;
}

@media (min-width: 640px) {
  .history-title {
    font-size: 26px;
  }
}

/* Cards Grid Responsive Behavior:
   - Mobile: persis 2 kolom sesuai mockup Mobile_view_5350c6.png
   - Desktop: 3 kolom proporsional (grid-cols-3) dengan min-width 240px agar teks judul tidak cepat bertumpuk/terpotong */
.student-cards-grid {
  display: grid;
  gap: 14px;
}

/* Mobile (<= 639px): 2 KOLOM */
@media (max-width: 639px) {
  .student-cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

/* Tablet (640px - 1023px): 2 Kolom */
@media (min-width: 640px) and (max-width: 1023px) {
  .student-cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
}

/* Desktop (>= 1024px): 3 Kolom Proporsional (grid-cols-3) */
@media (min-width: 1024px) {
  .student-cards-grid {
    grid-template-columns: repeat(3, minmax(240px, 1fr));
    gap: 18px;
  }
}

/* Desain Kartu Partisipasi (Card Items) */
.participation-card {
  background-color: #ffffff;
  border: 1.5px solid var(--color-border);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  box-shadow: var(--shadow-card);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  user-select: none;
  min-width: 0;
}

.participation-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

/* Header Status di Bagian ATAS Kartu dengan Warna Solid:
   display: flex; justify-content: space-between; align-items: center; px-3 py-1.5 */
.card-status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.01em;
  gap: 8px;
}

@media (min-width: 640px) {
  .card-status-header {
    padding: 6px 14px;
    font-size: 11.5px;
    gap: 12px;
  }
}

/* Warna Solid Header Status */
.card-status-header.status-approved {
  background-color: var(--color-status-approved); /* Hijau */
}

.card-status-header.status-waiting {
  background-color: var(--color-status-waiting);  /* Oranye / Kuning */
}

.card-status-header.status-declined {
  background-color: var(--color-status-declined); /* Merah */
}

.header-status-left {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.header-status-right {
  display: inline-flex;
  align-items: center;
  font-weight: 600;
  opacity: 0.95;
  white-space: nowrap;
  flex-shrink: 0;
  text-align: right;
  margin-left: auto;
}

/* Badan Kartu */
.card-content-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

@media (min-width: 640px) {
  .card-content-body {
    padding: 14px 16px 16px;
  }
}

/* Judul / Topik Tebal (Bold) */
.card-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--color-primary);
  margin: 0 0 6px 0;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

@media (min-width: 640px) {
  .card-title {
    font-size: 15px;
  }
}

/* Garis Pembatas Tipis di Bawah Judul */
.card-divider {
  border-bottom: 1px solid var(--color-border-subtle);
  margin-bottom: 8px;
}

/* Isi Jawaban / Keterangan Singkat */
.card-desc {
  font-size: 11.5px;
  color: var(--color-text-muted);
  line-height: 1.45;
  margin: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

@media (min-width: 640px) {
  .card-desc {
    font-size: 12.5px;
  }
}

/* Empty State */
.student-empty-state {
  grid-column: 1 / -1;
  padding: 40px 20px;
  text-align: center;
  background-color: #ffffff;
  border: 1.5px dashed var(--color-border);
  border-radius: 20px;
}

.student-empty-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-primary);
  margin: 0 0 4px 0;
}

.student-empty-desc {
  font-size: 12px;
  color: var(--color-text-muted);
  margin: 0;
}

/* ==========================================================================
   6. PRINT STYLESHEET
   ========================================================================== */

@media print {
  body {
    background-color: #ffffff !important;
    color: #000000 !important;
  }
  
  header, 
  nav, 
  .app-header, 
  .header-user-section,
  .cta-participation-card,
  .filter-bar,
  .profile-card-print-btn,
  button, 
  .modal, 
  #toast-container {
    display: none !important;
  }
  
  .student-profile-card {
    border: 1px solid #000000 !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    max-width: 500px !important;
    margin: 20px auto !important;
  }

  .student-cards-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  .participation-card {
    border: 1px solid #000000 !important;
    box-shadow: none !important;
    break-inside: avoid;
  }
}
