/* =========================================
   1. GLOBAL & RESET
========================================= */
:root {
  --primary-dark: #5b21b6;
  --sidebar-width: 260px;
  --header-height: 60px;
}

body {
  font-family: "Poppins", sans-serif;
}

/* =========================================
   2. LOGIN PAGE - MODERN GLASSMORPHISM DESIGN
========================================= */
.login-body {
  background: #0f0c29;
  background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  position: relative;
  overflow: hidden;
  font-family: "Poppins", sans-serif;
}

/* Animated Background with Gradient Orbs */
.login-bg-animation {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  overflow: hidden;
  z-index: 1;
}

.gradient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  animation: float 20s infinite ease-in-out;
}

.orb-1 {
  width: 400px;
  height: 400px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  top: -10%;
  left: -10%;
  animation-delay: 0s;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  bottom: -15%;
  right: -10%;
  animation-delay: 5s;
}

.orb-3 {
  width: 350px;
  height: 350px;
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: 10s;
}

@keyframes float {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(30px, -50px) scale(1.1);
  }
  66% {
    transform: translate(-20px, 20px) scale(0.9);
  }
}

/* Login Container */
.login-container {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 450px;
  animation: slideIn 0.8s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Glassmorphism Card */
.login-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 3rem 2.5rem;
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
  border: 1px solid rgba(255, 255, 255, 0.18);
  transition: all 0.3s ease;
}

.login-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 48px 0 rgba(31, 38, 135, 0.5);
}

/* Login Header */
.login-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.logo-wrapper {
  position: relative;
  display: inline-block;
  margin-bottom: 1.5rem;
  animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

.logo-wrapper img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  object-fit: cover;
  transition: all 0.3s ease;
}

.logo-wrapper:hover img {
  transform: scale(1.05);
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.login-header h3 {
  color: #ffffff;
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  letter-spacing: -0.5px;
}

.login-header .subtitle {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.95rem;
  margin: 0;
  font-weight: 400;
}

/* Alert Error */
.alert-error {
  background: rgba(239, 68, 68, 0.2);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fecaca;
  padding: 1rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-10px);
  }
  75% {
    transform: translateX(10px);
  }
}

.alert-error i {
  font-size: 1.2rem;
}

/* Login Form */
.login-form {
  margin-bottom: 1.5rem;
}

.input-group {
  margin-bottom: 1.5rem;
}

.input-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  letter-spacing: 0.3px;
}

.input-group label i {
  font-size: 1rem;
  opacity: 0.8;
}

.input-group input {
  width: 100%;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  color: #ffffff;
  font-size: 1rem;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  box-sizing: border-box;
}

.input-group input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.input-group input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(147, 51, 234, 0.8);
  box-shadow: 0 0 0 4px rgba(147, 51, 234, 0.2);
  transform: translateY(-2px);
}

/* Login Button */
.btn-login {
  width: 100%;
  padding: 1.1rem 2rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.5px;
}

.btn-login::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transition: left 0.5s ease;
}

.btn-login:hover::before {
  left: 100%;
}

