/* ==========================================================================
   SIMANIS - Sistem Informasi Manajemen Nilai Siswa
   SD Negeri 3 Bungu
   Modern Dashboard UI, Glassmorphism, Responsive Sidebar, Premium Aesthetics
   ========================================================================== */

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

:root {
  --sim-primary: #15803d;        /* Emerald Green */
  --sim-primary-dark: #0f5132;   /* Deep Green */
  --sim-primary-light: #22c55e;
  --sim-accent: #10b981;
  --sim-accent-soft: #ecfdf5;
  --sim-sidebar-bg: #0b3b24;     /* Dark Green Slate */
  --sim-sidebar-text: #e2e8f0;
  --sim-sidebar-hover: #14532d;
  --sim-sidebar-active: #15803d;
  --sim-bg: #f8fafc;
  --sim-card-bg: #ffffff;
  --sim-text: #1e293b;
  --sim-text-muted: #64748b;
  --sim-border: #e2e8f0;
  --sim-radius-sm: 8px;
  --sim-radius: 12px;
  --sim-radius-lg: 18px;
  --sim-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --sim-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --sim-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --sim-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  color: var(--sim-text);
  background-color: var(--sim-bg);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: var(--sim-primary);
  text-decoration: none;
  transition: var(--sim-transition);
}

a:hover {
  color: var(--sim-primary-dark);
}

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

/* Sidebar */
.sim-sidebar {
  width: 270px;
  background-color: var(--sim-sidebar-bg);
  color: var(--sim-sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1000;
  transition: var(--sim-transition);
  box-shadow: 4px 0 16px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
}

.sim-sidebar::-webkit-scrollbar {
  width: 6px;
}

.sim-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.sidebar-header {
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo-img {
  width: 44px;
  height: 44px;
  max-width: 46px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.25));
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #10b981, #059669);
  border-radius: var(--sim-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: white;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}

.sidebar-title h2 {
  font-size: 1.2rem;
  font-weight: 800;
  color: white;
  letter-spacing: 0.5px;
  margin: 0;
  line-height: 1.2;
}

.sidebar-title p {
  font-size: 0.72rem;
  color: #86efac;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 3px 0 0 0;
  line-height: 1.2;
  white-space: nowrap;
}

/* User Card in Sidebar */
.sidebar-user {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.15);
}

.sidebar-user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #15803d;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  border: 2px solid #34d399;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-user-info {
  overflow: hidden;
}

.sidebar-user-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.75rem;
  color: #6ee7b7;
  font-weight: 600;
  text-transform: uppercase;
}

/* Nav Menu in Sidebar */
.sidebar-nav {
  padding: 16px 12px;
  list-style: none;
  flex: 1;
}

.nav-heading {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 1px;
  padding: 12px 14px 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: #cbd5e1;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--sim-radius-sm);
  margin-bottom: 4px;
  transition: var(--sim-transition);
  white-space: nowrap;
}

.sidebar-link:hover {
  background: var(--sim-sidebar-hover);
  color: white;
  transform: translateX(3px);
}

.sidebar-link.active {
  background: var(--sim-sidebar-active);
  color: white;
  box-shadow: 0 4px 12px rgba(21, 128, 61, 0.4);
}

.sidebar-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar-link.active svg {
  opacity: 1;
}

.sidebar-badge {
  margin-left: auto;
  background: #ef4444;
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 50px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #f87171;
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(239, 68, 68, 0.12);
  padding: 8px 14px;
  border-radius: var(--sim-radius-sm);
  width: 100%;
  justify-content: center;
  transition: var(--sim-transition);
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */
.sim-main {
  margin-left: 270px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: var(--sim-transition);
}

/* Top Navbar */
.sim-topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--sim-border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--sim-shadow-sm);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--sim-text);
  cursor: pointer;
  padding: 6px;
}

.page-breadcrumb h1 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--sim-text);
  line-height: 1.2;
}

