/* ==========================================================================
   MIGRU.APP CENTRAL LOGIN PORTAL — DESIGN SYSTEM
   Aligned with migruapp.com visual branding & theme
   ========================================================================== */

:root {
  /* Brand Colors from migruapp.com */
  --color-primary: #0b3d6b;
  --color-primary-dark: #082a4a;
  --color-accent: #f5a623;
  --color-accent-hover: #e09510;
  --color-text: #1a1a1a;
  --color-muted: #5c6570;
  --color-bg: #f7f7f5;
  --color-surface: #ffffff;
  --color-border: #e2e6ea;
  
  /* Layout Metrics */
  --radius: 8px;
  --shadow: 0 4px 24px rgba(11, 61, 107, 0.06);
  --shadow-hover: 0 8px 32px rgba(11, 61, 107, 0.12);
  
  /* Header & Footer dimensions from migruapp.com */
  --header-h: 4rem;
  --topbar-h: 2.25rem;
  --footer-h: 3rem; /* Thin elegant single-line footer bar */

  /* Font */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */

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

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text);
  height: 100vh; /* Locked to exactly 100vh on desktop */
  overflow: hidden; /* No vertical or horizontal scroll on desktop */
  display: flex;
  flex-direction: column;
  position: relative;
  line-height: 1.6;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  padding: 0.5rem 1rem;
  background: var(--color-accent);
  color: var(--color-text);
}

.skip-link:focus {
  left: 0;
}

/* ==========================================================================
   AUDIENCE BAR & SITE HEADER (Identical to migruapp.com)
   ========================================================================== */

.audience-bar {
  background: var(--color-primary-dark);
  color: #fff;
  font-size: 0.8125rem;
  flex-shrink: 0; /* Keep it static */
}

.audience-bar__inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--topbar-h);
  padding: 0.25rem 0;
  width: min(1120px, 92vw);
  margin: 0 auto;
}

.audience-bar__nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.audience-bar__nav a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  white-space: nowrap;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.audience-bar__nav a:hover,
.audience-bar__nav a.is-active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.audience-bar__nav a.is-active {
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--color-accent);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  flex-shrink: 0; /* Keep it static */
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
  width: min(1120px, 92vw);
  margin: 0 auto;
}

