/* ARTINIAN Brand Guide — CSS variables (dark theme default) */
:root {
  --background: 210 8% 11%;
  --foreground: 210 6% 96%;
  --card: 210 8% 14%;
  --card-foreground: 210 6% 96%;
  --primary: 210 6% 77%;
  --primary-foreground: 210 8% 11%;
  --secondary: 210 7% 18%;
  --secondary-foreground: 210 6% 96%;
  --muted: 210 7% 18%;
  --muted-foreground: 210 4% 50%;
  --accent: 210 6% 77%;
  --accent-foreground: 210 8% 11%;
  --destructive: 0 62.8% 50%;
  --border: 210 6% 22%;
  --input: 210 7% 18%;
  --ring: 210 6% 77%;
  --radius: 0.375rem;
  --header-text-underglow: 0 1px 0 rgba(245, 246, 247, 0.2), 0 0 10px rgba(193, 196, 200, 0.22), 0 3px 12px rgba(43, 46, 51, 0.35);
}

/* Light theme optional (e.g. body.light) */
body.light {
  --background: 210 20% 98%;
  --foreground: 210 10% 12%;
  --card: 0 0% 100%;
  --card-foreground: 210 10% 12%;
  --primary: 210 12% 30%;
  --primary-foreground: 0 0% 100%;
  --secondary: 210 16% 93%;
  --secondary-foreground: 210 10% 12%;
  --muted: 210 16% 93%;
  --muted-foreground: 210 10% 22%;
  --border: 210 14% 86%;
  --input: 210 16% 93%;
  --ring: 210 12% 30%;
  --header-text-underglow: 0 1px 0 rgba(245, 246, 247, 0.6), 0 0 8px rgba(193, 196, 200, 0.46), 0 2px 8px rgba(43, 46, 51, 0.24);
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  font-family: 'Jost', 'Avenir Next', 'Avenir', system-ui, sans-serif;
  font-feature-settings: "rlig" 1, "calt" 1;
  letter-spacing: 0.01em;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}

.form-wrapper {
  width: 100%;
  max-width: 900px;
}

.card {
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  border: 1px solid hsl(var(--border));
  padding: 24px 24px 16px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  gap: 12px;
}

/* Logo standard: 2x size (120px height, 400px max-width) - Global standard for all forms */
.company-logo-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

/* Logo: white in dark theme, dark in light theme */
.company-logo {
  /* 2x standard size: 60px * 2 = 120px */
  height: 120px;
  width: auto;
  max-width: 400px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

body.light .company-logo {
  filter: none;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 1024px) {
  .company-logo {
    height: 100px;
    max-width: 350px;
  }
}

@media (max-width: 768px) {
  .company-logo {
    height: 80px;
    max-width: 280px;
  }
}

@media (max-width: 480px) {
  .company-logo {
    height: 60px;
    max-width: 200px;
  }
}

.company-th {
  font-size: 14px;
  color: #fff;
  line-height: 1.4;
  text-shadow: var(--header-text-underglow);
}

body.light .company-th {
  color: hsl(var(--foreground));
  text-shadow: none;
}

.form-title-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  min-width: 200px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--secondary));
  color: hsl(var(--foreground));
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
  visibility: visible !important;
  opacity: 1 !important;
  box-shadow: 0 0 0 1px hsl(var(--border) / 0.45);
}

.theme-toggle-btn:hover {
  background: hsl(var(--accent) / 0.3);
  border-color: hsl(var(--ring));
}

.theme-toggle-btn:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

.theme-icon-light { display: none; }
.theme-icon-dark { display: inline; }

body.light .theme-icon-light { display: inline; }
body.light .theme-icon-dark { display: none; }

