/**
 * CBT MA BAHRUL ULUM KEPOHBARU
 * Theme: Modern Professional – Education Technology
 * File: theme.css
 * Tahap 04/20: Layout, Sidebar, Topbar, Dashboard, Navigasi Mobile
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Poppins:wght@400;500;600;700&family=Amiri:ital,wght@0,400;0,700;1,400&family=Noto+Naskh+Arabic:wght@400;600;700&display=swap');

:root {
  /* Palet Warna Utama CBT MA Bahrul Ulum (Islamic Emerald, Navy, Gold) */
  --cbt-navy: #123B68;
  --cbt-navy-dark: #0D2B4D;
  --cbt-navy-light: #1D508D;
  --cbt-teal: #087E8B;
  --cbt-teal-dark: #06606A;
  --cbt-teal-light: #0BB1C4;
  --cbt-emerald: #1B5E20;
  --cbt-emerald-light: #2E7D32;
  --cbt-gold: #F2B544;
  --cbt-gold-dark: #D49B28;
  --cbt-gold-light: #F7CB77;

  /* Background & Surface */
  --cbt-bg: #F3F6FA;
  --cbt-surface: #FFFFFF;
  --cbt-surface-subtle: #F8FAFD;
  --cbt-border: #E2E8F0;
  --cbt-border-focus: #087E8B;

  /* Tipografi & Kontras Teks */
  --cbt-text-primary: #1E293B;
  --cbt-text-secondary: #64748B;
  --cbt-text-muted: #94A3B8;
  --cbt-text-inverse: #FFFFFF;

  /* State Alerts */
  --cbt-success: #16A36A;
  --cbt-warning: #E9A23B;
  --cbt-danger: #D94B50;
  --cbt-info: #0284C7;

  /* Dimensi & Layout */
  --sidebar-width: 260px;
  --topbar-height: 64px;
  --mobile-bottom-height: 60px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Efek Bayangan Lembut */
  --shadow-xs: 0 1px 2px rgba(18, 59, 104, 0.04);
  --shadow-sm: 0 2px 6px rgba(18, 59, 104, 0.06);
  --shadow-md: 0 6px 16px rgba(18, 59, 104, 0.08);
  --shadow-lg: 0 12px 28px rgba(18, 59, 104, 0.12);

  /* Transisi */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* Dark Mode Variables */
[data-theme="dark"] {
  --cbt-bg: #0F172A;
  --cbt-surface: #1E293B;
  --cbt-surface-subtle: #182234;
  --cbt-border: #334155;
  --cbt-border-focus: #38BDF8;
  --cbt-text-primary: #F1F5F9;
  --cbt-text-secondary: #94A3B8;
  --cbt-text-muted: #64748B;
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.4);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--cbt-bg);
  color: var(--cbt-text-primary);
  min-height: 100vh;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Font Kaligrafi & Bahasa Arab */
.arabic-text {
  font-family: 'Amiri', 'Noto Naskh Arabic', serif;
  direction: rtl;
  text-align: right;
  line-height: 1.8;
}

/* Layout Wrapper Structure */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
  position: relative;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--cbt-bg);
  transition: margin-left var(--transition-normal);
}

@media (min-width: 992px) {
  .main-content {
    margin-left: var(--sidebar-width);
  }
}

.page-container {
  flex: 1;
  padding: 1.5rem;
  max-width: 1600px;
  width: 100%;
}

@media (max-width: 768px) {
  .page-container {
    padding: 1rem 0.75rem 5rem 0.75rem; /* space for mobile bottom nav */
  }
}

/* Sidebar Styling */
.cbt-sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--cbt-navy-dark) 0%, var(--cbt-navy) 60%, #0a3d24 100%);
  color: var(--cbt-text-inverse);
  z-index: 1040;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 16px rgba(0, 0, 0, 0.15);
  transition: transform var(--transition-normal);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

@media (max-width: 991.98px) {
  .cbt-sidebar {
    transform: translateX(-100%);
  }
  .cbt-sidebar.show-mobile {
    transform: translateX(0);
  }
}

.cbt-sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1035;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.cbt-sidebar-backdrop.show-backdrop {
  opacity: 1;
  visibility: visible;
}

.cbt-sidebar-header {
  padding: 1.25rem 1rem;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  gap: 0.75rem;
}

.cbt-sidebar-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.cbt-sidebar-title {
  font-family: 'Poppins', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.5px;
  color: #FFFFFF;
}

.cbt-sidebar-subtitle {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--cbt-gold);
  margin: 0;
  letter-spacing: 0.5px;
}