.logo {
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--color-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.logo span {
  color: var(--color-accent);
}

.site-nav {
  display: flex;
  gap: 1.25rem;
}

.site-nav a {
  text-decoration: none;
  font-weight: 500;
  color: var(--color-text);
  transition: color var(--transition-fast);
}

.site-nav a:hover {
  color: var(--color-accent);
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ==========================================================================
   MAIN CONTENT & STRETCHED HERO FOLD (No scroll needed for hero)
   ========================================================================== */

.main-content {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* Full Viewport Stretched Hero Section (Fills exactly the remaining height) */
.hero-section {
  position: relative;
  width: 100%;
  flex: 1; /* Takes exactly 100% of remaining viewport height */
  overflow: hidden;
  display: flex;
  align-items: center;
}

/* Stretched Background Carousel (Edge to Edge, Top to Bottom) */
.carousel-background {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
}

.carousel-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center center;
  opacity: 0;
  transition: opacity 1.2s ease-in-out;
  z-index: 1;
}

.carousel-slide.active {
  opacity: 1;
  z-index: 2;
}

.carousel-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* Pure branding dark blue semi-transparent overlay matching migruapp.com exact overlay */
  background: rgba(11, 61, 107, 0.72);
  z-index: 3;
  pointer-events: none;
}

/* Centered & aligned container */
.hero-content-container {
  position: relative;
  width: min(1120px, 92vw);
  margin: 0 auto;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 3rem;
  padding: 0;
}

/* Left Side: Caption */
.hero-caption-side {
  flex: 1 1 450px;
  color: #ffffff;
  padding: 0 1rem 0 0;
}

.caption-wrapper {
  max-width: 520px;
}

.caption-item {
  display: none;
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.caption-item.active {
  display: block;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.caption-item h2 {
  font-size: clamp(1.85rem, 4vw, 2.75rem);
  font-weight: 800;
  line-height: 1.15;
  color: #ffffff;
  margin-bottom: 1rem;
  letter-spacing: -1px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.caption-item p {
  font-size: 1.125rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Indicators */
.carousel-indicators {
  margin-top: 2rem;
  display: flex;
  gap: 0.5rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dot:hover {
  background: rgba(255, 255, 255, 0.8);
}

.dot.active {
  width: 24px;
  border-radius: 4px;
  background: var(--color-accent);
  box-shadow: 0 0 10px rgba(245, 166, 35, 0.4);
}

/* Right Side: Form side */
.hero-form-side {
  flex: 1 1 350px;
  display: flex;
  justify-content: flex-end;
  width: 100%;
}

/* White Solid premium card matching marketing site */
.auth-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1.75rem 2rem 2rem;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
  color: var(--color-text);
  margin: 0 auto;
}

/* Role Selector at top of card */
.role-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--color-bg);
  padding: 4px;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  border: 1px solid var(--color-border);
}

.role-btn {
  background: transparent;
  border: none;
  color: var(--color-muted);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 8px 2px;
  cursor: pointer;
  border-radius: 4px;
  text-align: center;
  transition: all var(--transition-fast);
}

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

.role-btn.active {
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(11, 61, 107, 0.08);
}

/* Role Panes */
.role-pane {
  display: none;
  animation: paneFade 0.3s ease;
}

.role-pane.active {
  display: block;
}

/* Tabs (iOS-like Segmented Control) */
.auth-tabs {
  display: flex;
  background: var(--color-bg);
  padding: 4px;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  border: 1px solid var(--color-border);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--color-muted);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 8px;
  cursor: pointer;
  border-radius: 4px;
  transition: all var(--transition-fast);
}

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

.tab-btn.active {
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(11, 61, 107, 0.08);
}

/* Tab Panes */
.tab-pane {
  display: none;
  animation: paneFade 0.3s ease;
}

.tab-pane.active {
  display: block;
}

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

.auth-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.auth-subtitle {
  color: var(--color-muted);
  font-size: 0.9375rem;
  margin-bottom: 1.5rem;
}

/* Form Styles */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
}

.forgot-link {
  font-size: 0.875rem;
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.forgot-link:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  color: var(--color-muted);
  pointer-events: none;
  transition: color var(--transition-fast);
}

input {
  width: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px 12px 10px 40px;
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 400;
  transition: all var(--transition-fast);
}

input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(11, 61, 107, 0.08);
}

input:focus + .input-icon {
  color: var(--color-primary);
}

/* Password Toggle */
.btn-toggle-password {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--color-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
}

.btn-toggle-password:hover {
  color: var(--color-primary);
}

/* Phone Prefix */
.phone-prefix {
  position: absolute;
  left: 12px;
  color: var(--color-text);
  font-weight: 600;
  font-size: 1rem;
  border-right: 1px solid var(--color-border);
  padding-right: 8px;
}

/* Buttons (Matching migruapp.com buttons) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 2px border-transparent;
  text-decoration: none;
}

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

.btn--primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  transform: translateY(-1px);
}

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

/* Social Divider */
.social-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1.25rem 0 1rem;
  color: var(--color-muted);
  font-size: 0.8125rem;
}

.social-divider::before, .social-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--color-border);
}

.social-divider:not(:empty)::before {
  margin-right: .75em;
}

.social-divider:not(:empty)::after {
  margin-left: .75em;
}

/* Social Login Buttons */
.social-buttons {
  display: flex;
  gap: 0.75rem;
}

