/* ===== THEME VARIABLES ===== */
:root {
  /* Light Theme */
  --bg-color: #f9fafb;
  --header-bg: #ffffff;
  --header-border: #e5e7eb;
  --form-bg: #ffffff;
  --form-border: #e5e7eb;
  --form-shadow: 0 4px 6px rgba(0,0,0,0.05);
  --text-primary: #1f2937;
  --text-secondary: #374151;
  --text-muted: #4b5563;
  --input-bg: #ffffff;
  --input-border: #d1d5db;
  --input-focus-border: #3b82f6;
  --input-focus-shadow: rgba(59, 130, 246, 0.3);
  --contact-card-bg: linear-gradient(135deg, #f0f9ff, #e6f7ff);
  --feature-card-bg: linear-gradient(135deg, #f0fdfa, #ccfbf1);
  --card-title-color: #1e40af;
  --card-content-color: #374151;
  --checkmark-color: #16a34a; /* Tailwind green-600 */
}

.dark {
  /* Dark Theme Overrides */
  --bg-color: #111827;
  --header-bg: #1f2937;
  --header-border: #374151;
  --form-bg: #374151;
  --form-border: #4b5563;
  --form-shadow: 0 4px 6px rgba(0,0,0,0.1);
  --text-primary: #f9fafb;
  --text-secondary: #e5e7eb;
  --text-muted: #9ca3af;
  --input-bg: #4b5563;
  --input-border: #6b7280;
  --input-focus-shadow: rgba(96, 165, 250, 0.5);
  --contact-card-bg: linear-gradient(135deg, #1a365d, #153e75);
  --feature-card-bg: linear-gradient(135deg, #134e4a, #115e59);
  --card-title-color: #93c5fd;
  --card-content-color: #e5e7eb;
  --checkmark-color: #4ade80; /* Tailwind green-400 */
}


/* ===== GLOBAL & LAYOUT ===== */
html, body, .main-wrapper {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  display: flex;
  flex-direction: column;
  color: var(--text-secondary);
  direction: ltr; /* Default left-to-right text direction */
}

/* RTL Language Support for Body */
[dir="rtl"] body {
  direction: rtl; /* Right-to-left text direction for RTL languages */
}

.main-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Desktop: Main content as centering container */
@media (min-width: 768px) {
  .main-content {
    flex-grow: 1;
    display: flex;
    align-items: center; /* Center vertically */
    justify-content: center; /* Center horizontally */
    overflow-y: auto;
    padding: 2rem 0; /* Add some breathing room from header/footer */
  }
}

/* Mobile: Keep original behavior */
@media (max-width: 767px) {
  .main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding-bottom: 2rem;
  }
}

.login-container {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 0.5rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

/* Mobile: Restore original login-container behavior */
@media (max-width: 767px) {
  .login-container {
    padding: 0.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
  }
}

.layout-container {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: 1.5rem;
}


/* ===== HEADER ===== */
.login-header {
  background-color: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  padding: 0.5rem 0;
  height: 50px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.login-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0 1rem;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem; /* For spacing between logo and text */
}

.login-logo-img {
  height: 40px; /* Control height via CSS class */
  width: auto;
}

.login-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem; /* Replaces space-x-2 */
}

.language-select {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--input-border);
  border-radius: 0.25rem;
  background-color: var(--input-bg);
  color: var(--text-primary);
}


/* ===== CARDS & FORM ===== */
.cards-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  z-index: 10;
  margin-top: 1.5rem;
}

@media (min-width: 768px) {
  .cards-container {
    grid-template-columns: 1fr 1fr;
    margin-top: 0;
  }
}

.form-container {
  background-color: var(--form-bg);
  border: 1px solid var(--form-border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start; /* Changed from center to flex-start */
  box-shadow: var(--form-shadow);
  z-index: 5;
}

.contact-card, .feature-card {
  border-radius: 0.75rem;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: var(--form-shadow);
}

@media (min-width: 768px) {
  .contact-card, .feature-card {
    aspect-ratio: 1 / 1;
  }
}

.contact-card {
  background: var(--contact-card-bg);
}

.feature-card {
  background: var(--feature-card-bg);
}

.card-title {
  font-size: 1rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
  color: var(--card-title-color);
}

.card-content {
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--card-content-color);
}

/* Accessible SVG checkmark for feature list */
.feature-checkmark {
  width: 1.25rem;
  height: 1.25rem;
  margin-right: 0.5rem;
  color: var(--checkmark-color);
  flex-shrink: 0; /* Prevent icon from shrinking */
}


/* ===== FORM ELEMENTS ===== */
.form-content {
  display: flex;
  flex-direction: column;
  height: auto; /* Changed from 100% to auto */
}

.form-header {
  text-align: center;
  margin-bottom: 1.5rem;
  direction: ltr; /* Default left-to-right text direction */
}

/* RTL Language Support for Form Header */
[dir="rtl"] .form-header {
  direction: rtl; /* Right-to-left text direction for RTL languages */
}

.form-body {
  flex-grow: 0; /* Changed from 1 to 0 to prevent stretching */
}

.form-section {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  margin-bottom: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.dark .form-label {
    color: var(--text-secondary); /* Inherits from variable */
}

.form-input {
  width: 100%;
  border: 1px solid var(--input-border);
  border-radius: 0.5rem;
  padding: 0.85rem;
  background-color: var(--input-bg);
  color: var(--text-primary);
  transition: all 0.2s ease;
  font-size: 1rem;
}

.form-input:focus {
  outline: none;
  border-color: var(--input-focus-border);
  box-shadow: 0 0 0 3px var(--input-focus-shadow);
}


/* ===== BUTTONS & CONTROLS ===== */
.button-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.login-button {
  min-width: 120px;
  background-color: #3b82f6;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 500;
  transition: background-color 0.2s;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.login-button:hover {
  background-color: #2563eb;
}

.dark .login-button {
  background-color: #60a5fa;
}

.dark .login-button:hover {
  background-color: #3b82f6;
}

.theme-toggle {
  background-color: white;
  border-radius: 9999px; /* full circle */
  padding: 0.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  border: none;
  cursor: pointer;
}

.dark .theme-toggle {
  background-color: #f3f4f6; /* A light grey for contrast */
}

/* ===== FOOTER ===== */
.footer-minimal {
  flex-shrink: 0;
  background-color: var(--header-bg); /* Use same as header */
  border-top: 1px solid var(--header-border);
  padding: 1rem 0;
  text-align: center;
  z-index: 20;
}

.footer-minimal p {
  margin: 0;
  padding: 0 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}


/* ===== MOBILE OPTIMIZATIONS ===== */
@media (max-width: 767px) {
  .layout-container, .cards-container {
    gap: 1rem;
  }
  .form-container {
    padding: 1.25rem;
  }
  .form-header {
    margin-bottom: 1.25rem;
  }
  .form-header h1 {
    font-size: 1.35rem;
  }
  .form-header p {
    font-size: 0.9rem;
  }
  .form-section {
    margin-bottom: 1.25rem;
  }
  .form-label {
    font-size: 0.95rem;
  }
  .form-input {
    font-size: 0.95rem;
  }
  .button-container {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .remember-me {
    order: -1;
    margin-bottom: 0.5rem;
  }
  .login-button {
    width: 100%;
    padding: 0.9rem;
  }
}

@media (max-width: 480px) {
  .card-title { font-size: 1rem; }
  .card-content { font-size: 0.85rem; }
  .form-container { padding: 1rem; }
  .form-header h1 { font-size: 1.25rem; }
  .form-header p { font-size: 0.85rem; }
  .footer-minimal p { font-size: 0.75rem; }
}

/* =============================================== */
/* === DESKTOP LAYOUT FIXES (768px and wider) === */
/* =============================================== */
@media (min-width: 768px) {

  /* --- STABLE CONTAINER LAYOUT --- */
  .login-container {
    max-width: 1400px; /* Increased max width for desktop */
    padding: 0 1rem; /* Only horizontal padding */
    width: 100%;
  }

  .layout-container {
    display: grid;
    grid-template-columns: 320px 1fr 320px; /* Fixed side columns for cards, flexible center */
    grid-template-areas: "left-card form-area right-card";
    align-items: center; /* Center all items vertically relative to each other */
    gap: 2rem;
    width: 100%;
    max-width: 1400px; /* Constrain maximum width */
  }

  /* --- FORM: PERFECTLY CENTERED IN MIDDLE COLUMN --- */
  .form-container {
    grid-area: form-area;
    width: 400px;
    max-width: 400px;
    height: 420px; /* Same height as cards for perfect alignment */
    justify-self: center; /* Center in the middle grid column */
    align-self: center; /* Center vertically in grid */
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center; /* Center form content vertically */
  }

  /* --- CARDS: PROPER GRID POSITIONING --- */
  .cards-container {
    display: contents; /* Let individual cards position in grid */
  }

  .contact-card, .feature-card {
    aspect-ratio: unset;
    width: 300px;
    height: 420px; /* Fixed height instead of min-height */
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    justify-self: center; /* Center cards in their grid columns */
    align-self: center; /* Center vertically in grid to match form */
    display: flex;
    flex-direction: column;
    justify-content: center; /* Center content within each card */
  }

  /* FIXED GRID POSITIONS - NO LANGUAGE SWITCHING */
  .contact-card {
    grid-area: left-card; /* Always in left column */
  }

  .feature-card {
    grid-area: right-card; /* Always in right column */
  }

  /* Hover effect for better interactivity */
  .contact-card:hover, .feature-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(0,0,0,0.12);
  }

  /* --- IMPROVED TYPOGRAPHY: Larger and More Organized --- */
  .card-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.3;
    text-align: center;
  }

  .card-content {
    font-size: 1.1rem;
    line-height: 1.6;
    text-align: left; /* Default LTR alignment */
    direction: ltr; /* Default left-to-right text direction */
  }

  /* RTL Language Support for Card Content */
  [dir="rtl"] .card-content {
    text-align: right; /* Right align for RTL languages */
    direction: rtl; /* Right-to-left text direction */
  }

  /* Enhanced feature list styling */
  .feature-card .card-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .feature-card .card-content > div {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0;
    text-align: inherit; /* Inherit text alignment from parent */
    direction: inherit; /* Inherit text direction from parent */
  }

  /* RTL support for feature list items */
  [dir="rtl"] .feature-card .card-content > div {
    flex-direction: row-reverse; /* Reverse icon and text order for RTL */
  }

  /* Enhanced checkmark styling */
  .feature-checkmark {
    width: 1.5rem;
    height: 1.5rem;
    margin-right: 0;
    margin-top: 0.1rem;
    color: var(--checkmark-color);
    flex-shrink: 0;
  }

  /* RTL checkmark positioning */
  [dir="rtl"] .feature-checkmark {
    margin-right: 0;
    margin-left: 0;
  }

  /* --- FORM IMPROVEMENTS: Maintain Proportions --- */
  .form-section {
    margin-bottom: 1.5rem;
  }

  .form-input {
    padding: 0.875rem;
    font-size: 1rem;
  }

  .form-label {
    font-size: 1rem;
    margin-bottom: 0.5rem;
  }

  /* --- FORM CONTENT: Vertical Centering --- */
  .form-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
  }

  .form-section {
    margin-bottom: 1.5rem;
  }

  .form-input {
    padding: 0.875rem;
    font-size: 1rem;
    text-align: left; /* Default LTR alignment */
    direction: ltr; /* Default left-to-right text direction */
  }

  .form-label {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    text-align: left; /* Default LTR alignment */
    direction: ltr; /* Default left-to-right text direction */
  }

  /* RTL Language Support for Form Elements */
  [dir="rtl"] .form-input {
    text-align: right; /* Right align for RTL languages */
    direction: rtl; /* Right-to-left text direction */
  }

  [dir="rtl"] .form-label {
    text-align: right; /* Right align for RTL languages */
    direction: rtl; /* Right-to-left text direction */
  }

  /* --- BUTTON LAYOUT: Improved Organization --- */
  .button-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    direction: ltr; /* Default left-to-right layout */
  }

  .login-button {
    min-width: 140px;
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
  }

  .remember-me {
    margin-bottom: 0;
    direction: ltr; /* Default left-to-right for checkbox text */
  }

  /* RTL Language Support for Button Layout */
  [dir="rtl"] .button-container {
    direction: rtl; /* Right-to-left layout for RTL languages */
    flex-direction: row-reverse; /* Reverse button order for RTL */
  }

  [dir="rtl"] .remember-me {
    direction: rtl; /* Right-to-left for checkbox text */
    flex-direction: row-reverse; /* Reverse checkbox and text order */
  }
}

