@import url("https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,500;0,600;0,700;1,500&family=Work+Sans:wght@400;500;600;700&display=swap");

:root {
  --color-bg: #faf7f6;
  --color-surface: #ffffff;
  --color-primary: #7f0206;
  --color-primary-dark: #560103;
  --color-primary-light: #f7e7e6;
  --color-accent: #b8862e;
  --color-accent-dark: #8f6620;
  --color-accent-light: #f7ecd9;
  --color-text: #241b1a;
  --color-text-muted: #6c5b5a;
  --color-border: #ece0de;
  --color-danger: #c23b2e;
  --color-danger-light: #fbeae7;
  --color-success: #1e7a45;
  --color-success-light: #e8f5ec;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;

  --shadow-sm: 0 1px 3px rgba(20, 40, 25, 0.07);
  --shadow-md: 0 10px 30px rgba(15, 35, 22, 0.09);

  --font-heading: "Lora", Georgia, serif;
  --font-body: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.25;
  margin: 0;
  color: var(--color-primary-dark);
}

p {
  margin: 0;
}

a {
  color: var(--color-primary);
}

button {
  font-family: inherit;
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

img {
  max-width: 100%;
  display: block;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.6rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--color-primary-dark);
}

.btn-primary:disabled {
  background: #9fb4a3;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: transparent;
  color: var(--color-primary-dark);
  border: 1px solid var(--color-border);
}

.btn-ghost:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary-light);
}

.btn-danger {
  background: var(--color-danger-light);
  color: var(--color-danger);
}

.btn-danger:hover {
  background: #f6d9d7;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

/* Form elements */

.field {
  margin-bottom: 1.25rem;
}

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text);
  margin-bottom: 0.4rem;
}

.field .hint {
  display: block;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 0.35rem;
}

.field .required {
  color: var(--color-accent-dark);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="url"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 0.8rem 0.95rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.98rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 5.5rem;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236c5b5a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.5rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 560px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}

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

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.8rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.checkbox-item:has(input:checked) {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.checkbox-item input {
  accent-color: var(--color-primary);
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.88rem;
  color: var(--color-text-muted);
  margin-top: 0.5rem;
  cursor: pointer;
}

.inline-check input {
  accent-color: var(--color-primary);
  width: 1.05rem;
  height: 1.05rem;
}

/* File upload */

.upload-box {
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
  background: var(--color-surface);
}

.upload-box:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.upload-box input[type="file"] {
  display: none;
}

.upload-preview {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-light);
  object-fit: cover;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  overflow: hidden;
}

.upload-text strong {
  display: block;
  font-size: 0.92rem;
  color: var(--color-text);
}

.upload-text span {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* Utility */

.text-muted {
  color: var(--color-text-muted);
}

.error-text {
  color: var(--color-danger);
  font-size: 0.85rem;
  margin-top: 0.4rem;
  display: none;
}

.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: var(--color-danger);
}

.field.has-error .error-text {
  display: block;
}

.spinner {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}


/* ========================================================
   Custom Modern Styled Dropdown Component
   ======================================================== */

.custom-select-wrapper {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  width: 100%;
  padding: 0.8rem 0.95rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.custom-select-trigger:hover {
  border-color: var(--color-primary);
  background-color: #fffdfd;
}

.custom-select-wrapper.open .custom-select-trigger {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.custom-select-trigger .arrow-icon {
  width: 16px;
  height: 16px;
  stroke: var(--color-text-muted);
  transition: transform 0.2s ease, stroke 0.2s ease;
  flex-shrink: 0;
  margin-left: 0.5rem;
}

.custom-select-wrapper.open .arrow-icon {
  transform: rotate(180deg);
  stroke: var(--color-primary);
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 25px rgba(36, 27, 26, 0.12);
  max-height: 250px;
  overflow-y: auto;
  z-index: 100;
  display: none;
  padding: 0.35rem 0;
}

.custom-select-wrapper.open .custom-select-menu {
  display: block;
  animation: dropdownFadeIn 0.15s ease;
}

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

.custom-select-group-header {
  padding: 0.5rem 0.95rem 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-accent-dark);
  background: var(--color-accent-light);
  margin: 0.25rem 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.custom-select-group-header:first-child {
  border-top: none;
  margin-top: 0;
}

.custom-select-option {
  padding: 0.65rem 0.95rem;
  font-size: 0.9rem;
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.custom-select-option:hover {
  background-color: var(--color-primary-light);
  color: var(--color-primary-dark);
}

.custom-select-option.selected {
  background-color: var(--color-primary-light);
  color: var(--color-primary-dark);
  font-weight: 600;
}

.custom-select-option.selected::after {
  content: "✓";
  font-weight: bold;
  color: var(--color-primary);
  font-size: 0.9rem;
}

/* Custom Scrollbar for Dropdowns */
.custom-select-menu::-webkit-scrollbar {
  width: 6px;
}
.custom-select-menu::-webkit-scrollbar-thumb {
  background-color: var(--color-border);
  border-radius: 999px;
}
.custom-select-menu::-webkit-scrollbar-thumb:hover {
  background-color: var(--color-text-muted);
}

/* ========================================================
   In-App Camera Viewfinder Modal
   ======================================================== */

.camera-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 12, 12, 0.85);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}

.camera-modal-overlay.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.camera-modal {
  background: #1a1414;
  color: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

.camera-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.2rem;
  background: #251c1c;
}

.camera-header h3 {
  color: #fff;
  font-size: 1.05rem;
  font-family: var(--font-body);
  font-weight: 600;
}

.camera-close-btn {
  background: none;
  border: none;
  color: #c9baba;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.camera-close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.camera-viewfinder-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#cameraVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Mirror selfie camera so user feels natural */
#cameraVideo.mirror {
  transform: scaleX(-1);
}

.camera-guide {
  position: absolute;
  pointer-events: none;
  border: 2px dashed rgba(255, 255, 255, 0.45);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.25);
}

/* Oval framing guide for profile photo */
.camera-guide.guide-profile {
  width: 58%;
  height: 76%;
  border-radius: 50%;
}

/* Rectangular guide for ID card / document */
.camera-guide.guide-document {
  width: 82%;
  height: 65%;
  border-radius: var(--radius-sm);
}

.camera-controls {
  padding: 1.1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #251c1c;
}

.btn-camera-ctrl {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-camera-ctrl:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-camera-shutter {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: transparent;
  border: 4px solid #fff;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease;
}

.btn-camera-shutter:active {
  transform: scale(0.92);
}

.shutter-inner {
  width: 100%;
  height: 100%;
  background: var(--color-primary);
  border-radius: 50%;
  display: block;
}