/**
 * PORTAL MADRASAH - STYLESHEET
 * Desain Mobile-First Modern Islami (Responsive Android & Desktop)
 */

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

:root {
  --primary-green: #0B583E;
  --primary-dark: #073E2B;
  --primary-light: #E3EDE8;
  --primary-hover: #0E6B4B;
  --accent-gold: #F5A623;
  --bg-page: #F5F5F0;
  --card-bg: #FFFFFF;
  --text-dark: #1E293B;
  --text-muted: #64748B;
  --border-color: #E2E8F0;
  --danger: #EF4444;
  --radius-card: 20px;
  --radius-btn: 12px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.06);
  --shadow-active: 0 8px 18px rgba(11, 88, 62, 0.35);
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Reset & Base Setup */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-dark);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}

/* App Container (Mobile-First Frame centered on Desktop) */
.app-container {
  width: 100%;
  max-width: 480px; /* Perfect Android Screen Width */
  margin: 0 auto;
  min-height: 100vh;
  background-color: var(--bg-page);
  padding: 16px 16px 96px 16px; /* 96px bottom for floating dock */
  position: relative;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.05);
}

@media (min-width: 768px) {
  body {
    background-color: #E8ECE8;
    padding: 24px 0;
  }
  .app-container {
    border-radius: 32px;
    margin: 12px auto;
    border: 1px solid rgba(0, 0, 0, 0.08);
    overflow: hidden;
  }
}

/* Header Bar */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 4px 16px 4px;
}

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

.top-header .brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: contain;
}

.top-header .brand-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary-green);
  letter-spacing: -0.02em;
}

.top-header .brand-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.top-header .user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #FFFFFF;
  padding: 6px 12px;
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-dark);
}

.role-pill {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 6px;
  text-transform: uppercase;
  font-weight: 700;
}
.role-pill.admin { background: #FEF3C7; color: #D97706; }
.role-pill.guru { background: #D1FAE5; color: #059669; }

/* 1. Visi Misi Hero Banner */
.hero-card {
  position: relative;
  background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-dark) 100%);
  border-radius: 24px;
  padding: 22px 20px;
  color: #FFFFFF;
  margin-bottom: 24px;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(11, 88, 62, 0.25);
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url('../images/pattern.svg');
  background-repeat: repeat;
  background-size: 80px 80px;
  opacity: 0.15;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
}

.hero-title {
  color: var(--accent-gold);
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.hero-vision {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 18px;
  color: #FFFFFF;
}

.hero-mission-title {
  color: var(--accent-gold);
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.hero-mission-list {
  text-align: left;
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hero-mission-item {
  font-size: 0.82rem;
  line-height: 1.4;
  color: #F1F5F9;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.hero-mission-num {
  font-weight: 700;
  color: var(--accent-gold);
  flex-shrink: 0;
}

/* 2. Bookmark Terakhir Section */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-dark);
}

.section-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-green);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
}

.section-link:hover {
  text-decoration: underline;
}

.bookmark-card {
  background: var(--card-bg);
  border-radius: var(--radius-card);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.bookmark-card:active {
  transform: scale(0.98);
}

.bookmark-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.bookmark-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background-color: var(--primary-light);
  color: var(--primary-green);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bookmark-text {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dark);
}

.bookmark-arrow-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #F8FAFC;
  color: var(--text-dark);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Dynamic Bookmarks Slider/Grid */
.bookmarks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.bookmark-item-pill {
  background: #FFFFFF;
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--text-dark);
  font-weight: 600;
  font-size: 0.8rem;
}

/* 3. Fitur Utama Header & Dropdown */
.fitur-utama-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.dropdown-tp-badge {
  background: var(--primary-green);
  color: #FFFFFF;
  border-radius: 10px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(11, 88, 62, 0.2);
  cursor: pointer;
  border: none;
  outline: none;
}

.dropdown-tp-badge select {
  background: transparent;
  color: #FFFFFF;
  border: none;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  outline: none;
  cursor: pointer;
}

.dropdown-tp-badge select option {
  background: #FFFFFF;
  color: var(--text-dark);
}

/* Live Search Filter */
.search-bar-wrap {
  margin-bottom: 14px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border-radius: 12px;
  border: 1px solid #E2E8F0;
  background: #FFFFFF;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  border-color: var(--primary-green);
  box-shadow: 0 0 0 3px rgba(11, 88, 62, 0.12);
}

.search-icon-pos {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* 4. Grid Fitur Utama (3 Kolom Sesuai Foto) */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 30px;
}

.feature-card {
  background: var(--card-bg);
  border-radius: var(--radius-card);
  padding: 16px 8px 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  border: 2px solid transparent;
  user-select: none;
}

.feature-card:active {
  transform: scale(0.95);
}

/* Icon Box (Normal / Inaktif) */
.feature-icon-box {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background-color: var(--primary-light);
  color: var(--primary-green);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  transition: all 0.25s ease;
  flex-shrink: 0;
}