/* --- LARGE SCREENS: Better Spacing --- */
@media (min-width: 1200px) {
  .layout-container {
    grid-template-columns: 360px 1fr 360px; /* Larger side columns */
    gap: 3rem;
  }

  .contact-card, .feature-card {
    width: 340px; /* Larger cards */
    height: 450px; /* Fixed height for alignment */
    padding: 2.5rem;
  }

  .form-container {
    height: 450px; /* Match card height */
  }

  .card-title {
    font-size: 1.75rem;
  }

  .card-content {
    font-size: 1.2rem;
  }
}

/* --- EXTRA LARGE SCREENS: Maximum Spacing --- */
@media (min-width: 1600px) {
  .layout-container {
    grid-template-columns: 400px 1fr 400px; /* Even larger side columns */
    gap: 4rem;
  }

  .contact-card, .feature-card {
    width: 380px; /* Maximum card size */
    height: 480px; /* Larger fixed height */
    padding: 3rem;
  }

  .form-container {
    height: 480px; /* Match card height */
  }
}
/* Password Toggle Styles */
#toggle-password {
    cursor: pointer;
    background: transparent;
    border: none;
    outline: none;
    padding: 0;
    margin: 0;
    height: 100%;
}

#eye-icon,
#eye-off-icon {
    transition: opacity 0.2s ease;
}

.hidden {
    display: none;
}