.header-action-link {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  height: 2.5rem;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.header-action-link:hover {
  background: hsl(var(--secondary) / 0.8);
  border-color: hsl(var(--ring));
}

.form-title {
  font-weight: 600;
  font-size: 16px;
  margin-top: 4px;
  letter-spacing: 0.02em;
  color: hsl(var(--card-foreground));
  text-align: right;
  width: 100%;
  text-shadow: var(--header-text-underglow);
}

body.light .form-title {
  text-shadow: none;
}

body.light .section-title,
body.light label,
body.light .scanner-placeholder-text,
body.light .scanner-placeholder-hint,
body.light .signature-label-row,
body.light .card-footer,
body.light .signature-date {
  color: hsl(var(--foreground));
}

body.light input::placeholder,
body.light textarea::placeholder {
  color: hsl(var(--foreground) / 0.72);
}

.user-portal-btn {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  height: 2.5rem;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground)) !important;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.08s ease;
  width: auto;
  min-width: 180px;
  visibility: visible !important;
  opacity: 1 !important;
  text-shadow: var(--header-text-underglow);
}

.user-portal-btn:hover {
  background: hsl(var(--primary) / 0.9);
  transform: translateY(-1px);
}

.user-portal-btn:active {
  transform: translateY(0);
}

.user-portal-btn:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

.portal-icon {
  font-size: 18px;
}

.portal-text {
  white-space: nowrap;
}

/* Portal Access Modal */
.portal-access-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.portal-access-modal.show {
  display: flex;
}

.portal-access-modal-content {
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.portal-access-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  border-bottom: 1px solid hsl(var(--border));
}

.portal-access-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: hsl(var(--foreground));
}

.portal-close-btn {
  background: none;
  border: none;
  font-size: 28px;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: calc(var(--radius) - 2px);
  transition: background-color 0.2s, color 0.2s;
}

.portal-close-btn:hover {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
}

.portal-access-body {
  padding: 24px;
}

.portal-instruction {
  text-align: center;
  color: hsl(var(--muted-foreground));
  margin-bottom: 24px;
  font-size: 15px;
  line-height: 1.6;
}

.portal-scanner-container {
  position: relative;
  width: 100%;
  height: 300px;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.portal-scanner-container video {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  z-index: 1 !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  background: #000 !important;
}

.portal-scanner-container canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.portal-scanner-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: hsl(var(--muted-foreground));
}

.portal-scanner-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.portal-scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(1);
}

.portal-scanner-canvas {
  display: none;
}

.portal-scanner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
}

.portal-scanner-frame {
  width: 80%;
  max-width: 300px;
  height: 150px;
  border: 2px solid hsl(var(--ring));
  border-radius: calc(var(--radius) - 2px);
  position: relative;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.portal-scanner-corner {
  position: absolute;
  width: 24px;
  height: 24px;
  border: 3px solid hsl(var(--ring));
}

.portal-scanner-corner-tl {
  top: -3px;
  left: -3px;
  border-right: none;
  border-bottom: none;
  border-top-left-radius: 8px;
}

.portal-scanner-corner-tr {
  top: -3px;
  right: -3px;
  border-left: none;
  border-bottom: none;
  border-top-right-radius: 8px;
}

.portal-scanner-corner-bl {
  bottom: -3px;
  left: -3px;
  border-right: none;
  border-top: none;
  border-bottom-left-radius: 8px;
}

.portal-scanner-corner-br {
  bottom: -3px;
  right: -3px;
  border-left: none;
  border-top: none;
  border-bottom-right-radius: 8px;
}

.portal-scanner-line {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(to right, transparent, hsl(var(--ring)), transparent);
  animation: scanLine 2s linear infinite;
}

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

.portal-scanner-instruction {
  margin-top: 20px;
  color: white;
  font-size: 14px;
  text-align: center;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.portal-access-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.portal-status {
  margin-top: 16px;
  text-align: center;
  font-size: 14px;
  color: hsl(var(--muted-foreground));
  min-height: 20px;
}

hr.divider {
  border: none;
  border-top: 1px solid hsl(var(--border));
  margin: 8px 0 16px;
}

.success-message {
  display: none;
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.3s ease;
}

.modal-overlay.show {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 32px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  text-align: center;
  animation: slideUp 0.3s ease;
}

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

.modal-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  background: rgba(16, 185, 129, 0.3);
  border: 1px solid rgba(16, 185, 129, 0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: rgb(110, 231, 183); /* emerald-300 */
}

.modal-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: hsl(var(--foreground));
  margin-bottom: 12px;
}

.modal-message {
  font-size: 16px;
  color: hsl(var(--muted-foreground));
  margin-bottom: 24px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.modal-actions button {
  min-width: 120px;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 16px 24px;
}

@media (max-width: 720px) {
  .card {
    padding: 18px 16px 12px;
  }
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .company-logo {
    height: 45px;
    max-width: 150px;
  }
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .form-title-container {
    align-items: flex-start;
  }
  .header-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

.section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: hsl(var(--foreground));
  margin-bottom: 2px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}

label {
  font-size: 13px;
  color: hsl(var(--muted-foreground));
}

.label-main {
  font-weight: 500;
}

/* Autocomplete Styles */
.autocomplete-wrapper {
  position: relative;
  width: 100%;
}

.autocomplete-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-top: none;
  border-radius: 0 0 calc(var(--radius) - 2px) calc(var(--radius) - 2px);
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
  margin-top: -1px;
}

.autocomplete-dropdown.show {
  display: block;
}

.autocomplete-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid hsl(var(--border));
  transition: background-color 0.15s ease;
}

