/* ==========================================================================
   VinTrip.vn CRM & E-Commerce — Internal Management Portal Stylesheet
   Brand Alignment:
   - Typography: 'Inter' (Web UI from vintrip.vn) + 'Montserrat' (Geometric Futura Display)
   - Primary Brand Navy: #2F2E77 (From "VIN" & logo mark base)
   - Primary Brand Red:  #D72129 (From "TRIP.VN" & logo mark crest)
   - Accent Palette:     #18AED0 (Cyan), #F2B250 (Gold), #156B37 (Green)
   - Responsive:         Desktop 50/50 Split Master Card -> Mobile-First Unified Flow
   ========================================================================== */

/* --- 1. Design Tokens --- */
:root {
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Montserrat', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Official VinTrip Brand Palette */
  --vintrip-navy: #2F2E77;
  --vintrip-navy-hover: #22215c;
  --vintrip-navy-active: #191845;
  --vintrip-navy-light: rgba(47, 46, 119, 0.08);
  --vintrip-navy-focus: rgba(47, 46, 119, 0.16);

  --vintrip-red: #D72129;
  --vintrip-red-hover: #bd1a21;
  --vintrip-red-active: #9f1319;
  --vintrip-red-light: rgba(215, 33, 41, 0.08);
  --vintrip-red-shadow: rgba(215, 33, 41, 0.32);

  /* Accents from Brand Heart Mark */
  --vintrip-cyan: #18AED0;
  --vintrip-green: #156B37;
  --vintrip-gold: #F2B250;
  --vintrip-magenta: #C63A73;

  /* Neutrals */
  --text-dark: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --border-input: #cbd5e1;
  --border-input-hover: #94a3b8;
  --border-input-focus: var(--vintrip-navy);

  /* Geometry */
  --radius-master: 28px;
  --radius-inner: 20px;
  --radius-input: 10px;
  --radius-btn: 10px;

  /* Motion */
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- 2. Base Reset --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  color: var(--text-dark);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;

  /* Scenic Ha Long Bay with VinTrip Navy Atmospheric Tint */
  background: 
    linear-gradient(rgba(18, 22, 50, 0.40), rgba(18, 22, 50, 0.62)),
    url('/images/login-bg.jpg') no-repeat center center fixed;
  background-size: cover;

  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- 3. Accessibility Skip Link --- */
.skip-link {
  position: absolute;
  top: -100px;
  left: 20px;
  background: #ffffff;
  color: var(--vintrip-navy);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  z-index: 9999;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 20px;
  outline: 2px solid var(--vintrip-navy);
}

/* --- 4. Master Floating Card --- */
.card-master {
  width: 100%;
  max-width: 980px;
  min-height: 590px;
  background: #ffffff;
  border-radius: var(--radius-master);
  box-shadow: 
    0 25px 60px -10px rgba(18, 22, 50, 0.50),
    0 10px 25px -5px rgba(18, 22, 50, 0.30);
  padding: 12px;
  display: flex;
  position: relative;
  overflow: hidden;
}

/* --- 5. Left Side: Visual Editorial Hero (Desktop Only) --- */
.visual-panel {
  flex: 1;
  min-height: 550px;
  border-radius: var(--radius-inner);
  background: 
    linear-gradient(180deg, rgba(20, 24, 58, 0.20) 0%, rgba(18, 22, 52, 0.88) 100%),
    url('/images/login-bg.jpg') no-repeat center center;
  background-size: cover;
  position: relative;
  padding: 34px 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #ffffff;
  overflow: hidden;
}

.visual-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 60%, rgba(24, 174, 208, 0.16) 0%, transparent 60%);
  pointer-events: none;
}

.visual-top {
  position: relative;
  z-index: 2;
}

/* White logo badge with crisp brand mark */
.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.96);
  padding: 8px 18px;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(18, 22, 50, 0.35);
}

.brand-logo-img {
  height: 44px;
  width: auto;
  object-fit: contain;
  display: block;
}