.cbt-sidebar-nav {
  list-style: none;
  padding: 0.75rem 0.5rem;
  margin: 0;
  flex: 1;
}

.cbt-nav-heading {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.45);
  padding: 0.75rem 0.75rem 0.25rem 0.75rem;
  font-weight: 700;
}

.cbt-nav-item {
  margin-bottom: 0.2rem;
}

.cbt-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.cbt-nav-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
  transform: translateX(3px);
}

.cbt-nav-link.active {
  background: linear-gradient(90deg, rgba(8, 126, 139, 0.8) 0%, rgba(27, 94, 32, 0.8) 100%);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.cbt-nav-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cbt-sidebar-footer {
  padding: 0.85rem;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-status-card {
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Topbar Styling */
.cbt-topbar {
  height: var(--topbar-height);
  background-color: var(--cbt-surface);
  border-bottom: 1px solid var(--cbt-border);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1020;
  transition: all var(--transition-fast);
}

/* Mobile Bottom Navigation Bar */
.cbt-mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-bottom-height);
  background-color: var(--cbt-surface);
  border-top: 1px solid var(--cbt-border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 1030;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--cbt-text-secondary);
  font-size: 0.68rem;
  padding: 0.25rem 0.5rem;
  flex: 1;
  text-align: center;
  transition: color var(--transition-fast);
}

.mobile-nav-item i {
  font-size: 1.25rem;
  margin-bottom: 1px;
}

.mobile-nav-item.active {
  color: var(--cbt-teal);
  font-weight: 600;
}

.mobile-nav-item:hover {
  color: var(--cbt-navy);
}

/* Cards & Components */
.card-cbt {
  background: var(--cbt-surface);
  border: 1px solid var(--cbt-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
  transition: box-shadow var(--transition-fast);
}

.card-cbt-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--cbt-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-cbt-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: var(--cbt-text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-cbt-body {
  padding: 1.25rem;
}

/* Buttons CBT */
.btn-cbt-primary {
  background-color: var(--cbt-navy);
  color: #FFFFFF;
  border: 1px solid var(--cbt-navy);
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.btn-cbt-primary:hover {
  background-color: var(--cbt-navy-dark);
  color: #FFFFFF;
  border-color: var(--cbt-navy-dark);
}

.btn-cbt-gold {
  background-color: var(--cbt-gold);
  color: #123B68;
  border: 1px solid var(--cbt-gold);
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.btn-cbt-gold:hover {
  background-color: var(--cbt-gold-dark);
  color: #FFFFFF;
  border-color: var(--cbt-gold-dark);
}

.btn-cbt-teal {
  background-color: var(--cbt-teal);
  color: #FFFFFF;
  border: 1px solid var(--cbt-teal);
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.btn-cbt-teal:hover {
  background-color: var(--cbt-teal-dark);
  color: #FFFFFF;
}

.btn-cbt-outline {
  background-color: transparent;
  color: var(--cbt-navy);
  border: 1px solid var(--cbt-border);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.btn-cbt-outline:hover {
  background-color: rgba(18, 59, 104, 0.05);
  border-color: var(--cbt-navy);
  color: var(--cbt-navy);
}

/* Badges CBT */
.badge-cbt {
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.badge-cbt-navy { background-color: rgba(18, 59, 104, 0.1); color: var(--cbt-navy); }
.badge-cbt-teal { background-color: rgba(8, 126, 139, 0.1); color: var(--cbt-teal); }
.badge-cbt-success { background-color: rgba(22, 163, 106, 0.1); color: var(--cbt-success); }
.badge-cbt-warning { background-color: rgba(242, 181, 68, 0.18); color: #B37D16; }
.badge-cbt-danger { background-color: rgba(217, 75, 80, 0.1); color: var(--cbt-danger); }

/* Avatar Circles */
.avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--cbt-gold);
  color: var(--cbt-navy-dark);
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.avatar-circle-sm {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--cbt-navy);
  color: #FFFFFF;
  font-weight: 600;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Live Status Pulse Animation */
.status-dot-pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--cbt-success);
  box-shadow: 0 0 0 0 rgba(22, 163, 106, 0.7);
  animation: pulse-green 1.8s infinite;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(22, 163, 106, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(22, 163, 106, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(22, 163, 106, 0); }
}

.border-white-10 { border-color: rgba(255, 255, 255, 0.1) !important; }
.bg-black-20 { background-color: rgba(0, 0, 0, 0.2) !important; }
.text-emerald { color: #2E7D32 !important; }