.autocomplete-item:hover,
.autocomplete-item.highlighted {
  background-color: hsl(var(--accent) / 0.2);
  color: hsl(var(--accent-foreground));
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item-name {
  font-weight: 500;
  color: hsl(var(--foreground));
  font-size: 14px;
  margin-bottom: 2px;
}

.autocomplete-item-details {
  font-size: 12px;
  color: hsl(var(--muted-foreground));
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.autocomplete-item-detail {
  display: flex;
  align-items: center;
  gap: 4px;
}

.autocomplete-item-detail strong {
  color: hsl(var(--muted-foreground));
}

input[type="text"],
input[type="date"],
input[type="time"],
textarea {
  width: 100%;
  height: 2.5rem;
  padding: 8px 12px;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--border));
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  background: hsl(var(--input));
  color: hsl(var(--foreground));
}

textarea {
  height: auto;
  min-height: 80px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: hsl(var(--muted-foreground));
}

input:focus,
textarea:focus {
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.25);
  background: hsl(var(--background));
}

input:focus-visible,
textarea:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

input.error,
textarea.error {
  border-color: hsl(var(--destructive));
  box-shadow: 0 0 0 1px hsl(var(--destructive) / 0.3);
}

input[readonly] {
  background-color: hsl(var(--muted));
  cursor: not-allowed;
}

.error-message {
  color: hsl(var(--destructive));
  font-size: 12px;
  margin-top: 4px;
  display: none;
}

.error-message.show {
  display: block;
}

.checkbox-group.error {
  border-color: hsl(var(--destructive));
  background: hsl(var(--destructive) / 0.1);
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--input));
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: hsl(var(--foreground));
}

.checkbox-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
}

.inline-row {
  display: flex;
  gap: 8px;
}

.inline-row > .field-group {
  flex: 1;
}

.approvals {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  font-size: 13px;
}

@media (max-width: 640px) {
  .approvals {
    grid-template-columns: minmax(0, 1fr);
  }
}

.signature-box {
  border-radius: calc(var(--radius) - 2px);
  border: 1px dashed hsl(var(--border));
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: hsl(var(--input));
}

.signature-line {
  border-bottom: 1px solid hsl(var(--border));
  height: 26px;
  margin-bottom: 2px;
}

.signature-label-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: hsl(var(--muted-foreground));
}