.page-breadcrumb p {
  font-size: 0.8rem;
  color: var(--sim-text-muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-portal-public {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--sim-primary);
  background: var(--sim-accent-soft);
  padding: 6px 14px;
  border-radius: var(--sim-radius-sm);
  border: 1px solid rgba(21, 128, 61, 0.2);
}

.btn-portal-public:hover {
  background: #dcfce7;
}

/* Container Body */
.sim-content {
  padding: 28px;
  flex: 1;
}

/* Alert Notification Banners */
.sim-alert {
  padding: 16px 20px;
  border-radius: var(--sim-radius);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.92rem;
  border: 1px solid transparent;
}

.sim-alert-warning {
  background-color: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.sim-alert-success {
  background-color: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.sim-alert-danger {
  background-color: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.sim-alert-info {
  background-color: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}

.sim-alert-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.sim-alert-content {
  flex: 1;
}

.sim-alert-content h4 {
  font-weight: 700;
  margin-bottom: 2px;
}

/* Stat Cards Grid */
.stat-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.sim-stat-card {
  background: var(--sim-card-bg);
  border-radius: var(--sim-radius);
  padding: 22px;
  border: 1px solid var(--sim-border);
  box-shadow: var(--sim-shadow-sm);
  display: flex;
  align-items: center;
  gap: 18px;
  transition: var(--sim-transition);
}

.sim-stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--sim-shadow);
  border-color: rgba(21, 128, 61, 0.3);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--sim-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.stat-icon-green {
  background: var(--sim-accent-soft);
  color: var(--sim-primary);
}

.stat-icon-blue {
  background: #eff6ff;
  color: #2563eb;
}

.stat-icon-amber {
  background: #fffbeb;
  color: #d97706;
}

.stat-icon-purple {
  background: #faf5ff;
  color: #9333ea;
}

.stat-info h3 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--sim-text);
  line-height: 1.2;
}

.stat-info p {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--sim-text-muted);
  margin-top: 2px;
}

/* Panels & Cards */
.sim-card {
  background: var(--sim-card-bg);
  border-radius: var(--sim-radius);
  border: 1px solid var(--sim-border);
  box-shadow: var(--sim-shadow-sm);
  margin-bottom: 28px;
  overflow: hidden;
}

.sim-card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--sim-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.sim-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--sim-text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sim-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sim-card-body {
  padding: 24px;
}

/* Data Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.sim-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.sim-table th {
  background: #f8fafc;
  padding: 12px 16px;
  font-weight: 700;
  color: #475569;
  border-bottom: 2px solid var(--sim-border);
  white-space: nowrap;
}

.sim-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--sim-border);
  color: var(--sim-text);
  vertical-align: middle;
}

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

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-info    { background: #e0e7ff; color: #4338ca; }
.badge-gray    { background: #f1f5f9; color: #475569; }

/* Buttons */
.btn-sim {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--sim-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--sim-transition);
}

.btn-sim-primary {
  background: var(--sim-primary);
  color: white;
}

.btn-sim-primary:hover {
  background: var(--sim-primary-dark);
  color: white;
}

.btn-sim-secondary {
  background: white;
  border-color: var(--sim-border);
  color: var(--sim-text);
}

.btn-sim-secondary:hover {
  background: #f1f5f9;
}

.btn-sim-danger {
  background: #ef4444;
  color: white;
}

.btn-sim-danger:hover {
  background: #dc2626;
  color: white;
}

.btn-sim-excel {
  background: #107c41;
  color: white;
}

.btn-sim-excel:hover {
  background: #0b592e;
  color: white;
}

.btn-sim-pdf {
  background: #b91c1c;
  color: white;
}

.btn-sim-pdf:hover {
  background: #991b1b;
  color: white;
}

.btn-sim-sm {
  padding: 4px 10px;
  font-size: 0.78rem;
  border-radius: 6px;
}

/* Forms */
.form-group {
  margin-bottom: 18px;
}

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

.form-control {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1px solid var(--sim-border);
  border-radius: var(--sim-radius-sm);
  background: white;
  color: var(--sim-text);
  transition: var(--sim-transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--sim-primary);
  box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.15);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* Modal Dialog */
.sim-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.sim-modal-overlay.active {
  display: flex;
}

.sim-modal {
  background: white;
  border-radius: var(--sim-radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--sim-shadow-lg);
  border: 1px solid var(--sim-border);
  animation: modalFadeIn 0.25s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

.sim-modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--sim-text);
}

.sim-modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--sim-text-muted);
}

.sim-modal-body {
  padding: 24px;
}

.sim-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--sim-border);
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-bottom-left-radius: var(--sim-radius-lg);
  border-bottom-right-radius: var(--sim-radius-lg);
}

/* Responsive */
@media (max-width: 1024px) {
  .sim-sidebar {
    transform: translateX(-100%);
  }
  .sim-sidebar.mobile-active {
    transform: translateX(0);
  }
  .sim-main {
    margin-left: 0;
  }
  .btn-sidebar-toggle {
    display: block;
  }
}

@media (max-width: 768px) {
  .form-grid-2, .form-grid-3 {
    grid-template-columns: 1fr;
  }
  .sim-content {
    padding: 16px;
  }
  .sim-topbar {
    padding: 12px 16px;
  }
}