.btn-social {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px;
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-social:hover {
  background: var(--color-bg);
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.btn-social svg {
  flex-shrink: 0;
}

/* ==========================================================================
   FOOTER (Thin elegant bottom bar)
   ========================================================================== */

.main-footer {
  background: var(--color-primary-dark);
  color: rgba(255, 255, 255, 0.88);
  height: var(--footer-h);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  font-size: 0.8125rem;
  position: relative;
  z-index: 10;
  flex-shrink: 0; /* Keep it static */
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-container {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  gap: 1.25rem;
}

.footer-container p {
  margin: 0;
  white-space: nowrap;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--color-accent);
}

/* ==========================================================================
   RESPONSIVE DESIGN (MEDIA QUERIES)
   ========================================================================== */

@media (max-width: 960px) {
  body {
    height: auto; /* Enable auto-scrolling on tablets & mobiles */
    overflow: auto; /* Enable vertical scroll when vertical wrapping occurs */
  }

  .hero-section {
    height: auto;
    min-height: auto;
    flex: none;
    padding: 3rem 0;
  }

  .hero-content-container {
    flex-direction: column;
    gap: 2.5rem;
    padding-top: 0;
  }

  .hero-caption-side {
    text-align: center;
    padding-right: 0;
  }

  .caption-wrapper {
    max-width: 100%;
  }

  .caption-item h2 {
    font-size: 2.25rem;
  }

  .carousel-indicators {
    justify-content: center;
  }

  .hero-form-side {
    justify-content: center;
  }
}

@media (max-width: 680px) {
  .audience-bar__nav {
    display: none;
  }

  .site-nav {
    display: none;
  }

  .main-header {
    padding: 1rem;
  }

  .header-container {
    flex-direction: column;
    gap: 0.5rem;
  }

  .caption-item h2 {
    font-size: 1.85rem;
  }

  .caption-item p {
    font-size: 1rem;
  }
  
  .auth-card {
    padding: 1.5rem;
  }
  
  .social-buttons {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .main-footer {
    height: auto;
    padding: 1.5rem 1rem;
  }

  .footer-container {
    flex-direction: column;
    text-align: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  
  .footer-container p {
    white-space: normal;
  }

  .footer-links {
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* ==========================================================================
   LEGAL PAGES (scrollable documents)
   ========================================================================== */

body.legal-page {
  height: auto;
  min-height: 100vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

body.legal-page .legal-main {
  flex: 1 0 auto;
  padding: 2rem 0 3rem;
  background: var(--color-bg);
}

body.legal-page .legal-section .container {
  max-width: 48rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

body.legal-page .prose {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  box-shadow: var(--shadow);
}

body.legal-page .prose h1 {
  font-size: 1.75rem;
  color: var(--color-primary);
  margin-bottom: 1rem;
  line-height: 1.3;
}

body.legal-page .prose h2 {
  font-size: 1.2rem;
  color: var(--color-primary);
  margin: 2rem 0 0.75rem;
}

body.legal-page .prose p,
body.legal-page .prose li {
  color: var(--color-muted);
  margin-bottom: 0.75rem;
}

body.legal-page .prose ul,
body.legal-page .prose ol {
  padding-left: 1.25rem;
  margin-bottom: 1rem;
}

body.legal-page .prose blockquote {
  border-left: 3px solid var(--color-accent);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  background: #fff8eb;
  color: var(--color-text);
}

body.legal-page .prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin: 1rem 0 1.5rem;
  overflow-x: auto;
  display: block;
}

body.legal-page .prose th,
body.legal-page .prose td {
  border: 1px solid var(--color-border);
  padding: 0.5rem 0.65rem;
  text-align: left;
  vertical-align: top;
}

body.legal-page .prose th {
  background: #eef3f8;
  color: var(--color-primary);
}

body.legal-page .prose code {
  font-size: 0.875em;
  background: #eef3f8;
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

body.legal-page .prose hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin: 1.5rem 0;
}

body.legal-page .main-footer {
  flex-shrink: 0;
  position: relative;
}