.signature-date {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.signature-date input[type="date"] {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: calc(var(--radius) - 4px);
  background: hsl(var(--input));
}

.card-footer {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  font-size: 11px;
  color: hsl(var(--muted-foreground));
  flex-wrap: wrap;
}

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

button {
  border: none;
  border-radius: calc(var(--radius) - 2px);
  padding: 8px 16px;
  height: 2.5rem;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.08s ease, background-color 0.2s ease, opacity 0.2s ease;
}

button:active {
  transform: translateY(1px);
}

button:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.btn-primary:hover:not(:disabled) {
  background: hsl(var(--primary) / 0.9);
}

.btn-secondary {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}

.btn-secondary:hover:not(:disabled) {
  background: hsl(var(--secondary) / 0.8);
}

.btn-test {
  background: rgba(16, 185, 129, 0.25);
  color: rgb(110, 231, 183);
  border: 1px solid rgba(16, 185, 129, 0.5);
}

.btn-test:hover:not(:disabled) {
  background: rgba(16, 185, 129, 0.35);
}

.btn-test:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Barcode Scan Result Popup */
.barcode-scan-popup {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  pointer-events: none;
  animation: fadeIn 0.3s ease;
}

.barcode-scan-popup.show {
  display: flex;
  pointer-events: auto;
}

.barcode-scan-popup.success {
  background: rgba(16, 185, 129, 0.95);
  backdrop-filter: blur(8px);
}

.barcode-scan-popup.error {
  background: rgba(239, 68, 68, 0.95);
  backdrop-filter: blur(8px);
}

.barcode-scan-popup-content {
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 32px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  animation: slideUp 0.4s ease;
  transform: scale(0.9);
  animation-fill-mode: forwards;
}

.barcode-scan-popup.show .barcode-scan-popup-content {
  animation: slideUpScale 0.4s ease forwards;
}

.barcode-scan-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: bold;
  animation: scaleIn 0.3s ease 0.2s both;
}

.barcode-scan-popup.success .barcode-scan-icon {
  background: rgba(16, 185, 129, 0.4);
  border: 1px solid rgba(16, 185, 129, 0.6);
  color: rgb(110, 231, 183);
}

.barcode-scan-popup.error .barcode-scan-icon {
  background: hsl(var(--destructive) / 0.3);
  border: 1px solid hsl(var(--destructive) / 0.6);
  color: rgb(252, 165, 165);
}

.barcode-scan-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: hsl(var(--foreground));
  margin-bottom: 12px;
  animation: fadeInUp 0.3s ease 0.3s both;
}

.barcode-scan-message {
  font-size: 16px;
  color: hsl(var(--muted-foreground));
  margin-bottom: 16px;
  line-height: 1.5;
  animation: fadeInUp 0.3s ease 0.4s both;
}

.barcode-scan-code {
  font-size: 18px;
  font-weight: 600;
  color: hsl(var(--foreground));
  background: hsl(var(--muted));
  padding: 12px 20px;
  border-radius: calc(var(--radius) - 2px);
  font-family: 'Courier New', monospace;
  letter-spacing: 2px;
  animation: fadeInUp 0.3s ease 0.5s both;
}

