/**
 * CSS Styles untuk Sistem Absensi Siswa SMP
 */

/* Reset dan Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

/* Page Management */
.page {
  display: none;
  min-height: 100vh;
}

.page.active {
  display: block;
}

/* Login Page Styles */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 2rem;
}

.login-card {
  background: white;
  border-radius: 1rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  padding: 3rem;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-icon {
  margin-bottom: 2rem;
}

.graduation-cap {
  width: 4rem;
  height: 4rem;
  color: #3b82f6;
}

.login-card h1 {
  font-size: 1.875rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: #6b7280;
  margin-bottom: 2rem;
  font-size: 0.875rem;
}

.form-group {
  margin-bottom: 1.5rem;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #374151;
  font-size: 0.875rem;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.error-message {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 0.75rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  display: none;
}

.login-card button {
  width: 100%;
  background: #3b82f6;
  color: white;
  border: none;
  padding: 0.875rem 1rem;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
  margin-bottom: 1.5rem;
}

.login-card button:hover {
  background: #2563eb;
}

.login-card button:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.demo-credentials {
  background: #f3f4f6;
  padding: 1rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  color: #6b7280;
}

/* Header Styles */
.header {
  background: white;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.header-icon {
  width: 2.5rem;
  height: 2.5rem;
  color: #3b82f6;
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.25rem;
}

.header p {
  color: #6b7280;
  font-size: 0.875rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.current-time {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #6b7280;
  font-size: 0.875rem;
}

.clock-icon {
  width: 1rem;
  height: 1rem;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #ef4444;
  color: white;
  text-decoration: none;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  transition: background-color 0.2s;
}

.logout-btn:hover {
  background: #dc2626;
}

.logout-btn svg {
  width: 1rem;
  height: 1rem;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #6b7280;
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.back-btn:hover {
  background: #4b5563;
}

.back-btn svg {
  width: 1rem;
  height: 1rem;
}

/* Dashboard Styles */
.dashboard-main {
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.dashboard-card {
  background: white;
  border-radius: 1rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  padding: 2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border-left: 4px solid transparent;
}

.dashboard-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.dashboard-card.green {
  border-left-color: #16a34a;
}

.dashboard-card.blue {
  border-left-color: #3b82f6;
}

.dashboard-card.orange {
  border-left-color: #ea580c;
}

.dashboard-card.purple {
  border-left-color: #8b5cf6;
}

.dashboard-card.indigo {
  border-left-color: #6366f1;
}

.dashboard-card.teal {
  border-left-color: #0d9488;
}

.dashboard-card.red {
  border-left-color: #dc2626;
}

.card-header {
  margin-bottom: 1.5rem;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.card-title span {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
}

.card-icon {
  width: 1.5rem;
  height: 1.5rem;
  color: #6b7280;
}

.card-header p {
  color: #6b7280;
  font-size: 0.875rem;
  line-height: 1.5;
}

.card-content {
  display: flex;
  justify-content: center;
}

.card-button {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  color: white;
}

.card-button.green {
  background: #16a34a;
}

.card-button.green:hover {
  background: #15803d;
}

.card-button.blue {
  background: #3b82f6;
}

.card-button.blue:hover {
  background: #2563eb;
}

.card-button.orange {
  background: #ea580c;
}

.card-button.orange:hover {
  background: #c2410c;
}

.card-button.purple {
  background: #8b5cf6;
}

.card-button.purple:hover {
  background: #7c3aed;
}

.card-button.indigo {
  background: #6366f1;
}

.card-button.indigo:hover {
  background: #4f46e5;
}

.card-button.teal {
  background: #0d9488;
}

.card-button.teal:hover {
  background: #0f766e;
}

.card-button.red {
  background: #dc2626;
}

.card-button.red:hover {
  background: #b91c1c;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  background: white;
  border-radius: 0.75rem;
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.stat-header {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.stat-value.blue {
  color: #3b82f6;
}

.stat-value.green {
  color: #16a34a;
}

.stat-value.orange {
  color: #ea580c;
}

/* Form Styles */
.form-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.form-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 0.5rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.form-btn svg {
  width: 1.25rem;
  height: 1.25rem;
}

.form-btn.primary {
  background: #3b82f6;
  color: white;
}

.form-btn.primary:hover {
  background: #2563eb;
}

.form-btn.secondary {
  background: #f3f4f6;
  color: #374151;
}

.form-btn.secondary:hover {
  background: #e5e7eb;
}

.form-btn.green {
  background: #16a34a;
  color: white;
}

.form-btn.green:hover {
  background: #15803d;
}

.form-btn.purple {
  background: #8b5cf6;
  color: white;
}

.form-btn.purple:hover {
  background: #7c3aed;
}

/* Message Styles */
.message {
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  display: none;
}

.message.success {
  background: #dcfce7;
  border: 1px solid #16a34a;
  color: #15803d;
}

.message.error {
  background: #fef2f2;
  border: 1px solid #dc2626;
  color: #dc2626;
}

.message.info {
  background: #dbeafe;
  border: 1px solid #3b82f6;
  color: #1d4ed8;
}

/* Loading Animation */
.loading {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Perbaikan Layout untuk Semua Halaman */
.qrcode-form-content,
.qrcode-display-content,
.students-content,
.download-content,
.backup-content,
.restore-content {
  padding: 1.5rem;
}

/* Card Header Styles yang Konsisten */
.card-header {
  padding: 1.5rem 1.5rem 0 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 0;
}

.card-header:last-child {
  border-bottom: none;
}

/* Perbaikan Grid Layout */
.qrcode-grid,
.backup-grid {
  align-items: start;
}

/* Perbaikan Students List */
.students-list-content {
  padding: 0;
}

.students-content {
  padding: 0;
}

/* Perbaikan Form Layout */
.form-group {
  margin-bottom: 1rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

/* Perbaikan Download Grid */
.download-grid .download-card {
  height: fit-content;
}

/* Perbaikan Stats Preview */
.stats-preview-content {
  padding: 1.5rem;
}

/* Perbaikan Backup Stats */
.backup-stats-card .card-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

/* Konsistensi Padding untuk Semua Card Content */
.attendance-list-content,
.scanner-content {
  padding: 1.5rem;
}

/* Perbaikan Container Preview Barcode */
.students-list-card .card-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.students-list-card .students-list-content {
  padding: 0;
  max-height: 400px;
  overflow-y: auto;
}

.scanner-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.scanner-btn.secondary {
    background: #6b7280;
    color: white;
}

.scanner-btn.secondary:hover {
    background: #4b5563;
}

/* Pastikan tombol dalam satu baris */
.scanner-controls {
    flex-wrap: nowrap;
    justify-content: center;
}

/* Perbaikan Barcode Grid Layout */
.barcode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 1.5rem;
  background: #f9fafb;
}

.barcode-item {
  border: 2px dashed #d1d5db;
  border-radius: 0.75rem;
  padding: 1.5rem;
  text-align: center;
  background: white;
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  overflow: visible;
}

.barcode-item:hover {
  border-color: #3b82f6;
  box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.barcode-qr {
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 120px;
  margin: 0 auto 1rem;
  border-radius: 0.5rem;
  overflow: visible;      /* Pastikan tidak hidden */
  background: white;
  padding: 0.5rem;
  border: 1px solid #e5e7eb;
}

.barcode-info {
  font-size: 0.875rem;
}

.barcode-info h4 {
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.barcode-info p {
  color: #6b7280;
  margin: 0.25rem 0;
}

.barcode-id {
  font-family: 'Fira Mono', 'Consolas', monospace;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  background: #f3f4f6;
  color: #22223b;
  border-radius: 0.25rem;
  padding: 0.25rem 0.5rem;
  margin-top: 0.5rem;
  text-align: center;
  line-height: 1.4;
  overflow: visible;
  text-decoration: none; /* Pastikan tidak ada garis coret */
  text-shadow: none;
  box-sizing: border-box;
  word-break: break-all;
}

/* Loading animation untuk barcode */
.barcode-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 140px;
  color: #6b7280;
}

.barcode-loading svg {
  width: 2rem;
  height: 2rem;
  animation: spin 1s linear infinite;
}

.status {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
}
.status.terlambat {
  color: #dc2626;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
  }

  .header-content {
    padding: 1rem;
  }

  .dashboard-main {
    padding: 1rem;
  }
  /* Responsive untuk barcode grid */
  .barcode-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding: 1rem;
  }
}

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

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .header-content {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .header-left {
    flex-direction: column;
    gap: 0.5rem;
  }

  .form-buttons {
    flex-direction: column;
  }

  .login-container {
    padding: 1rem;
  }

  .login-card {
    padding: 2rem;
  }
  /* Responsive untuk barcode grid */
  .barcode-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .dashboard-card {
    padding: 1.5rem;
  }

  .card-title span {
    font-size: 1.125rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }
}

/* Print Styles */
@media print {
  body {
    background: white;
  }

  .header,
  .back-btn,
  .logout-btn,
  .form-buttons,
  .card-button {
    display: none !important;
  }

  .page {
    display: block !important;
  }
  /* Print styles untuk barcode yang lebih baik */
  .barcode-grid {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 1rem;
    page-break-inside: avoid;
    background: white;
  }
  .barcode-page {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 1.5rem;
  padding: 1.5rem;
  background: white;
  min-height: 250mm; /* agar tinggi cukup untuk A4 */
  box-sizing: border-box;
  page-break-after: always;
}

@media print {
  .barcode-qr {
    max-width: 120px;
    overflow: visible;
    padding: 0;
    border: 1px solid #000;
  }
}
  .barcode-item {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    overflow: visible;
  }
}
