/* ============================================================
   BioDrive — Forms Companion Stylesheet
   Extends styles.css with form controls, using the same
   teal/white token system. No new colors introduced.
   ============================================================ */

/* ----------------------------------------------------------
   1. Field primitives
   ---------------------------------------------------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.field:last-child {
  margin-bottom: 0;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
}

.field .req {
  color: var(--danger);
  font-weight: 700;
}

.field .hint {
  font-size: 12px;
  color: var(--text-muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text-dark);
  background-color: var(--white);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}

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

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

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--teal-600) 50%),
    linear-gradient(135deg, var(--teal-600) 50%, transparent 50%);
  background-position: calc(100% - 22px) calc(50% - 3px), calc(100% - 16px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 40px;
}

/* Field layout helpers */
.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

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

.field--span-2 {
  grid-column: span 2;
}

/* ----------------------------------------------------------
   2. Section dividers within a card body
   ---------------------------------------------------------- */
.form-section + .form-section {
  margin-top: 26px;
  padding-top: 26px;
  border-top: 1px solid var(--grey-200);
}

.form-section__label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--teal-600);
  margin-bottom: 16px;
}

/* ----------------------------------------------------------
   3. Form footer (Cancel / Submit)
   ---------------------------------------------------------- */
.form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 22px;
  border-top: 1px solid var(--grey-200);
  background-color: var(--grey-50);
}

/* ----------------------------------------------------------
   4. Checkbox / toggle row
   ---------------------------------------------------------- */
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--teal-600);
  cursor: pointer;
}

.checkbox-row__copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.checkbox-row__copy strong {
  font-size: 14px;
  color: var(--text-dark);
}

.checkbox-row__copy span {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Input with trailing unit (e.g. %, hrs) */
.input-unit {
  position: relative;
}

.input-unit input {
  padding-right: 44px;
}

.input-unit__suffix {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
}

/* ----------------------------------------------------------
   5. Prescription / batch row (repeatable, "dynamic-ready")
   ---------------------------------------------------------- */
.row-group {
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-sm);
  padding: 18px;
  background-color: var(--grey-50);
}

.row-group__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.row-group__title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.row-group__remove {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--danger);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
}

.add-row-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--teal-700);
  background-color: var(--white);
  border: 1px dashed var(--teal-300);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  width: 100%;
  justify-content: center;
  cursor: pointer;
  margin-top: 14px;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.add-row-btn:hover {
  background-color: var(--teal-50);
  border-color: var(--teal-500);
}

/* ----------------------------------------------------------
   6. Auth (login) page
   ---------------------------------------------------------- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--grey-50);
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background-color: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 32px 32px;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  text-align: center;
}

.auth-brand__mark {
  width: 96px;
  height: auto;
  aspect-ratio: 513 / 238;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-brand__mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.auth-brand__name {
  font-size: 21px;
  font-weight: 700;
  color: var(--teal-700);
}

.auth-brand__sub {
  font-size: 13px;
  color: var(--text-muted);
}

.role-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.auth-footer-note {
  margin-top: 20px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Error banner (mock state) */
.error-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background-color: #fbeaea;
  border: 1px solid #e7bcbc;
  border-left: 4px solid var(--danger);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 20px;
}

.error-banner__icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: var(--danger);
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.error-banner__text strong {
  display: block;
  font-size: 13.5px;
  color: var(--danger);
}

.error-banner__text span {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ----------------------------------------------------------
   7. Responsive
   ---------------------------------------------------------- */
@media (max-width: 760px) {
  .form-grid-2,
  .form-grid-3 {
    grid-template-columns: 1fr;
  }
  .field--span-2 {
    grid-column: span 1;
  }
  .form-footer {
    flex-direction: column-reverse;
  }
  .form-footer .btn {
    width: 100%;
  }
}