@keyframes slideUpScale {
  0% {
    transform: translateY(30px) scale(0.9);
    opacity: 0;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes scaleIn {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes fadeInUp {
  0% {
    transform: translateY(10px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Print styles */
@media print {
  body {
    background: #ffffff;
    color: #111827;
    padding: 0;
  }
  .card {
    background: #ffffff;
    color: #111827;
    box-shadow: none;
    border: 1px solid #e5e7eb;
    border-radius: 0;
  }
  .company-logo {
    height: 50px;
    max-width: 180px;
  }
  .actions,
  .success-message,
  .modal-overlay,
  .autocomplete-dropdown,
  .barcode-scanner-section {
    display: none !important;
  }
}

/* Barcode Scanner Styles */
.barcode-scanner-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid hsl(var(--border));
}

.barcode-scanner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.scanner-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.btn-camera-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 8px 16px;
  height: 2.5rem;
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.08s ease;
}

.btn-camera-switch:hover:not(:disabled) {
  background: hsl(var(--secondary) / 0.8);
  transform: translateY(-1px);
}

.btn-camera-switch:active {
  transform: translateY(0);
}

.btn-camera-switch:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

.btn-camera-switch:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-camera-switch span {
  display: inline-block;
}

#switchCameraIcon {
  font-size: 1.1rem;
}

@media (max-width: 768px) {
  .barcode-scanner-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .scanner-controls {
    width: 100%;
    justify-content: space-between;
  }
  
  .btn-camera-switch {
    flex: 1;
    justify-content: center;
  }
}

.btn-scanner-toggle {
  padding: 8px 16px;
  height: 2.5rem;
  border: 1px solid hsl(var(--primary));
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.08s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-scanner-toggle:hover {
  background: hsl(var(--primary) / 0.9);
  transform: translateY(-1px);
}

.btn-scanner-toggle:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

.btn-scanner-toggle.active {
  background: hsl(var(--destructive));
  border-color: hsl(var(--destructive));
  color: hsl(var(--foreground));
}

.btn-scanner-toggle.active:hover {
  background: hsl(var(--destructive) / 0.9);
}

.barcode-scanner-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-height: 240px;
  aspect-ratio: 4 / 3;
  background: hsl(var(--input));
  border-radius: calc(var(--radius) - 2px);
  overflow: hidden;
  border: 2px solid hsl(var(--border));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 50px;
  margin-top: 20px;
}

.scanner-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  z-index: 5;
}

.scanner-placeholder-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.6;
}

.scanner-placeholder-text {
  font-size: 14px;
  font-weight: 500;
  color: hsl(var(--foreground));
  margin-bottom: 8px;
}

.scanner-placeholder-hint {
  font-size: 12px;
  color: hsl(var(--muted-foreground));
  line-height: 1.5;
}

.scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Removed mirroring - barcodes/QR codes need to be readable */
}

.scanner-canvas {
  display: none;
}

.scanner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
  padding: 60px 20px 40px 20px;
  box-sizing: border-box;
}

.scanner-frame {
  position: relative;
  width: 85%;
  max-width: 400px;
  height: 200px;
  border: 2px solid hsl(var(--ring) / 0.8);
  border-radius: calc(var(--radius) - 2px);
  background: rgba(0, 0, 0, 0.3);
  margin: 0 auto;
  flex-shrink: 0;
}

.scanner-corner {
  position: absolute;
  width: 24px;
  height: 24px;
  border: 3px solid rgb(125, 211, 252); /* sky-300 / info */
}

.scanner-corner-tl {
  top: -3px;
  left: -3px;
  border-right: none;
  border-bottom: none;
  border-top-left-radius: 8px;
}

.scanner-corner-tr {
  top: -3px;
  right: -3px;
  border-left: none;
  border-bottom: none;
  border-top-right-radius: 8px;
}

.scanner-corner-bl {
  bottom: -3px;
  left: -3px;
  border-right: none;
  border-top: none;
  border-bottom-left-radius: 8px;
}

.scanner-corner-br {
  bottom: -3px;
  right: -3px;
  border-left: none;
  border-top: none;
  border-bottom-right-radius: 8px;
}

.scanner-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(to right, transparent, rgb(125, 211, 252), transparent);
  animation: scanner-line 2s ease-in-out infinite;
  transform-origin: center;
}

@keyframes scanner-line {
  0% {
    top: 0;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    top: 100%;
    opacity: 0;
  }
}

.scanner-instruction {
  margin-top: 24px;
  color: #ffffff;
  font-size: 13px;
  text-align: center;
  background: rgba(0, 0, 0, 0.6);
  padding: 8px 16px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
  flex-shrink: 0;
  line-height: 1.5;
  max-width: 90%;
  word-wrap: break-word;
}

.scanner-status {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  z-index: 20;
  display: none;
  white-space: nowrap;
  max-width: 90%;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  pointer-events: none;
}

