/* AgriNex Enterprise Design System - Authentication Stylesheet */
:root {
  --primary-dark: #063c22;
  --primary: #0c5a36;
  --primary-hover: #084c2d;
  --primary-light: #15803d;
  --primary-subtle: #e8f5ed;
  --primary-tint: #f0fdf4;
  --primary-border: #bbf7d0;

  --accent-gold: #f59e0b;
  --accent-gold-light: #fef3c7;
  --accent-blue: #2563eb;
  --accent-blue-light: #eff6ff;
  --accent-purple: #7c3aed;
  --accent-purple-light: #f5f3ff;
  --accent-red: #dc2626;
  --accent-red-light: #fee2e2;
  --accent-emerald: #10b981;

  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-white: #ffffff;

  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --border-default: #e2e8f0;
  --border-strong: #cbd5e1;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-card: 0 10px 25px -5px rgba(15, 23, 42, 0.06), 0 4px 10px -2px rgba(15, 23, 42, 0.03);
  --shadow-elevated: 0 20px 35px -8px rgba(15, 23, 42, 0.12), 0 8px 16px -4px rgba(15, 23, 42, 0.04);

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Auth Header */
.auth-navbar {
  height: 64px;
  background: linear-gradient(180deg, #063c22 0%, #0a4d2c 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  color: #ffffff;
  box-shadow: 0 2px 12px rgba(6, 60, 34, 0.2);
  position: relative;
  z-index: 50;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.auth-logo-box {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.auth-logo-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.auth-brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.auth-brand-accent {
  color: #4ade80;
}

.auth-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.1);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 0.2s ease;
}

.auth-back-link:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  transform: translateX(-2px);
}

/* Auth Main Body */
.auth-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 44px 20px;
  background: radial-gradient(circle at 50% 0%, #ecfdf5 0%, #f8fafc 70%);
  position: relative;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  max-width: 470px;
  width: 100%;
  padding: 36px 32px;
  position: relative;
  transition: box-shadow 0.25s ease;
}

.auth-card:hover {
  box-shadow: var(--shadow-elevated);
}

.auth-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 700;
  margin-bottom: 14px;
  letter-spacing: 0.02em;
}

.role-badge-farmer { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.role-badge-buyer { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.role-badge-logistics { background: #f3e8ff; color: #7e22ce; border: 1px solid #e9d5ff; }
.role-badge-admin { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

.auth-title {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-bottom: 22px;
  line-height: 1.45;
}

/* Demo Credentials Box */
.demo-creds-card {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 22px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.demo-creds-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: 700;
  color: #0c5a36;
}

.btn-one-click {
  background: #0c5a36;
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.btn-one-click:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

/* Form Styles */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background-color: #ffffff;
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  color: var(--text-main);
  transition: all 0.15s ease;
  outline: none;
}

.form-input:focus {
  border-color: #0c5a36;
  box-shadow: 0 0 0 3.5px rgba(12, 90, 54, 0.12);
}

.form-row-remember {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 20px;
  color: var(--text-muted);
}

.form-row-remember a {
  color: #0c5a36;
  font-weight: 700;
  text-decoration: none;
}

.form-row-remember a:hover {
  text-decoration: underline;
}

.btn-submit-auth {
  width: 100%;
  background-color: #0c5a36;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.94rem;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(12, 90, 54, 0.2);
}

.btn-submit-auth:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 18px rgba(12, 90, 54, 0.25);
  transform: translateY(-1.5px);
}

.btn-submit-auth:active {
  transform: translateY(0);
}

.auth-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.auth-footer a {
  color: #0c5a36;
  font-weight: 700;
  text-decoration: none;
}

.auth-footer a:hover {
  text-decoration: underline;
}

.auth-alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 18px;
  display: none;
  line-height: 1.4;
  animation: fadeIn 0.2s ease;
}

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

.auth-alert.error {
  display: block;
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.auth-alert.success {
  display: block;
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

/* Auth Navigation Tabs */
.auth-tabs {
  display: flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 22px;
  gap: 4px;
  border: 1px solid var(--border-default);
}

.auth-tab-btn {
  flex: 1;
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all 0.18s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.auth-tab-btn.active {
  background: #ffffff;
  color: var(--text-main);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.auth-tab-btn:hover:not(.active) {
  color: var(--text-main);
}

/* Form 2-Column Grid */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

/* Role Selector Radio Chips */
.role-chips-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.role-chip-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  background: #f8fafc;
  user-select: none;
}

.role-chip-label input[type="radio"] {
  accent-color: var(--primary);
}

.role-chip-label:hover {
  border-color: #cbd5e1;
  background: #ffffff;
  transform: translateY(-1px);
}

.role-chip-label.active {
  border-color: var(--primary);
  background: var(--primary-tint);
  color: var(--primary);
  box-shadow: 0 2px 6px rgba(12, 90, 54, 0.08);
}

/* Reusable Auth Navigation Tabs */
.auth-tabs {
  display: flex;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 20px;
}

.auth-tab-btn {
  flex: 1;
  text-align: center;
  padding: 9px 12px;
  font-size: 0.84rem;
  font-weight: 700;
  color: #64748b;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.auth-tab-btn:hover {
  color: #0f172a;
}

.auth-tab-btn.active {
  background: #ffffff;
  color: #0c5a36;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Quick Switcher across Stakeholder Logins */
.auth-role-switch-tabs {
  display: flex;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
  margin-bottom: 18px;
  overflow-x: auto;
}

.role-switch-tab {
  flex: 1;
  text-align: center;
  padding: 7px 8px;
  font-size: 0.76rem;
  font-weight: 700;
  color: #64748b;
  text-decoration: none;
  border-radius: 7px;
  transition: all 0.15s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.role-switch-tab:hover {
  background: rgba(255, 255, 255, 0.7);
  color: #0f172a;
}

.role-switch-tab.active {
  background: #ffffff;
  color: #0c5a36;
  font-weight: 800;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.role-switch-tab.active.tab-farmer {
  color: #15803d;
  border-bottom: 2px solid #15803d;
}

.role-switch-tab.active.tab-buyer {
  color: #1d4ed8;
  border-bottom: 2px solid #1d4ed8;
}

.role-switch-tab.active.tab-logistics {
  color: #7e22ce;
  border-bottom: 2px solid #7e22ce;
}

.role-switch-tab.active.tab-admin {
  color: #b91c1c;
  border-bottom: 2px solid #b91c1c;
}

/* =========================================================================
   RESPONSIVE MEDIA QUERIES (Mobile & Tablet Optimization)
   ========================================================================= */
@media (max-width: 768px) {
  .auth-navbar {
    padding: 0 16px;
    height: 56px;
  }

  .auth-brand-text h1 {
    font-size: 1.15rem;
  }

  .auth-brand-text p {
    display: none;
  }

  .auth-container {
    padding: 20px 14px;
  }

  .auth-card {
    padding: 22px 18px;
    border-radius: 14px;
  }

  .auth-header h2 {
    font-size: 1.35rem;
  }

  .auth-role-switch-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .role-switch-tab {
    padding: 6px 10px;
    font-size: 0.72rem;
  }

  .portal-selector-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .form-row {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .btn-auth-primary {
    padding: 12px;
    font-size: 0.92rem;
  }
}

@media (max-width: 480px) {
  .auth-card {
    padding: 18px 14px;
  }

  .auth-footer {
    font-size: 0.76rem;
  }
}

