/* style.css – premium layout with light theme
   Palette:
   - Background: #EFECE3
   - Accent:     #8FABD4
   - Primary:    #4A70A9
   - Text:       #000000
*/

/* Global */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Poppins", sans-serif;
  background: #efece3;
  color: #000000;
}

.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */

.sidebar {
  width: 240px;
  background: #4a70a9;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.logo h2 {
  margin: 0;
  font-size: 22px;
  color: #efece3;
}

.logo p {
  margin: 4px 0 0;
  font-size: 12px;
  color: #8fabd4;
}

.sidebar nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar nav a {
  display: block;
  padding: 10px 12px;
  border-radius: 999px;
  text-decoration: none;
  color: #efece3;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}

.sidebar nav a:hover {
  background: rgba(239, 236, 227, 0.18);
}

.sidebar nav a.active {
  background: #efece3;
  color: #000000;
  font-weight: 600;
}

.menu-toggle {
  display: none; /* hidden on desktop by default */
  background: transparent;
  border: 1px solid rgba(239, 236, 227, 0.7);
  color: #efece3;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 16px;
  margin-left: auto;
  cursor: pointer;
}

/* Main content */
.main-content {
  flex: 1;
  padding: 24px 32px;
  background: #efece3;
  overflow-x: hidden;
}

h1 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 24px;
}

.card {
  background: #efece3;
  border-radius: 18px;
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  border: 1px solid #8fabd4;
}

/* Dashboard stats */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.stat-card {
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at top right,
    rgba(143, 171, 212, 0.5),
    transparent 60%
  );
  pointer-events: none;
}

.stat-label {
  font-size: 13px;
  color: #4a70a9;
  margin: 0 0 4px;
}

.stat-value {
  font-size: 28px;
  font-weight: 600;
  margin: 0;
}

/* Card header & toolbar */
.card-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}

.card-header.between {
  justify-content: space-between;
}

.card-header h2 {
  margin: 0;
  font-size: 18px;
}

.card-header small {
  color: #4a70a9;
}

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
}

.hint {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 12px;
  color: #4a70a9;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 16px;
  align-items: flex-end;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 13px;
  color: #000000;
}

input,
select {
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid #8fabd4;
  padding: 8px 10px;
  color: #000000;
  font-family: inherit;
  font-size: 13px;
}

input:focus,
select:focus {
  outline: none;
  border-color: #4a70a9;
  box-shadow: 0 0 0 1px rgba(74, 112, 169, 0.3);
}

.input-small {
  max-width: 220px;
}

.form-actions {
  display: flex;
  gap: 8px;
}

/* Buttons */
.btn {
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  background: #4a70a9;
  color: #efece3;
  font-weight: 500;
  transition: transform 0.1s, box-shadow 0.1s, background 0.1s;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
  background: #385684;
}

.btn-secondary {
  background: #efece3;
  color: #4a70a9;
  border: 1px solid #8fabd4;
}

.btn-secondary:hover {
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
  background: #8fabd4;
  color: #000000;
}

.btn-download {
  background: transparent;
  border: 1px solid #4a70a9;
  color: #4a70a9;
}

/* Import label */
.import-label {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px dashed #8fabd4;
  font-size: 12px;
  cursor: pointer;
  color: #4a70a9;
}

/* Attendance */
.attendance-options {
  display: inline-flex;
  border-radius: 999px;
  background: #efece3;
  border: 1px solid #8fabd4;
  padding: 3px;
  margin: 8px 0 16px;
}

.tab-btn {
  border-radius: 999px;
  border: none;
  padding: 6px 16px;
  font-size: 13px;
  background: transparent;
  color: #4a70a9;
  cursor: pointer;
}

.tab-btn.active {
  background: #4a70a9;
  color: #efece3;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.qr-scanner {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#webcam-preview {
  width: 100%;
  max-width: 420px;
  border-radius: 12px;
  background: #00000011;
  border: 1px solid #8fabd4;
}

.qr-status {
  font-size: 13px;
  color: #4a70a9;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead {
  position: sticky;
  top: 0;
  background: #8fabd4;
  z-index: 1;
}

th,
td {
  padding: 8px 10px;
  text-align: left;
}

th {
  font-weight: 500;
  color: #000000;
  border-bottom: 1px solid #4a70a9;
}

tbody tr:nth-child(even) {
  background: rgba(143, 171, 212, 0.25);
}

tbody tr:hover {
  background: rgba(74, 112, 169, 0.2);
}

.empty-row {
  text-align: center;
  color: #4a70a9;
  padding: 16px 0;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Reports */
.report-filters {
  margin-bottom: 10px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.download-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

/* Chart */
.chart-wrapper {
  position: relative;
  width: 100%;
  height: 240px;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  justify-content: center;
  align-items: center;
  z-index: 50;
}

.modal-content {
  background: #efece3;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid #8fabd4;
  max-width: 360px;
  width: 100%;
}

.close-btn {
  float: right;
  cursor: pointer;
  font-size: 18px;
}

.qr-code-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

/* Toast notifications */
#toast-container {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 60;
}

.toast {
  min-width: 220px;
  max-width: 320px;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: #efece3;
  background: #000000;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  border: 1px solid #4a70a9;
}

.toast-error {
  border: 1px solid #000000;
}

.toast-info {
  border: 1px solid #8fabd4;
}

/* Responsive */
@media (max-width: 900px) {
  .app-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .sidebar nav ul {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .main-content {
    padding: 16px;
  }

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

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 40;
  }

  .logo h2 {
    font-size: 18px;
  }

  .logo p {
    display: none; /* hide tagline on very small screens */
  }

  .menu-toggle {
    display: block; /* show hamburger on mobile */
  }

  .sidebar nav {
    position: relative;
    width: 100%;
  }

  .sidebar nav ul {
    /* hidden by default on mobile */
    display: none;
    flex-direction: column;
    gap: 4px;
    position: absolute;
    left: 0;
    right: 0;
    top: 40px;
    background: #4a70a9;
    padding: 10px 16px 12px;
    border-bottom: 1px solid #8fabd4;
  }

  .sidebar.sidebar-open nav ul {
    display: flex; /* shown when hamburger is toggled */
  }

  .main-content {
    padding: 16px;
  }

  /* Make buttons and inputs a bit larger tap targets */
  .btn {
    padding: 10px 18px;
  }

  input,
  select {
    padding: 10px 12px;
  }

  /* QR video should use full width on mobile */
  #webcam-preview {
    max-width: 100%;
  }
}
