/* =========================================
   AGRITRACK — Auth Pages Stylesheet
   Login & Signup
   ========================================= */

.auth-body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--cream);
  font-family: var(--font-body);
}

/* ---- LAYOUT ---- */
.auth-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  min-height: 100vh;
}
.auth-layout-signup {
  grid-template-columns: 380px 1fr;
}

/* ---- LEFT PANEL ---- */
.auth-panel-left {
  position: relative;
  background: var(--green-deep);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.auth-panel-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(170deg, #0D2B19 0%, #1B4D2E 60%, #246B3F 100%);
}
.auth-panel-pattern {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 10% 90%, rgba(200,151,42,.15) 0%, transparent 50%),
    radial-gradient(circle at 90% 10%, rgba(58,143,88,.12) 0%, transparent 50%),
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 40px,
      rgba(255,255,255,.012) 40px,
      rgba(255,255,255,.012) 41px
    );
}
.auth-panel-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  padding: 36px 40px;
  min-height: 100vh;
}

.auth-back-link {
  font-size: .82rem;
  font-weight: 600;
  color: rgba(255,255,255,.55);
  transition: color var(--transition);
  display: inline-block;
  margin-bottom: 40px;
}
.auth-back-link:hover { color: var(--gold-light); }

.auth-brand {
  text-align: center;
  margin-bottom: 48px;
}
.auth-seal-wrapper {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
}
.auth-seal {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  padding: 4px;
}
.auth-seal-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  background: rgba(255,255,255,.06);
  border-radius: 50%;
  border: 2px solid var(--gold);
}
.auth-brand-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  color: var(--white);
  letter-spacing: -.01em;
  margin-bottom: 6px;
}
.auth-brand-sub {
  font-size: .88rem;
  font-weight: 600;
  color: var(--gold-light);
  margin-bottom: 4px;
}
.auth-brand-loc {
  font-size: .78rem;
  color: rgba(255,255,255,.45);
}

/* Auth features (login left) */
.auth-features {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}
.auth-feature-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.af-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  margin-top: 2px;
}
.auth-feature-item strong {
  display: block;
  font-size: .88rem;
  color: var(--white);
  font-weight: 700;
  margin-bottom: 2px;
}
.auth-feature-item p {
  font-size: .8rem;
  color: rgba(255,255,255,.55);
  margin: 0;
  line-height: 1.5;
}

/* Auth steps (signup left) */
.auth-steps {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}
.auth-steps-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--gold-light);
  margin-bottom: 4px;
}
.auth-step {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--green-deep);
  font-size: .82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.auth-step strong {
  display: block;
  font-size: .88rem;
  color: var(--white);
  font-weight: 700;
  margin-bottom: 2px;
}
.auth-step p {
  font-size: .8rem;
  color: rgba(255,255,255,.55);
  margin: 0;
  line-height: 1.5;
}

.auth-panel-footer {
  font-size: .72rem;
  color: rgba(255,255,255,.3);
  text-align: center;
  padding-top: 32px;
  border-top: 1px solid rgba(255,255,255,.08);
  margin-top: 32px;
}

/* ---- RIGHT PANEL ---- */
.auth-panel-right {
  background: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
}
.auth-panel-right-scroll {
  align-items: flex-start;
  overflow-y: auto;
}
.auth-form-container {
  width: 100%;
  max-width: 440px;
}
.auth-form-container-wide {
  max-width: 540px;
}

.auth-form-header {
  margin-bottom: 36px;
}
.auth-form-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--green-deep);
  margin-bottom: 8px;
}
.auth-form-subtitle {
  font-size: .92rem;
  color: var(--gray);
  line-height: 1.6;
}

/* ---- FORM ELEMENTS ---- */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.form-section-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--green-deep);
  border-bottom: 2px solid var(--green-pale);
  padding-bottom: 8px;
  margin-bottom: -4px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size: .85rem;
  font-weight: 700;
  color: var(--charcoal);
}
.required {
  color: #D1373A;
}
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon {
  position: absolute;
  left: 14px;
  font-size: 1rem;
  pointer-events: none;
  z-index: 1;
  user-select: none;
}
.input-wrapper input,
.input-wrapper select,
.auth-form textarea {
  width: 100%;
  padding: 12px 14px 12px 42px;
  font-family: var(--font-body);
  font-size: .92rem;
  color: var(--charcoal);
  background: var(--white);
  border: 2px solid var(--gray-light);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}
.input-wrapper-select::after {
  content: '▾';
  position: absolute;
  right: 14px;
  color: var(--gray);
  pointer-events: none;
  font-size: .9rem;
}
.input-wrapper input:focus,
.input-wrapper select:focus {
  border-color: var(--green-light);
  box-shadow: 0 0 0 3px rgba(58,143,88,.12);
}
.input-wrapper input.input-error,
.input-wrapper select.input-error {
  border-color: #D1373A;
}
.input-wrapper input.input-success {
  border-color: var(--green-light);
}
.input-toggle {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: 1rem;
  color: var(--gray);
  transition: color var(--transition);
  line-height: 1;
}
.input-toggle:hover { color: var(--green-deep); }

