/* ============================================================
   emtulearning — Global Stylesheet
   Design tokens, reset, utilities, komponen reusable
   ============================================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');

/* --- Design Tokens --- */
:root {
  --yellow:      #FFD600;
  --yellow-dark: #E6C000;
  --yellow-light:#FFF9CC;
  --black:       #1A1A1A;
  --gray-dark:   #4A4A4A;
  --gray:        #6B6B6B;
  --gray-mid:    #ADADAD;
  --gray-light:  #E8E8E8;
  --bg:          #F5F6FA;
  --white:       #FFFFFF;
  --danger:      #E53E3E;
  --success:     #38A169;
  --warning:     #D69E2E;
  --info:        #3182CE;

  --radius-sm:   8px;
  --radius:      12px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-full: 9999px;

  --shadow-sm:   0 1px 4px rgba(0,0,0,0.06);
  --shadow:      0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.12);

  --sidebar-w:   240px;
  --navbar-h:    64px;
  --transition:  0.2s ease;

  --font:        'Poppins', sans-serif;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--black);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: var(--font); }
input, textarea, select { font-family: var(--font); }

/* --- Typography --- */
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.375rem; font-weight: 700; }
h3 { font-size: 1.125rem; font-weight: 600; }
h4 { font-size: 1rem;     font-weight: 600; }
p  { font-size: 0.9375rem; color: var(--gray-dark); }
small { font-size: 0.8125rem; color: var(--gray); }

/* --- Layout: App Shell --- */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--gray-light);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-brand {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-light);
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.sidebar-brand .logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--black);
  letter-spacing: -0.5px;
}

.sidebar-brand .logo-text span {
  color: var(--yellow);
  background: var(--black);
  padding: 0 4px;
  border-radius: 4px;
}

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

.nav-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--gray-mid);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0.5rem 1.5rem;
  margin-top: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1.5rem;
  color: var(--gray-dark);
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  position: relative;
}

.nav-item:hover {
  background: var(--yellow-light);
  color: var(--black);
}

.nav-item.active {
  background: var(--yellow-light);
  color: var(--black);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--yellow);
  border-radius: 0 4px 4px 0;
}

.nav-item i { width: 20px; text-align: center; font-size: 1rem; }

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--gray-light);
}

/* --- Topbar/Navbar --- */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--navbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 99;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--black);
}

.hamburger {
  display: none;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 1.25rem;
  color: var(--gray-dark);
}

.hamburger:hover { background: var(--gray-light); }

/* --- Main Content Area --- */
.main-content {
  margin-left: var(--sidebar-w);
  padding-top: var(--navbar-h);
  flex: 1;
  min-height: 100vh;
}

.page-content {
  padding: 1.75rem;
  max-width: 1200px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--font);
  transition: all var(--transition);
  cursor: pointer;
  border: 2px solid transparent;
  white-space: nowrap;
}

.btn-primary {
  background: var(--yellow);
  color: var(--black);
  border-color: var(--yellow);
}

.btn-primary:hover {
  background: var(--yellow-dark);
  border-color: var(--yellow-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 214, 0, 0.4);
}

.btn-dark {
  background: var(--black);
  color: var(--white);
  border-color: var(--black);
}

.btn-dark:hover {
  background: var(--gray-dark);
  border-color: var(--gray-dark);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--black);
  border-color: var(--gray-light);
}

.btn-outline:hover {
  background: var(--gray-light);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
  border-color: var(--danger);
}

.btn-danger:hover {
  background: #c53030;
  border-color: #c53030;
}

.btn-sm { padding: 0.4rem 0.875rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.875rem 1.75rem; font-size: 1rem; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* --- Cards --- */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

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

.card-header h3 { font-size: 1rem; font-weight: 700; }

/* --- Class Card --- */
.class-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
}

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

.class-card-banner {
  height: 96px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  overflow: hidden;
}

.class-card-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.25);
}

.class-card-banner h3,
.class-card-banner small {
  position: relative;
  z-index: 1;
  color: var(--white);
  line-height: 1.3;
}

.class-card-banner small { opacity: 0.9; }

.class-card-body {
  padding: 1rem 1.25rem;
}

.class-card-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--gray-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* --- Avatar --- */
.avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: var(--yellow);
  color: var(--black);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 28px; height: 28px; font-size: 0.625rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1rem; }
.avatar-xl { width: 80px; height: 80px; font-size: 1.5rem; }

