/**
 * SIMPONPES - Modern Islamic Pesantren Design System
 * Theme: Emerald Forest & Islamic Gold Accents with Glassmorphism
 */

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

:root {
  /* Brand Colors */
  --primary-900: #064e3b;
  --primary-800: #065f46;
  --primary-700: #047857;
  --primary-600: #059669;
  --primary-500: #10b981;
  --primary-100: #d1fae5;
  --primary-50:  #ecfdf5;

  /* Gold Accents */
  --gold-700: #b45309;
  --gold-600: #d97706;
  --gold-500: #f59e0b;
  --gold-400: #fbbf24;
  --gold-100: #fef3c7;
  --gold-50:  #fffbeb;

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

  /* Status Colors */
  --emerald: #10b981;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --sky: #0ea5e9;
  --indigo: #6366f1;
  --purple: #8b5cf6;

  /* Layout Dimensions */
  --sidebar-width: 270px;
  --header-height: 70px;
  --border-radius-lg: 16px;
  --border-radius-md: 12px;
  --border-radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.2);
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #f4f6f9;
  color: var(--slate-800);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

.font-arabic {
  font-family: 'Amiri', serif;
}

/* Scrollbar Custom */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary-600);
}

/* ===================================================
   LAYOUT STRUCTURE
   =================================================== */

.app-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #064e3b 0%, #065f46 60%, #022c22 100%);
  color: #fff;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 25px rgba(0,0,0,0.15);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.15);
}

.sidebar-brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.3rem;
  box-shadow: 0 4px 10px rgba(217, 119, 6, 0.3);
}

.sidebar-brand-text h4 {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
  margin: 0;
}

.sidebar-brand-text span {
  font-size: 0.72rem;
  color: var(--primary-100);
  display: block;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(209, 250, 229, 0.6);
  padding: 0.75rem 0.75rem 0.35rem 0.75rem;
}

.nav-item {
  list-style: none;
  margin-bottom: 3px;
}

.nav-link-custom {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: var(--border-radius-sm);
  transition: all 0.2s ease;
  position: relative;
}

.nav-link-custom i {
  font-size: 1.05rem;
  width: 22px;
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  transition: all 0.2s ease;
}

.nav-link-custom:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  transform: translateX(3px);
}

.nav-link-custom:hover i {
  color: var(--gold-400);
}

.nav-link-custom.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.35) 0%, rgba(16, 185, 129, 0.1) 100%);
  border-left: 3.5px solid var(--gold-400);
  font-weight: 600;
}

.nav-link-custom.active i {
  color: var(--gold-400);
}

.nav-badge {
  margin-left: auto;
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(255,255,255,0.2);
  color: #fff;
}

/* Sidebar Nav Accordion Groups with 100% Transparent Aesthetic */
.nav-group,
.nav-group-header,
.nav-group-items,
.app-sidebar div.collapse,
.app-sidebar div.collapsing {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.nav-group {
  margin-bottom: 2px;
}

.nav-group-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  color: rgba(255, 255, 255, 0.85) !important;
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  border-radius: var(--border-radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  outline: none !important;
  box-shadow: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}

.nav-group-header:hover,
.nav-group-header:focus,
.nav-group-header:active {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.08) !important;
  background-color: rgba(255, 255, 255, 0.08) !important;
  outline: none !important;
  box-shadow: none !important;
  transform: translateX(2px);
}

.nav-group-header .nav-group-icon {
  font-size: 1.05rem;
  width: 22px;
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  transition: all 0.2s ease;
}

.nav-group-header:hover .nav-group-icon,
.nav-group-header[aria-expanded="true"] .nav-group-icon,
.nav-group-header.active .nav-group-icon {
  color: var(--gold-400) !important;
}

.nav-group-header.active,
.nav-group-header[aria-expanded="true"] {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.06) !important;
  background-color: rgba(255, 255, 255, 0.06) !important;
  font-weight: 700;
}

.nav-group-chevron {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-group-header[aria-expanded="true"] .nav-group-chevron {
  transform: rotate(180deg);
  color: var(--gold-400) !important;
}

.nav-group-items {
  list-style: none;
  padding: 0 0 0 0.5rem;
  margin: 2px 0 6px 0.85rem;
  border-left: 1.5px solid rgba(255, 255, 255, 0.15);
  background: transparent !important;
  background-color: transparent !important;
}

.nav-group-items .nav-link-custom {
  font-size: 0.84rem;
  padding: 0.48rem 0.75rem;
  margin-bottom: 2px;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
}

/* Main Content Area */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  width: calc(100% - var(--sidebar-width));
  max-width: 100%;
  min-width: 0;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background-color: #f4f6f9;
}

/* Header Navbar */
.app-header {
  height: var(--header-height);
  background: #ffffff;
  border-bottom: 1px solid var(--slate-200);
  padding: 0 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.header-search {
  position: relative;
  width: 280px;
}

.header-search input {
  width: 100%;
  padding: 0.5rem 1rem 0.5rem 2.4rem;
  font-size: 0.86rem;
  border: 1px solid var(--slate-200);
  border-radius: 30px;
  background: var(--slate-50);
  transition: all 0.2s;
}

.header-search input:focus {
  outline: none;
  background: #fff;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.header-search i {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--slate-400);
}

/* Page Container */
.page-content {
  flex: 1 0 auto;
  padding: 1.75rem;
  min-width: 0;
  width: 100%;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--slate-900);
  margin-bottom: 0.2rem;
}