.visual-bottom {
  position: relative;
  z-index: 2;
  margin-top: auto;
}

/* Internal Operations Status Pill */
.internal-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 5px 12px;
  font-family: var(--font-display);
  font-size: 0.70rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #ffffff;
  margin-bottom: 12px;
}

.status-indicator-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.4);
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.3);
    opacity: 0.75;
  }
}

.hero-quote-title {
  font-family: var(--font-display);
  font-size: 1.70rem;
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: -0.015em;
  color: #ffffff;
  text-transform: uppercase;
}

.hero-quote-desc {
  font-family: var(--font-sans);
  font-size: 0.84rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.88);
  margin-top: 12px;
  max-width: 370px;
}

/* System Features Pills */
.system-features {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.feature-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(18, 22, 54, 0.50);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 4px 10px;
  border-radius: 6px;
  backdrop-filter: blur(4px);
}

.tag-icon {
  width: 14px;
  height: 14px;
  color: var(--vintrip-cyan);
  flex-shrink: 0;
}

.system-features .feature-tag:nth-child(2) .tag-icon {
  color: var(--vintrip-gold);
}

.hero-quote-tagline {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.78);
  margin-top: 14px;
}

/* --- 6. Right Side: Clean White Form --- */
.form-panel {
  flex: 1.05;
  background: #ffffff;
  padding: 36px 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.form-inner {
  width: 100%;
  max-width: 370px;
}

.form-header {
  margin-bottom: 20px;
}

.form-wordmark-logo {
  height: 38px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  display: block;
  margin-bottom: 12px;
}

.portal-badge-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.portal-pill {
  font-family: var(--font-display);
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: var(--transition);
}

/* Brand Identifier Pill (Executive Navy) */
.portal-pill-brand {
  color: var(--vintrip-navy);
  background: rgba(47, 46, 119, 0.06);
  border: 1px solid rgba(47, 46, 119, 0.16);
}

/* Scope & Security Pill (Ruby Crimson with Lock) */
.portal-pill-internal {
  color: var(--vintrip-red);
  background: rgba(215, 33, 41, 0.06);
  border: 1px solid rgba(215, 33, 41, 0.16);
}

.pill-lock-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  color: var(--vintrip-red);
}

.welcome-heading {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--vintrip-navy);
  letter-spacing: -0.015em;
  margin-bottom: 4px;
}

.welcome-subtitle {
  font-family: var(--font-sans);
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* --- 7. Alert Banners --- */
.alert-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 0.83rem;
  line-height: 1.4;
  margin-bottom: 16px;
}

.alert-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fee2e2;
  color: var(--vintrip-red);
}

.alert-success {
  background: #f0fdf4;
  border: 1px solid #dcfce7;
  color: var(--vintrip-green);
}

/* --- 8. Form Inputs (Enterprise Standard) --- */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.field-group {
  display: flex;
  flex-direction: column;
}

.field-label {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-body);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  height: 46px;
  background: #ffffff;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-input);
  padding: 0 14px;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  color: var(--text-dark);
  outline: none;
  transition: var(--transition);
}

.form-control::placeholder {
  color: var(--text-light);
  font-size: 0.85rem;
}

.form-control:hover {
  border-color: var(--border-input-hover);
}

.form-control:focus {
  border-color: var(--border-input-focus);
  box-shadow: 0 0 0 3px var(--vintrip-navy-focus);
}

.input-password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.form-control-pwd {
  padding-right: 44px;
}

/* Eye Toggle Button */
.eye-toggle-btn {
  position: absolute;
  right: 6px;
  background: none;
  border: none;
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.eye-toggle-btn:hover {
  color: var(--vintrip-navy);
}

.eye-toggle-btn svg {
  width: 20px;
  height: 20px;
}

.is-hidden {
  display: none !important;
}

/* --- 9. Utility Row (Remember Me & Forgot Password) --- */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: -2px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--text-body);
  cursor: pointer;
  user-select: none;
  min-height: 36px;
}