/* --- Form Elements --- */
.form-group { margin-bottom: 1.125rem; }

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-dark);
  margin-bottom: 0.375rem;
}

.form-control {
  display: block;
  width: 100%;
  padding: 0.7rem 1rem;
  border: 2px solid var(--gray-light);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-family: var(--font);
  color: var(--black);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px rgba(255, 214, 0, 0.2);
}

.form-control::placeholder { color: var(--gray-mid); }

textarea.form-control { resize: vertical; min-height: 100px; }

select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B6B6B' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 1rem center; padding-right: 2.5rem; }

.form-error { font-size: 0.8125rem; color: var(--danger); margin-top: 0.25rem; }
.form-hint  { font-size: 0.8125rem; color: var(--gray); margin-top: 0.25rem; }

/* --- Badge --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-yellow  { background: var(--yellow-light); color: #856404; }
.badge-success { background: #C6F6D5; color: #276749; }
.badge-danger  { background: #FED7D7; color: #9B2C2C; }
.badge-gray    { background: var(--gray-light); color: var(--gray-dark); }
.badge-dark    { background: var(--black); color: var(--white); }

/* --- Alert / Flash --- */
.alert {
  padding: 0.875rem 1.125rem;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 1rem;
}

.alert-success { background: #C6F6D5; color: #276749; }
.alert-error   { background: #FED7D7; color: #9B2C2C; }
.alert-warning { background: #FEFCBF; color: #7B6D00; }
.alert-info    { background: #BEE3F8; color: #2A4E6C; }

/* --- Divider --- */
.divider {
  border: none;
  border-top: 1px solid var(--gray-light);
  margin: 1.25rem 0;
}

/* --- Icon Button --- */
.icon-btn {
  width: 36px; height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--gray-dark);
  font-size: 1rem;
  transition: background var(--transition), color var(--transition);
  position: relative;
}

.icon-btn:hover { background: var(--gray-light); color: var(--black); }

.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--white);
}

/* --- Stats Card --- */
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

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

.stat-icon.yellow { background: var(--yellow-light); color: var(--black); }
.stat-icon.dark   { background: var(--black); color: var(--yellow); }
.stat-icon.success{ background: #C6F6D5; color: #276749; }
.stat-icon.danger { background: #FED7D7; color: #9B2C2C; }

.stat-info p { font-size: 0.8125rem; color: var(--gray); margin-bottom: 0.125rem; }
.stat-info h2 { font-size: 1.625rem; font-weight: 700; color: var(--black); }

/* --- Grid --- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }

/* --- Flex Utilities --- */
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between{ display: flex; align-items: center; justify-content: space-between; }
.items-center{ align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* --- Spacing Utilities --- */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* --- Text Utilities --- */
.text-gray   { color: var(--gray); }
.text-danger { color: var(--danger); }
.text-success{ color: var(--success); }
.text-muted  { color: var(--gray-mid); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--gray);
}

.empty-state i {
  font-size: 3rem;
  color: var(--gray-light);
  margin-bottom: 1rem;
}

.empty-state h3 { font-size: 1rem; color: var(--gray-dark); margin-bottom: 0.375rem; }

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  transform: translateY(16px);
  transition: transform var(--transition);
}

.modal-overlay.open .modal { transform: translateY(0); }

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

.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--gray-light); display: flex; gap: 0.75rem; justify-content: flex-end; }

/* --- Dropdown --- */
.dropdown { position: relative; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-light);
  min-width: 180px;
  z-index: 150;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition);
}

.dropdown-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.7rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-dark);
  transition: background var(--transition);
}

.dropdown-item:hover { background: var(--bg); color: var(--black); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: #FED7D7; }
.dropdown-divider { border-top: 1px solid var(--gray-light); margin: 0.25rem 0; }

/* --- Overlay sidebar mobile --- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 150;
}
.sidebar-overlay.open {
  display: block;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 200;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open { transform: translateX(0); }

  .topbar { left: 0; }
  .hamburger { display: inline-flex; }

  .main-content { margin-left: 0; }

  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }

  .page-content { padding: 1rem; }
}

@media (max-width: 480px) {
  .grid-4 { grid-template-columns: 1fr; }
}

@keyframes wiggle {
  0%, 10% { transform: rotate(0deg); }
  15% { transform: rotate(-15deg); }
  20% { transform: rotate(10deg); }
  25% { transform: rotate(-10deg); }
  30% { transform: rotate(5deg); }
  35%, 100% { transform: rotate(0deg); }
}