/* Feature Title */
.feature-title {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-dark);
  margin-top: auto;
  word-break: break-word;
  hyphens: auto;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ACTIVE STATE (Mirrors "Data Siswa" card in the screenshot) */
.feature-card.active,
.feature-card[data-active="true"] {
  border-color: rgba(11, 88, 62, 0.15);
  box-shadow: var(--shadow-md);
}

.feature-card.active .feature-icon-box,
.feature-card[data-active="true"] .feature-icon-box {
  background-color: var(--primary-green);
  color: #FFFFFF;
  box-shadow: var(--shadow-active);
  transform: translateY(-2px);
}

/* Bookmark Pin Button on Card */
.btn-card-pin {
  position: absolute;
  top: 6px;
  right: 6px;
  background: transparent;
  border: none;
  color: #CBD5E1;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, transform 0.2s;
  z-index: 5;
}

.btn-card-pin:hover,
.btn-card-pin.pinned {
  color: var(--accent-gold);
  transform: scale(1.15);
}

/* 5. Floating Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 448px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 36px;
  padding: 8px 12px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.6);
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #94A3B8;
  font-size: 0.68rem;
  font-weight: 600;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 12px;
  transition: all 0.2s ease;
  min-width: 60px;
}

.nav-item.active {
  color: var(--primary-green);
  font-weight: 800;
}

.nav-item.active svg {
  transform: scale(1.1);
}

/* 6. Modal Webview / Popup Info */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-panel {
  background: #FFFFFF;
  width: 100%;
  max-width: 500px;
  border-radius: 28px 28px 0 0;
  padding: 20px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.show .modal-panel {
  transform: translateY(0);
}

@media (min-width: 640px) {
  .modal-backdrop {
    align-items: center;
    padding: 20px;
  }
  .modal-panel {
    border-radius: 28px;
  }
}

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

.modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary-green);
}

.modal-close-btn {
  background: #F1F5F9;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-dark);
}

.modal-body {
  padding: 16px 0;
  overflow-y: auto;
  flex: 1;
}

.modal-iframe {
  width: 100%;
  height: 65vh;
  border: none;
  border-radius: 12px;
}

/* 7. Buttons & Form Controls (Admin & General) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-btn);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-primary {
  background-color: var(--primary-green);
  color: #FFFFFF;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: #E2E8F0;
  color: var(--text-dark);
}

.btn-danger {
  background-color: var(--danger);
  color: #FFFFFF;
}

.btn-outline {
  border: 1px solid var(--border-color);
  background: #FFFFFF;
  color: var(--text-dark);
}

.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  background: #FFFFFF;
}

.form-control:focus {
  border-color: var(--primary-green);
  box-shadow: 0 0 0 3px rgba(11, 88, 62, 0.12);
}

/* Toast Notification */
.toast-msg {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--text-dark);
  color: #FFFFFF;
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.toast-msg.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-msg.success {
  background: var(--primary-green);
}

.toast-msg.error {
  background: var(--danger);
}

/* 8. Fitur Profesional: Broadcast Pengumuman Kilat */
.announcement-box {
  background: #FFFFFF;
  border-radius: 18px;
  padding: 12px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  border-left: 5px solid var(--accent-gold);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.announcement-box:active {
  transform: scale(0.98);
}

.announcement-box.urgent {
  border-left-color: #EF4444;
}

.announcement-box.info {
  border-left-color: #0284C7;
}

.announcement-icon-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #FEF3C7;
  color: #D97706;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.announcement-box.urgent .announcement-icon-badge {
  background: #FEE2E2;
  color: #DC2626;
}

.announcement-box.info .announcement-icon-badge {
  background: #E0F2FE;
  color: #0284C7;
}

.announcement-text-area {
  flex: 1;
  overflow: hidden;
}

.announcement-badge-tag {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #D97706;
}

.announcement-box.urgent .announcement-badge-tag {
  color: #DC2626;
}

.announcement-box.info .announcement-badge-tag {
  color: #0284C7;
}

.announcement-headline {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* 9. Fitur Profesional: Category Filter Chips */
.category-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 14px;
  padding: 2px 0 6px 0;
}

.category-chips::-webkit-scrollbar {
  display: none;
}

.chip-btn {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  user-select: none;
}

.chip-btn:hover {
  border-color: var(--primary-green);
  color: var(--primary-green);
}

.chip-btn.active {
  background: var(--primary-green);
  border-color: var(--primary-green);
  color: #FFFFFF;
  box-shadow: 0 4px 10px rgba(11, 88, 62, 0.25);
}

/* 10. Fitur Profesional: Quick Add Card di Dashboard (Admin Mode) */
.feature-card.quick-add {
  border: 2px dashed #0B583E;
  background: rgba(11, 88, 62, 0.03);
  box-shadow: none;
}

.feature-card.quick-add .feature-icon-box {
  background: rgba(11, 88, 62, 0.1);
  color: var(--primary-green);
}

.feature-card.quick-add:hover,
.feature-card.quick-add:active {
  background: rgba(11, 88, 62, 0.08);
  border-style: solid;
}