.scanner-status.success {
  display: block;
  background: rgba(16, 185, 129, 0.5);
  color: rgb(110, 231, 183);
  border: 1px solid rgba(16, 185, 129, 0.5);
  animation: scanner-success 0.5s ease;
}

.scanner-status.error {
  display: block;
  background: hsl(var(--destructive) / 0.5);
  color: rgb(252, 165, 165);
  border: 1px solid hsl(var(--destructive) / 0.5);
  animation: scanner-error 0.5s ease;
}

.scanner-status.info {
  display: block;
  background: rgba(14, 165, 233, 0.4);
  color: rgb(125, 211, 252);
  border: 1px solid rgba(14, 165, 233, 0.4);
  animation: scanner-info 0.5s ease;
}

@keyframes scanner-success {
  0% {
    transform: translateX(-50%) scale(0.8);
    opacity: 0;
  }
  50% {
    transform: translateX(-50%) scale(1.1);
  }
  100% {
    transform: translateX(-50%) scale(1);
    opacity: 1;
  }
}

@keyframes scanner-error {
  0%, 100% {
    transform: translateX(-50%);
  }
  25%, 75% {
    transform: translateX(-52%);
  }
  50% {
    transform: translateX(-48%);
  }
}

@keyframes scanner-info {
  0% {
    transform: translateX(-50%) scale(0.9);
    opacity: 0;
  }
  100% {
    transform: translateX(-50%) scale(1);
    opacity: 1;
  }
}

/* Scanner Status Overlay */
/* IMPORTANT: z-index is lower than scanner-overlay to ensure aiming box is always visible */
.scanner-status-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none; /* Hidden by default, only shown for success/error/cooldown */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 5; /* Lower than scanner-overlay (z-index: 10) to keep aiming box visible */
  border-radius: 12px;
  transition: opacity 0.3s ease;
  pointer-events: none; /* Allow clicks to pass through when hidden */
}

.scanner-status-overlay.scanning {
  background: rgba(59, 130, 246, 0.8);
}

.scanner-status-overlay.success {
  background: rgba(16, 185, 129, 0.9);
}

.scanner-status-overlay.error {
  background: rgba(239, 68, 68, 0.9);
}

.scanner-status-overlay.cooldown {
  background: rgba(107, 114, 128, 0.8);
}

.scanner-status-icon {
  font-size: 64px;
  margin-bottom: 16px;
  animation: pulse 1.5s ease-in-out infinite;
}

.scanner-status-overlay.success .scanner-status-icon {
  animation: success-bounce 0.6s ease;
}

.scanner-status-overlay.error .scanner-status-icon {
  animation: error-shake 0.5s ease;
}

.scanner-status-text {
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
  text-align: center;
  padding: 0 20px;
  line-height: 1.5;
}

/* Cooldown Timer */
.scanner-cooldown {
  margin-top: 24px;
  text-align: center;
  color: #ffffff;
}

.cooldown-label {
  font-size: 14px;
  margin-bottom: 8px;
  opacity: 0.9;
}

.cooldown-timer {
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
  margin: 8px 0;
  animation: countdown-pulse 1s ease-in-out infinite;
}

.cooldown-seconds {
  font-size: 12px;
  opacity: 0.8;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

@keyframes success-bounce {
  0% {
    transform: scale(0);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

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

@keyframes countdown-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* ARTINIAN Brand Guide — Scrollbars (WebKit) */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: hsl(210 8% 11%);
}
::-webkit-scrollbar-thumb {
  background: hsl(210 6% 28%);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: hsl(210 4% 50%);
}

/* artinian-site-footer — copyright on all form pages */
.artinian-site-footer {
  text-align: center;
  padding: 14px 12px 10px;
  margin-top: 32px;
  border-top: 1px solid hsl(var(--border) / 0.6);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: hsl(var(--muted-foreground));
}
.artinian-site-footer p { margin: 0; }

