/* ═══════════════════════════════════════════════════
   iTRABAHO — Login Page Styles
   Sections:
     1. CSS Variables & Reset
     2. Layout (Left + Right Panels)
     3. Left Panel (Branding)
     4. Login Card & Header
     5. Role Selector Cards
     6. Form Elements
     7. Alert & Spinner
     8. Responsive Breakpoints
   ═══════════════════════════════════════════════════ */


/* ── 1. CSS Variables & Reset ─────────────────────── */
:root {
  --primary:      #E8630A;
  --primary-dark: #C0510A;
  --secondary:    #1A3A5C;
  --accent:       #F5A623;
  --bg:           #F2EDE6;
  --text:         #1C2B3A;
  --muted:        #6B7C8D;
  --success:      #2D9E6B;
  --border:       #E2D9CE;
  --white:        #ffffff;

  --radius-sm:    10px;
  --radius-md:    13px;
  --radius-lg:    22px;

  --shadow-card:  0 8px 40px rgba(0, 0, 0, 0.08);
  --shadow-btn:   0 4px 20px rgba(232, 99, 10, 0.28);
  --focus-ring:   0 0 0 3px rgba(232, 99, 10, 0.12);
}

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

html,
body {
  height: 100%;
  font-family: 'Barlow', sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  min-height: 100vh;
}


/* ── 2. Layout (Left + Right Panels) ─────────────── */
.left-panel {
  width: 50%;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.right-panel {
  flex: 1;
  background:
    radial-gradient(circle at -5% 8%, rgba(232, 99, 10, 0.16) 0, rgba(232, 99, 10, 0.16) 105px, transparent 106px),
    radial-gradient(circle at 104% 18%, rgba(245, 166, 35, 0.17) 0, rgba(245, 166, 35, 0.17) 125px, transparent 126px),
    radial-gradient(circle at 8% 93%, rgba(232, 99, 10, 0.11) 0, rgba(232, 99, 10, 0.11) 92px, transparent 93px),
    radial-gradient(circle at 108% 92%, rgba(245, 166, 35, 0.14) 0, rgba(245, 166, 35, 0.14) 115px, transparent 116px),
    var(--bg);
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  min-height: 100vh;
}


/* ── 3. Left Panel (Branding) ─────────────────────── */
.left-panel {
  background: linear-gradient(150deg, var(--secondary) 0%, #0d2540 55%, #1a3a5c 100%);
  padding: 48px 52px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Decorative blobs */
.left-panel::before,
.left-panel::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.left-panel::before {
  top: -80px;
  right: -80px;
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(232, 99, 10, 0.28) 0%, transparent 70%);
}
.left-panel::after {
  bottom: -100px;
  left: -60px;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(245, 166, 35, 0.2) 0%, transparent 70%);
}

.lp-content {
  position: relative;
  z-index: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo {
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 42px;
  color: var(--white);
  letter-spacing: -1px;
  line-height: 1;
}
.logo span { color: var(--accent); }

.logo-sub {
  color: rgba(255, 255, 255, 0.55);
  font-size: 16px;
  margin-top: 8px;
  margin-bottom: 52px;
}

.hero-heading {
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 56px;
  line-height: 1.15;
  color: var(--white);
  margin-bottom: 24px;
}
.hero-heading .highlight { color: var(--accent); }

.hero-desc {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.75;
  max-width: 380px;
}


/* ── 4. Login Card & Header ───────────────────────── */
.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 38px 40px;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-card);
  border: 1.5px solid var(--border);
}

.card-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #FFF1E8;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 13px;
  border-radius: 20px;
  border: 1px solid #F5C9A8;
  font-family: 'Nunito', sans-serif;
  margin-bottom: 14px;
}

.card-title {
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 24px;
  color: var(--text);
  margin-bottom: 4px;
}

.auth-card-brand {
  margin: 0 0 24px;
  color: var(--primary);
  font: 900 27px/1 'Nunito', sans-serif;
  letter-spacing: -0.8px;
  text-align: center;
}

.auth-card-restriction {
  text-align: center;
}

.card-sub {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 22px;
}


/* ── 5. Role Selector Cards ───────────────────────── */
.role-section-label {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.role-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 22px;
}

.role-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 12px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.role-card:hover {
  border-color: var(--primary);
  background: #FFF1E8;
}
.role-card.selected {
  border-color: var(--primary);
  background: #FFF1E8;
  box-shadow: var(--focus-ring);
}
.role-card.selected::after {
  content: '✓';
  position: absolute;
  top: 7px;
  right: 10px;
  font-size: 11px;
  font-weight: 800;
  color: var(--primary);
  font-family: 'Nunito', sans-serif;
}

.role-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(232, 99, 10, 0.1);
  border-radius: 10px;
  color: var(--primary);
}

.role-name {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 13px;
  color: var(--text);
}

.role-desc {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  line-height: 1.3;
}


/* ── 6. Form Elements ─────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label-custom {
  display: block;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 7px;
}

/* Wrapper for icon + input combos */
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon-left {
  position: absolute;
  left: 15px;
  color: var(--muted);
  display: flex;
  pointer-events: none;
}

/* Toggle password button */
.input-icon-right {
  position: absolute;
  right: 15px;
  display: flex;
  align-items: center;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
}
.input-icon-right:hover { color: var(--text); }

.phone-prefix {
  position: absolute;
  left: 15px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  z-index: 1;
  pointer-events: none;
}

