:root {
  --public-attendance-max-width: 620px;
}

html,
body {
  min-height: 100%;
}

.public-attendance-body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(
      circle at top left,
      rgba(13, 110, 253, 0.11),
      transparent 34%
    ),
    linear-gradient(160deg, #f8fafc 0%, #eef2f7 100%);
  color: #1f2937;
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Arial,
    sans-serif !important;
}

.public-attendance-body *,
.public-attendance-body *::before,
.public-attendance-body *::after {
  box-sizing: border-box;
}

.public-attendance-page {
  min-height: 100vh;
  padding: max(1rem, env(safe-area-inset-top))
    max(1rem, env(safe-area-inset-right))
    max(1.5rem, env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
}

.public-attendance-shell {
  width: 100%;
  max-width: var(--public-attendance-max-width);
  margin: 0 auto;
}

.public-attendance-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.5rem 0.25rem 1.25rem;
}

.public-dashboard-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 40px;
  margin-left: auto;
  white-space: nowrap;
}

.public-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 0.9rem;
  background: #111827;
  color: #ffffff;
  font-size: 1.35rem;
  box-shadow: 0 0.6rem 1.3rem rgba(15, 23, 42, 0.16);
}

.public-brand-name {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  color: #111827;
}

.public-brand-tagline {
  margin-top: 0.15rem;
  font-size: 0.8rem;
  color: #6b7280;
}

.public-attendance-card {
  overflow: hidden;
  width: 100%;
  padding: 1.25rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 1.15rem;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 1.25rem 3rem rgba(15, 23, 42, 0.1);
}

.public-attendance-intro {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  margin-bottom: 1.25rem;
}

.public-attendance-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 0.85rem;
  background: rgba(13, 110, 253, 0.1);
  color: #0d6efd;
  font-size: 1.3rem;
}

.public-attendance-intro h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: #111827;
}

.public-attendance-intro p {
  margin: 0.35rem 0 0;
  color: #6b7280;
  font-size: 0.9rem;
}

.public-clock-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.9rem;
  background: #f8fafc;
}

.public-clock-label {
  margin-bottom: 0.2rem;
  color: #6b7280;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.public-date {
  font-size: 0.9rem;
  font-weight: 600;
  color: #374151;
}

.public-clock {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #111827;
}

.public-attendance-card .form-label {
  display: block !important;
  width: 100%;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #374151;
}

.public-attendance-card .form-select,
.public-attendance-card .form-control {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
}

.public-attendance-card .form-select-lg {
  border-radius: 0.8rem;
}

.public-attendance-card .form-text {
  margin-top: 0.45rem;
  font-size: 0.78rem;
}

/* Keep the employee-ID verification action aligned with its field on larger
   screens, while retaining a comfortable full-width touch target on phones. */
.public-employee-verify {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: stretch;
}

.public-employee-verify .form-control {
  min-width: 0;
}

.public-employee-verify .btn {
  min-width: 112px;
  white-space: nowrap;
}

.public-status-card {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1rem;
  border: 1px solid #dbeafe;
  border-radius: 0.9rem;
  background: #eff6ff;
}

.public-status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 50%;
  background: #ffffff;
  color: #0d6efd;
}

.public-status-label,
.public-action-label {
  color: #6b7280;
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
}

.public-status-value,
.public-action-value {
  margin-top: 0.15rem;
  color: #111827;
  font-size: 1rem;
  font-weight: 700;
}

.public-status-detail,
.public-action-help {
  margin-top: 0.25rem;
  color: #6b7280;
  font-size: 0.8rem;
}

.public-action-panel {
  padding: 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.9rem;
  background: #ffffff;
}

.public-action-label {
  margin-bottom: 0.75rem;
}

.public-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 50%;
  font-size: 1.15rem;
}

.public-action-login {
  background: #d1e7dd;
  color: #146c43;
}

.public-action-logout {
  background: #f8d7da;
  color: #b02a37;
}

.public-camera-section {
  padding: 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.9rem;
  background: #f8fafc;
}

.public-camera-panel,
.public-photo-preview-panel {
  position: relative;
  overflow: hidden;
  width: 100%;
  min-height: 260px;
  border: 1px solid #d1d5db;
  border-radius: 0.9rem;
  background: #111827;
}

.public-camera-video,
.public-photo-preview {
  display: block;
  width: 100%;
  min-height: 260px;
  max-height: 440px;
  object-fit: cover;
}

.public-camera-video {
  transform: scaleX(-1);
}

.public-camera-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  background: #f3f4f6;
  color: #6b7280;
}

.public-photo-preview-panel {
  background: #ffffff;
}

.public-photo-preview {
  object-fit: contain;
}

.public-review-photo-wrapper {
  overflow: hidden;
  width: 100%;
  max-height: 360px;
  border: 1px solid #e5e7eb;
  border-radius: 0.9rem;
  background: #f8fafc;
}

.public-review-photo {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
}

.public-review-list {
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 0.9rem;
}

.public-review-item {
  display: grid;
  grid-template-columns: 145px minmax(0, 1fr);
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.public-review-item:last-child {
  border-bottom: 0;
}

.public-review-label {
  color: #6b7280;
  font-size: 0.8rem;
  font-weight: 600;
}

.public-review-value {
  color: #111827;
  font-size: 0.9rem;
  font-weight: 600;
  word-break: break-word;
}

.public-attendance-footer {
  padding: 1rem 0.5rem 0;
  text-align: center;
  color: #6b7280;
  font-size: 0.75rem;
}

@media (min-width: 576px) {
  .public-attendance-page {
    padding-top: 1.5rem;
    padding-bottom: 2rem;
  }

  .public-attendance-card {
    padding: 1.75rem;
  }
}

@media (max-width: 575.98px) {
  .public-attendance-page {
    padding: max(0.75rem, env(safe-area-inset-top))
      max(0.75rem, env(safe-area-inset-right))
      max(1rem, env(safe-area-inset-bottom))
      max(0.75rem, env(safe-area-inset-left));
  }

  .public-attendance-card {
    padding: 1rem;
    border-radius: 1rem;
  }

  .public-attendance-header {
    padding-bottom: 1rem;
  }

  .public-dashboard-link {
    width: 42px;
    min-width: 42px;
    padding-right: 0;
    padding-left: 0;
  }

  .public-dashboard-link span {
    display: none;
  }

  .public-clock-panel {
    flex-direction: column;
    align-items: flex-start;
  }

  .public-device-time-column {
    text-align: left !important;
  }

  .public-employee-verify {
    grid-template-columns: 1fr;
  }

  .public-employee-verify .btn {
    width: 100%;
  }

  .public-camera-panel,
  .public-photo-preview-panel,
  .public-camera-video,
  .public-photo-preview {
    min-height: 220px;
  }

  .public-review-item {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .modal-dialog {
    margin: 0.75rem;
  }
}

@media (max-width: 380px) {
  .public-attendance-intro h1 {
    font-size: 1.2rem;
  }

  .public-clock {
    font-size: 1.15rem;
  }
}

.public-password-field {
  position: relative;
  width: 100%;
}

.public-password-field .form-control {
  width: 100% !important;
  min-height: 52px;
  padding-right: 3.5rem;
  border-radius: 0.8rem !important;
}

.public-password-toggle {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 0.65rem;
  background: transparent;
  color: #6b7280;
  transform: translateY(-50%);
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.public-password-toggle:hover,
.public-password-toggle:focus-visible {
  background: #f3f4f6;
  color: #111827;
  outline: none;
}

.public-password-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