.auth-form textarea {
  padding: 12px 14px;
  resize: vertical;
  min-height: 80px;
  border: 2px solid var(--gray-light);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: .92rem;
  font-family: var(--font-body);
  color: var(--charcoal);
  width: 100%;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.auth-form textarea:focus {
  border-color: var(--green-light);
  box-shadow: 0 0 0 3px rgba(58,143,88,.12);
}

.field-error {
  font-size: .78rem;
  color: #D1373A;
  font-weight: 600;
  min-height: 16px;
}
.field-helper {
  font-size: .78rem;
  color: var(--gray);
}

.form-row-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Checkbox */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .85rem;
  color: var(--charcoal);
  cursor: pointer;
  user-select: none;
}
.checkbox-label input[type="checkbox"] {
  display: none;
}
.checkbox-custom {
  width: 18px;
  height: 18px;
  border: 2px solid var(--gray-light);
  border-radius: 4px;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
}
.checkbox-label input:checked + .checkbox-custom {
  background: var(--green-light);
  border-color: var(--green-light);
}
.checkbox-label input:checked + .checkbox-custom::after {
  content: '✓';
  font-size: .7rem;
  color: var(--white);
  font-weight: 700;
}
.forgot-link {
  font-size: .82rem;
  color: var(--green-light);
  font-weight: 600;
  transition: color var(--transition);
}
.forgot-link:hover { color: var(--green-deep); }

/* Password strength */
.password-strength {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}
.strength-track {
  flex: 1;
  height: 4px;
  background: var(--gray-light);
  border-radius: 2px;
  overflow: hidden;
}
.strength-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  transition: width .4s ease, background .4s ease;
}
.strength-label {
  font-size: .72rem;
  color: var(--gray);
  white-space: nowrap;
  font-weight: 600;
  min-width: 60px;
}

/* Alert */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 600;
}
.alert-error {
  background: #FEF2F2;
  color: #D1373A;
  border: 1px solid #FECACA;
}
.alert-success {
  background: #F0FDF4;
  color: #16A34A;
  border: 1px solid #BBF7D0;
}

/* Submit button */
.btn-submit {
  width: 100%;
  padding: 14px;
  background: var(--green-deep);
  color: var(--white);
  font-family: var(--font-body);
  font-size: .95rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  margin-top: 4px;
}
.btn-submit:hover {
  background: var(--green-mid);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(27,77,46,.25);
}
.btn-submit:active { transform: translateY(0); }
.btn-submit:disabled {
  background: var(--gray);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--gray);
  font-size: .8rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-light);
}

/* Switch */
.auth-switch {
  text-align: center;
  font-size: .88rem;
  color: var(--gray);
}
.auth-switch a {
  color: var(--green-light);
  font-weight: 700;
  transition: color var(--transition);
}
.auth-switch a:hover { color: var(--green-deep); }

/* Roles hint */
.auth-roles-hint {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--gray-light);
}
.roles-hint-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--gray);
  margin-bottom: 10px;
}
.roles-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.role-chip {
  font-size: .72rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid;
}
.role-admin   { background: rgba(27,77,46,.08); color: var(--green-deep); border-color: var(--green-light); }
.role-inv     { background: rgba(200,151,42,.10); color: #7A5800; border-color: var(--gold); }
.role-dist    { background: rgba(0,100,200,.08); color: #1D4ED8; border-color: #93C5FD; }

/* Signup success */
.signup-success {
  text-align: center;
  padding: 48px 24px;
}
.success-icon { font-size: 3.5rem; margin-bottom: 16px; }
.signup-success h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--green-deep);
  margin-bottom: 12px;
}
.signup-success p {
  color: var(--gray);
  font-size: .95rem;
  line-height: 1.65;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 860px) {
  .auth-layout,
  .auth-layout-signup {
    grid-template-columns: 1fr;
  }
  .auth-panel-left {
    min-height: auto;
  }
  .auth-panel-content {
    min-height: auto;
    padding: 28px 24px;
  }
  .auth-back-link { margin-bottom: 20px; }
  .auth-brand { margin-bottom: 24px; }
  .auth-features,
  .auth-steps { display: none; }
  .auth-panel-footer { display: none; }
  .auth-panel-right {
    padding: 36px 24px;
    align-items: flex-start;
  }
  .form-row-2 { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .auth-panel-right { padding: 24px 16px; }
  .form-row-flex { flex-direction: column; align-items: flex-start; gap: 8px; }
  .roles-chips { gap: 6px; }
}
@media (max-width: 360px) {
  .auth-panel-content { padding: 22px 16px; }
  .auth-brand-title { font-size: 1.6rem; }
  .auth-seal-wrapper, .auth-seal { width: 60px; height: 60px; }
}