.checkbox-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.custom-checkbox-box {
  width: 18px;
  height: 18px;
  background: #ffffff;
  border: 1.5px solid var(--border-input);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.checkbox-label:hover .custom-checkbox-box {
  border-color: var(--vintrip-navy);
}

.checkbox-label input:checked ~ .custom-checkbox-box {
  background: var(--vintrip-navy);
  border-color: var(--vintrip-navy);
}

.checkbox-label input:checked ~ .custom-checkbox-box::after {
  content: "";
  display: block;
  width: 4px;
  height: 8px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}

.forgot-link {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--vintrip-navy);
  text-decoration: none;
  transition: var(--transition);
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}

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

/* --- 10. Primary Submit Button (VinTrip Crimson Red Signature CTA) --- */
.btn-submit {
  width: 100%;
  height: 48px;
  background: linear-gradient(135deg, #E02830 0%, #C41C23 100%);
  border: none;
  border-radius: var(--radius-btn);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.96rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-top: 4px;
  box-shadow: 0 6px 18px -2px rgba(215, 33, 41, 0.38), 0 2px 5px -1px rgba(215, 33, 41, 0.20);
  transition: var(--transition);
}

.btn-submit:hover {
  background: linear-gradient(135deg, #C41C23 0%, #B0141B 100%);
  box-shadow: 0 10px 24px -2px rgba(215, 33, 41, 0.45);
  transform: translateY(-1px);
}

.btn-submit:active {
  background: #A01218;
  transform: translateY(1px);
}

.btn-submit.is-loading {
  opacity: 0.85;
  pointer-events: none;
}

/* --- 11. Internal Support & Notice Prompt --- */
.form-bottom-prompt {
  margin-top: 14px;
  text-align: center;
  background: rgba(47, 46, 119, 0.03);
  border: 1px dashed rgba(47, 46, 119, 0.20);
  border-radius: 8px;
  padding: 10px 12px;
}

.support-label {
  font-family: var(--font-sans);
  font-size: 0.77rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.support-btn {
  background: none;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.81rem;
  font-weight: 700;
  color: var(--vintrip-navy);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: var(--transition);
  padding: 4px 6px;
  min-height: 36px;
}

.support-btn:hover {
  color: var(--vintrip-red);
  text-decoration: underline;
}

.support-btn-icon {
  width: 14px;
  height: 14px;
}

/* --- 12. System Footer Meta --- */
.system-meta-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  color: var(--text-light);
  font-weight: 500;
}

.meta-dot {
  color: #cbd5e1;
}

/* --- 13. Dialog Modal Styles --- */
.support-modal {
  border: none;
  border-radius: 16px;
  padding: 0;
  background: transparent;
  max-width: 480px;
  width: 90%;
  margin: auto;
  box-shadow: 0 20px 45px rgba(18, 22, 50, 0.35);
}

.support-modal::backdrop {
  background: rgba(18, 22, 50, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 24px;
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  padding-bottom: 14px;
  border-bottom: 1px solid #f1f5f9;
}

.modal-icon-badge {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--vintrip-red-light);
  color: var(--vintrip-red);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-icon-badge svg {
  width: 20px;
  height: 20px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--vintrip-navy);
  margin: 0;
  flex: 1;
}

.modal-close-btn {
  background: none;
  border: none;
  min-width: 44px;
  min-height: 44px;
  padding: 10px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close-btn:hover {
  background: #f3f4f6;
  color: var(--text-dark);
}

.modal-close-btn svg {
  width: 18px;
  height: 18px;
}

.modal-body {
  padding: 16px 0;
}

.modal-desc {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-body);
  line-height: 1.55;
  margin-bottom: 14px;
}

.support-contact-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f8fafc;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  margin-bottom: 12px;
}

.contact-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contact-label {
  font-family: var(--font-sans);
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.contact-value {
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-dark);
}

.contact-link {
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--vintrip-red);
  text-decoration: none;
}

.contact-link:hover {
  text-decoration: underline;
  color: var(--vintrip-red-hover);
}