.page-subtitle {
  font-size: 0.85rem;
  color: var(--slate-500);
}

/* Footer */
.app-footer {
  flex-shrink: 0;
  width: 100%;
  padding: 1.25rem 1.75rem;
  background: #ffffff;
  border-top: 1px solid var(--slate-200);
  font-size: 0.82rem;
  color: var(--slate-500);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

/* ===================================================
   COMPONENTS & CARDS
   =================================================== */

.card-custom {
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

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

.card-header-custom {
  padding: 1.15rem 1.35rem;
  background: #ffffff;
  border-bottom: 1px solid var(--slate-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 1rem;
  color: var(--slate-800);
}

.card-body-custom {
  padding: 1.35rem;
}

/* Stat KPI Cards */
.stat-card {
  background: #ffffff;
  border-radius: var(--border-radius-md);
  padding: 1.35rem;
  border: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.stat-emerald::before { background: linear-gradient(90deg, #059669, #10b981); }
.stat-gold::before { background: linear-gradient(90deg, #d97706, #fbbf24); }
.stat-sky::before { background: linear-gradient(90deg, #0284c7, #38bdf8); }
.stat-rose::before { background: linear-gradient(90deg, #e11d48, #fb7185); }
.stat-purple::before { background: linear-gradient(90deg, #7c3aed, #a78bfa); }

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}

.icon-emerald { background: var(--primary-50); color: var(--primary-700); }
.icon-gold { background: var(--gold-50); color: var(--gold-600); }
.icon-sky { background: #f0f9ff; color: var(--sky); }
.icon-rose { background: #fff1f2; color: var(--rose); }
.icon-purple { background: #faf5ff; color: var(--purple); }

.stat-value {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--slate-900);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Badges */
.status-badge {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  border-radius: 30px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  letter-spacing: 0.2px;
}

.badge-emerald { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-amber { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-rose { background: #ffe4e6; color: #9f1239; border: 1px solid #fecdd3; }
.badge-sky { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.badge-indigo { background: #e0e7ff; color: #3730a3; border: 1px solid #c7d2fe; }
.badge-purple { background: #ede9fe; color: #5b21b6; border: 1px solid #ddd6fe; }
.badge-slate { background: #f1f5f9; color: #334155; border: 1px solid #e2e8f0; }

/* Buttons */
.btn-emerald {
  background: linear-gradient(135deg, var(--primary-700), var(--primary-600));
  color: #fff;
  border: none;
  font-weight: 600;
  border-radius: var(--border-radius-sm);
  padding: 0.55rem 1.15rem;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(4, 120, 87, 0.2);
}
.btn-emerald:hover {
  background: linear-gradient(135deg, var(--primary-800), var(--primary-700));
  color: #fff;
  box-shadow: 0 4px 12px rgba(4, 120, 87, 0.35);
  transform: translateY(-1px);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold-600), var(--gold-500));
  color: #fff;
  border: none;
  font-weight: 600;
  border-radius: var(--border-radius-sm);
  padding: 0.55rem 1.15rem;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.2);
}
.btn-gold:hover {
  background: linear-gradient(135deg, var(--gold-700), var(--gold-600));
  color: #fff;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.35);
  transform: translateY(-1px);
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 #f1f5f9;
}

.table-responsive::-webkit-scrollbar {
  height: 8px;
}
.table-responsive::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
  background: var(--primary-600);
}

.table-custom {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table-custom th {
  background: var(--slate-50);
  color: var(--slate-700);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 0.85rem 1rem;
  border-bottom: 1.5px solid var(--slate-200);
  border-top: none;
  white-space: nowrap;
}

.table-custom td {
  padding: 0.85rem 1rem;
  font-size: 0.86rem;
  color: var(--slate-800);
  border-bottom: 1px solid var(--slate-100);
  vertical-align: middle;
}

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

/* Forms */
.form-label-custom {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 0.35rem;
}

.form-control-custom, .form-select-custom {
  width: 100%;
  padding: 0.55rem 0.85rem;
  font-size: 0.88rem;
  border: 1px solid var(--slate-200);
  border-radius: var(--border-radius-sm);
  background-color: #fff;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control-custom:focus, .form-select-custom:focus {
  border-color: var(--primary-500);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* Quick Actions Widget */
.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem 0.5rem;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--border-radius-md);
  text-decoration: none;
  color: var(--slate-700);
  transition: all 0.2s ease;
  height: 100%;
}

.quick-action-btn:hover {
  border-color: var(--primary-500);
  background: var(--primary-50);
  color: var(--primary-800);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.quick-action-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

/* Responsive adjustments */
@media (max-width: 992px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.sidebar-open {
    transform: translateX(0);
  }
  .app-main {
    margin-left: 0;
  }
  .header-search {
    display: none;
  }
}

/* SECURE FULLSCREEN KIOSK MODE STYLES */
body.kiosk-mode-active {
  overflow: hidden !important;
  background-color: #0f172a !important;
}
body.kiosk-mode-active .sidebar-custom,
body.kiosk-mode-active .app-sidebar,
body.kiosk-mode-active .header-custom,
body.kiosk-mode-active .app-header,
body.kiosk-mode-active footer {
  display: none !important;
}
body.kiosk-mode-active .app-main {
  margin-left: 0 !important;
  padding: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  min-height: 100vh !important;
}
body.kiosk-mode-active .page-content {
  padding: 0 !important;
  margin: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
}

