:root {
  --purple: #65299d;
  --semi-dark-purple: #47265e;
  --dark-purple: #2a0a3d;
  --lilac: #c09bec;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--dark-purple);
  color: var(--lilac);
  min-height: 100vh;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;

  scroll-behavior: smooth;
}

.container {
  max-width: 500px;
  width: 100%;
}

.header {
  text-align: center;
  margin-bottom: 30px;
}

.logo {
  width: 315px;
  height: 43px;
  max-width: 100%;
  margin: 0 auto 20px;
  display: block;
}

h1 {
  color: var(--lilac);
  font-size: 24px;
  font-weight: 600;
}

.form-card {
  background: var(--semi-dark-purple);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}

.input-group {
  margin-bottom: 10px;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--lilac);
  font-weight: 500;
}

input,
textarea {
  width: 100%;
  padding: 12px;
  background: var(--dark-purple);
  border: 2px solid var(--purple);
  border-radius: 8px;
  /* color: var(--lilac); */
  color: white;
  font-size: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--lilac);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

.char-count {
  text-align: right;
  font-size: 12px;
  color: var(--lilac);
  margin-top: 4px;
  opacity: 0.7;
}

button {
  width: 100%;
  background: var(--purple);
  color: white;
  border: none;
  padding: 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.2s;
  margin-bottom: 12px;

  background: white;
  color: var(--dark-purple);
  border: 2px solid var(--purple);
}

button:active:not(:disabled) {
  transform: scale(0.95);
}

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

.scan-btn {
  background: var(--lilac);
}

.success-message,
.error-message {
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  text-align: center;
  font-weight: 500;
  display: none;
}

.success-message {
  background: #51cf66;
  color: white;
}

.error-message {
  background: #ff6b6b;
  color: white;
}

.scanner-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(42, 10, 61, 0.95);
  z-index: 1000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.scanner-overlay.active {
  display: flex;
}

.scanner-container {
  width: 100%;
  max-width: 500px;
  text-align: center;
}

.scanner-header {
  margin-bottom: 20px;
}

.scanner-header h2 {
  color: var(--lilac);
  font-size: 20px;
  margin-bottom: 8px;
}

.scanner-header p {
  color: var(--lilac);
  opacity: 0.8;
  font-size: 14px;
}

#qrReader {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  border: 3px solid var(--lilac);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(192, 155, 236, 0.3);
}

#qrReader video {
  width: 100%;
  display: block;
  border-radius: 8px;
}

.close-scanner {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--semi-dark-purple);
  color: var(--lilac);
  border: 2px solid var(--purple);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.close-scanner:hover {
  background: var(--purple);
  color: white;
}

@media (max-width: 600px) {
  body {
    padding: 16px;
  }

  .form-card {
    padding: 20px;
  }

  h1 {
    font-size: 20px;
  }

  .input-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .input-group {
    margin-bottom: 20px;
  }
}

/* handling auto fill  */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--dark-purple) inset !important;
  -webkit-text-fill-color: white !important;
  transition: background-color 9999s ease-in-out 0s;
}

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 250px;
  color: #333;
}
.spinner {
  border: 4px solid #ddd;
  border-top: 4px solid #333;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin-bottom: 10px;
}
@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}
