body {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Poppins', sans-serif;
  height: 100%;
}

html {
  height: 100%;
}

* {
  box-sizing: border-box;
}

.gradient-bg {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
  transition: all 0.3s ease;
}

.card:hover {
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.input-field {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.3s ease;
  font-family: inherit;
}

.input-field:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 14px 32px;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: white;
  color: #667eea;
  padding: 14px 32px;
  border-radius: 8px;
  border: 2px solid #667eea;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.btn-secondary:hover {
  background: #667eea;
  color: white;
  transform: translateY(-2px);
}

.btn-danger {
  background: #ef4444;
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
}

.btn-danger:hover {
  background: #dc2626;
}

.nav-link {
  color: white;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 6px;
  transition: all 0.3s ease;
  font-weight: 500;
  cursor: pointer;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.2);
}

.nav-link.active {
  background: rgba(255, 255, 255, 0.3);
  font-weight: 600;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.stats-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 24px;
  border-radius: 12px;
  text-align: center;
}

.archive-item {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.archive-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: #667eea;
}

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, .3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #6b7280;
}

.empty-state svg {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  opacity: 0.5;
}

.image-upload-box {
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #f8fafc;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden; /* Pastikan imej tidak melimpah */
}

.image-upload-box:hover {
  border-color: #667eea;
  background: #f0f4ff;
}

.thumbnail {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
}

.preview-report {
  background: white;
  padding: 0; /* Padam padding asal */
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  font-family: Arial, sans-serif;
  line-height: 1.6;
  overflow: hidden; /* Pastikan border-radius berfungsi */
}

.preview-header {
  /* Buang border-left dan margin-bottom */
  /* border-left: 4px solid #667eea; */
  /* margin-bottom: 30px; */
  
  /* Ganti padding-left dengan padding penuh */
  padding: 20px 40px;
  
  /* Tambah warna latar belakang (default) */
  background-color: #667eea;
}

/* KEMAS KINI: Gaya untuk kandungan header (Logo + Teks) */
.preview-header-content {
  display: flex;
  align-items: center;
  gap: 20px; /* Jarak antara logo dan teks */
}

.preview-logo {
  width: 70px;
  height: 70px;
  object-fit: contain;
  background-color: white; /* Latar belakang putih */
  border-radius: 8px;     /* Sudut bulat */
  padding: 5px;           /* Padding dalaman */
  flex-shrink: 0; /* Elak logo mengecut */
  box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Bayang kecil */
}

.preview-header-text {
  flex-grow: 1; /* Teks ambil baki ruang */
}
/* (Tamat kemas kini) */


.preview-title {
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 8px;
  color: #FFFFFF; /* Tukar warna teks default ke putih */
}

.preview-school {
  color: rgba(255, 255, 255, 0.85); /* Tukar warna teks ke putih pudar */
  font-size: 14px;
}

.preview-info-grid {
  background: #f9f9f9;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.preview-info-item {
  margin-bottom: 12px;
}
/* Menghilangkan margin-bottom pada item terakhir */
.preview-info-item:last-child {
  margin-bottom: 0;
}

.preview-info-label {
  font-size: 12px;
  color: #666;
  font-weight: bold;
}

.preview-info-value {
  font-weight: 600;
}

.preview-section {
  margin-bottom: 20px;
}

.preview-section-title {
  font-size: 16px;
  font-weight: bold;
  border-bottom: 2px solid #667eea;
  padding-bottom: 4px;
  margin-bottom: 8px;
}

/* Pastikan perenggan memaparkan baris baru */
.preview-section p {
  white-space: pre-wrap;
}


.preview-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 2px solid #eee;
}

/* Wrapper baru untuk kandungan di bawah header */
.preview-content-wrapper {
  padding: 40px;
}

.preview-images {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 12px;
}

.preview-image {
  width: 100%;
  max-width: 280px;
  height: 180px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Penyesuaian kedudukan imej */
.preview-images.position-left {
  justify-content: flex-start;
}
.preview-images.position-right {
  justify-content: flex-end;
}
.preview-images.position-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.preview-images.position-grid .preview-image {
  width: 100%;
  max-width: none;
  height: 150px; /* Saiz lebih kecil untuk grid */
}


.customize-panel {
  background: #f8fafc;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 20px;
}

.color-picker-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.color-picker {
  width: 60px;
  height: 40px;
  border: 2px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
}

.slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: #e5e7eb;
  outline: none;
  cursor: pointer;
}

@media (max-width: 768px) {
  .btn-primary,
  .btn-secondary {
    width: 100%;
  }

  .nav-link {
    padding: 6px 12px;
    font-size: 14px;
  }

  .preview-report {
    padding: 20px;
  }
}