.form-control-custom {
  width: 100%;
  padding: 13px 15px 13px 44px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 11px;
  font-size: 15px;
  font-family: 'Barlow', sans-serif;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.form-control-custom.phone-field { padding-left: 52px; }
.form-control-custom:focus {
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
  background: var(--white);
}
.form-control-custom.is-invalid { border-color: #dc3545; }

.field-err {
  display: none;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: 12px;
  color: #dc3545;
  margin-top: 5px;
}

/* Remember + Forgot row */
.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.remember-label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  margin-bottom: 14px;
}

.custom-checkbox {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background: var(--primary);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.forgot-link {
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s;
}
.forgot-link:hover { color: var(--primary-dark); }

/* Submit button */
.btn-login {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 14px;
  background: var(--primary);
  color: var(--white);
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 16px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  transition: background 0.15s, transform 0.1s;
  margin-bottom: 18px;
}
.btn-login:hover   { background: var(--primary-dark); }
.btn-login:active  { transform: scale(0.98); }
.btn-login:disabled { opacity: 0.65; cursor: not-allowed; }

/* Register link row */
.register-row {
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}
.register-row a {
  color: var(--primary);
  font-weight: 700;
  font-family: 'Nunito', sans-serif;
  text-decoration: none;
  transition: color 0.15s;
}
.register-row a:hover { color: var(--primary-dark); }

.login-options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 16px;
}
.login-options-row .remember-label { margin: 0; }
.forgot-password-link { color: var(--primary); font-size: 13px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.forgot-password-link:hover { color: var(--primary-dark); text-decoration: underline; }


/* ── 7. Alert & Spinner ───────────────────────────── */
.alert-custom {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  margin-bottom: 14px;
  background: #FDECEA;
  border: 1.5px solid #F5C6C0;
  border-radius: var(--radius-sm);
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: 13px;
  color: #C62828;
}
.alert-custom.pending {
  background: #FFF8E8;
  border-color: #F5DCA0;
  color: #8B6914;
}
.alert-custom.show { display: flex; }

.spinner {
  display: none;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }


/* ── 8. Responsive Breakpoints ────────────────────── */

/* Tablet and wider — keep side‑by‑side layout */
@media (min-width: 961px) {
  body {
    display: flex;
    flex-direction: row;
    height: 100vh;
  }

  .left-panel {
    width: 40%;
    padding: 60px 40px;
  }

  .right-panel {
    flex: 1;
    padding: 48px 40px;
  }
}

/* Mobile — one vertical stack, slim left panel upfront */
@media (max-width: 960px) {
  body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }

  /* Slim left panel (just branding) */
  .left-panel {
    width: 100%;
    height: auto; /* Overrides 100vh */
    position: relative; /* Fix: Overrides sticky from desktop */
    padding: 24px 20px;
    background: linear-gradient(150deg, var(--secondary) 0%, #0d2540 55%, #1a3a5c 100%);
    order: 1;
  }

  .lp-content {
    max-width: 420px;
    margin: 0 auto;
    text-align: center;
  }

  .logo {
    font-size: 32px;
  }

  .logo-sub {
    font-size: 14px;
    margin-bottom: 28px;
  }

  .hero-heading {
    font-size: 28px;
    line-height: 1.15;
    margin-bottom: 12px;
  }

  .hero-desc {
    display: none;
  }

  /* Login panel below left panel */
  .right-panel {
    flex: 1;
    width: 100%;
    min-height: auto; /* Fix: Stops the extra 100vh scrolling issue */
    padding: 28px 20px;
    background: var(--white);
    order: 2;
  }

  .login-card {
    width: 100%;
    max-width: 400px;
    padding: 28px 24px;
    margin: 0 auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1.5px solid var(--border);
    border-radius: 16px;
  }

  .card-title {
    font-size: 20px;
    margin-bottom: 4px;
  }

  .card-sub {
    font-size: 13px;
    margin-bottom: 16px;
  }

  .role-cards {
    gap: 8px;
  }

  .role-card {
    padding: 10px 8px;
    font-size: 12px;
  }

  .role-name {
    font-size: 12px;
  }

  .meta-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .btn-login {
    font-size: 14px;
    padding: 12px;
  }

  .register-row {
    font-size: 13px;
  }
}

/* Phones: keep the login task first. The branding hero remains on desktop
   and tablet, but does not push the form below the fold on a small screen. */
@media (max-width: 600px) {
  .left-panel { display: none; }

  .right-panel {
    min-height: 100svh;
    padding: 20px 16px;
    justify-content: center;
    background:
      radial-gradient(circle at -5% 8%, rgba(232, 99, 10, 0.16) 0, rgba(232, 99, 10, 0.16) 105px, transparent 106px),
      radial-gradient(circle at 104% 18%, rgba(245, 166, 35, 0.17) 0, rgba(245, 166, 35, 0.17) 125px, transparent 126px),
      radial-gradient(circle at 8% 93%, rgba(232, 99, 10, 0.11) 0, rgba(232, 99, 10, 0.11) 92px, transparent 93px),
      radial-gradient(circle at 108% 92%, rgba(245, 166, 35, 0.14) 0, rgba(245, 166, 35, 0.14) 115px, transparent 116px),
      #FFF8F3;
  }

  .login-card {
    padding: 24px 20px;
  }
}

/* Very small screens */
@media (max-width: 360px) {
  .left-panel { padding: 20px 16px; }
  .logo { font-size: 28px; }
  .hero-heading { font-size: 24px; }
  .login-card {
    max-width: 100%;
    padding: 20px 16px;
  }
}