.btn-login:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.btn-login:active {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-login i {
  transition: transform 0.3s ease;
}

.btn-login:hover i {
  transform: translateX(5px);
}

/* Login Footer */
.login-footer {
  text-align: center;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.back-link {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  padding: 0.5rem 1rem;
  border-radius: 8px;
}

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

.back-link i {
  transition: transform 0.3s ease;
}

.back-link:hover i {
  transform: translateX(-3px);
}

/* Responsive Design */
@media (max-width: 600px) {
  .login-card {
    padding: 2rem 1.5rem;
  }

  .login-header h3 {
    font-size: 1.6rem;
  }

  .logo-wrapper img {
    width: 80px;
    height: 80px;
  }

  .gradient-orb {
    filter: blur(60px);
  }
}

/* =========================================
   3. DASHBOARD LAYOUT
========================================= */
.admin-wrapper {
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Sidebar Styling */
.sidebar {
  width: var(--sidebar-width);
  background: var(--primary-dark);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  z-index: 1000;
  transition: all 0.3s ease;
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-header h3 {
  font-size: 1.1rem;
  color: white;
  margin: 0;
  font-weight: 700;
}

.sidebar-menu {
  list-style: none;
  padding: 1rem;
  margin: 0;
  overflow-y: auto;
}

.sidebar-menu li {
  margin-bottom: 0.5rem;
}

.sidebar-menu a {
  display: flex;
  align-items: center;
  padding: 0.8rem 1rem;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.3s;
  gap: 12px;
  font-size: 0.95rem;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

/* Main Content Styling */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  background: #f8fafc;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  width: 100%;
}

/* Topbar Styling */
.topbar {
  background: white;
  height: var(--header-height);
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 900;
}

/* Tombol Burger (Hidden by default on Desktop) */
.toggle-btn {
  display: none !important;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #5b21b6;
  cursor: pointer;
  padding: 0;
}

.content-body {
  padding: 1.5rem;
}

/* Stat Cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}
.stat-card {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
  flex-shrink: 0;
}
.bg-purple {
  background: #8b5cf6;
}
.bg-green {
  background: #10b981;
}
.bg-blue {
  background: #3b82f6;
}

/* Overlay Gelap untuk Mobile saat menu terbuka */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
}
.sidebar-overlay.active {
  display: block;
}

/* =========================================
   4. RESPONSIVE MODULE HEADER (FIX RAPI)
========================================= */
.module-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.module-header h2 {
  margin: 0;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* =========================================
   5. TABLE BEAUTIFICATION (DESKTOP)
========================================= */
.certificate-table th {
  background: #f3f4f6;
  color: #374151;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  border-bottom: 2px solid #e5e7eb;
  padding: 12px 15px;
}

.certificate-table td {
  vertical-align: middle !important;
  padding: 12px 15px;
  color: #4b5563;
  border-bottom: 1px solid #f3f4f6;
}

.certificate-table img {
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e7eb;
}

.table-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  transition: all 0.2s;
  margin-right: 5px;
}

.table-action-btn:hover {
  transform: translateY(-2px);
}

/* =========================================
   6. MEDIA QUERIES (RESPONSIVE MAGIC)
   Semua aturan Mobile dikumpulkan di sini
========================================= */
/* =========================================
   6. MEDIA QUERIES (RESPONSIVE MAGIC)
   Semua aturan Mobile dikumpulkan di sini
========================================= */
@media (max-width: 768px) {
  /* Sembunyikan Sidebar ke kiri layar */
  .sidebar {
    left: -260px;
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
  }

  /* Munculkan Sidebar saat class .active ditambahkan via JS */
  .sidebar.active {
    left: 0;
  }

  /* Konten jadi lebar penuh */
  .main-content {
    margin-left: 0;
    width: 100%;
  }

  /* Munculkan tombol burger menu */
  .toggle-btn {
    display: flex !important; /* Paksa muncul di Mobile */
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  }

  /* Penyesuaian Padding di Mobile */
  .content-body {
    padding: 1rem;
  }

  /* Penyesuaian Tabel agar bisa discroll */
  .table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
  }

  .certificate-table {
    min-width: 800px; /* Paksa lebar minimum agar scroll muncul */
  }

  /* Adjust Stat Cards Grid */
  .stat-grid {
    grid-template-columns: 1fr; /* 1 kolom di HP */
  }

  /* Topbar Adjustments */
  .topbar {
    padding: 0 1rem;
  }

  .topbar h4 {
    font-size: 0.9rem !important;
  }
}

@media (max-width: 600px) {
  /* Module Header Stack ke Bawah di HP Kecil */
  .module-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    background: white;
    padding: 1.25rem;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
  }

  .module-header h2 {
    font-size: 1.25rem;
    justify-content: center;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
  }

  .module-header .btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
  }

  /* Modal Responsiveness */
  #importModal .card {
    width: 95% !important;
    max-height: 90vh;
    overflow-y: auto;
  }

  /* Login Page Mobile */
  .login-card {
    padding: 2rem 1.5rem;
    margin: 1rem;
  }

  .login-header h3 {
    font-size: 1.5rem;
  }
}