.modal-note {
  font-family: var(--font-sans);
  font-size: 0.77rem;
  color: var(--text-muted);
  line-height: 1.45;
  font-style: italic;
}

.modal-footer {
  padding-top: 14px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  justify-content: flex-end;
}

.btn-modal-primary {
  background: var(--vintrip-navy);
  color: #ffffff;
  border: none;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  min-height: 44px;
  padding: 10px 22px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-modal-primary:hover {
  background: var(--vintrip-navy-hover);
}

/* ==========================================================================
   14. Mobile-First Responsive Architecture
   - Tablets & Handhelds (<= 860px): Focus strictly on authentication flow
   - Hides desktop-only visual banner to keep primary actions above the fold
   - Eliminates vertical scrolling on iPhone 16 / mobile viewport
   - Enforces iOS Safari 16px font-size to prevent automatic viewport zoom
   - Enlarges touch targets to 44px - 48px thumb zones
   ========================================================================== */

@media (max-width: 860px) {
  body {
    padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)) 16px;
    align-items: center;
  }

  /* Compact Native Mobile Card */
  .card-master {
    flex-direction: column;
    max-width: 410px;
    min-height: auto;
    border-radius: 20px;
    padding: 0;
    box-shadow: 
      0 20px 50px -10px rgba(18, 22, 50, 0.45),
      0 10px 20px -5px rgba(18, 22, 50, 0.25);
  }

  /* Hide Desktop Editorial Banner on Mobile for Maximum Ergonomics */
  .visual-panel {
    display: none !important;
  }

  /* Optimized Mobile Form Panel */
  .form-panel {
    padding: 26px 20px 22px;
    width: 100%;
  }

  .form-inner {
    max-width: 100%;
  }

  /* Centered Mobile Branding Header */
  .form-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 18px;
  }

  .form-wordmark-logo {
    height: 32px;
    max-width: 190px;
    margin-bottom: 10px;
  }

  .welcome-heading {
    font-size: 1.18rem;
    margin-bottom: 4px;
  }

  .welcome-subtitle {
    font-size: 0.80rem;
    line-height: 1.4;
  }

  /* Touch-Optimized Form Controls */
  .auth-form {
    gap: 13px;
  }

  .field-label {
    font-size: 0.80rem;
    margin-bottom: 5px;
  }

  /* Mandatory 16px font-size on iOS Safari to prevent destructive zoom */
  .form-control {
    height: 48px;
    font-size: 16px;
    border-radius: 10px;
  }

  .form-control::placeholder {
    font-size: 0.85rem;
  }

  /* Expanded Thumb Touch Target for Password Toggle */
  .eye-toggle-btn {
    min-width: 48px;
    min-height: 48px;
    right: 2px;
  }

  /* Mobile Utility Row */
  .form-options {
    margin-top: 0;
  }

  .checkbox-label {
    font-size: 0.80rem;
    min-height: 40px;
  }

  .forgot-link {
    font-size: 0.80rem;
    min-height: 40px;
  }

  /* Large Thumb-Friendly Submit Button */
  .btn-submit {
    height: 48px;
    font-size: 0.98rem;
    border-radius: 10px;
    margin-top: 2px;
  }

  /* Compact Bottom Prompts */
  .form-bottom-prompt {
    margin-top: 12px;
    padding: 8px 10px;
  }

  .support-label {
    font-size: 0.74rem;
    margin-bottom: 2px;
  }

  .support-btn {
    font-size: 0.79rem;
    min-height: 34px;
  }

  .system-meta-footer {
    margin-top: 12px;
    padding-top: 10px;
    font-size: 0.70rem;
  }
}

/* Extra Compact Screens (iPhone SE / <= 380px) */
@media (max-width: 380px) {
  body {
    padding: 12px 10px;
  }

  .form-panel {
    padding: 22px 16px 18px;
  }

  .welcome-heading {
    font-size: 1.10rem;
  }

  .form-control {
    height: 46px;
  }

  .btn-submit {
    height: 46px;
  }
}
