/* =========================================
   Premium Split-Panel Form UI
   ========================================= */

:root {
  /* Core Colors */
  --primary: #2b7fff;
  --primary-hover: #1f66d6;
  --primary-light: rgba(43, 127, 255, 0.1);
  
  /* Light Theme */
  --bg-color: #eef2f6;
  --card-bg: #ffffff;
  --text-main: #1a1a1a;
  --text-muted: #6b7280;
  --border-color: #e5e7eb;
  --input-bg: #f9fafb;
  
  /* Brand Panel */
  --brand-bg: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  --brand-text: #ffffff;
  --brand-text-muted: #94a3b8;

  --radius: 20px;
  --font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Dark Mode Overrides */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #0b0f19;
    --card-bg: #1e2433;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --border-color: #374151;
    --input-bg: #111827;
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  -webkit-font-smoothing: antialiased;
}

/* =========================================
   Mobile Optimization & Scaling
   ========================================= */

/* 1. Responsive Layout Logic */
@media (max-width: 860px) {
  body {
    padding: 1rem; /* Smaller padding around the card */
    align-items: flex-start; /* Better for long forms on mobile */
  }

  .premium-card {
    flex-direction: column; /* Stack panels vertically */
    max-width: 500px;
    margin: 0 auto;
  }

  .brand-panel {
    flex: 0 0 auto;
    padding: 2.5rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
  }

  .brand-panel h1 {
    font-size: 1.75rem;
  }

  .brand-panel p {
    margin-bottom: 1.5rem;
  }

  /* Simplify features for mobile to save space */
  .feature-list {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
  }

  .feature-list li {
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 12px;
    border-radius: 50px;
  }

  .form-panel {
    padding: 2rem 1.5rem;
  }

  .input-row {
    flex-direction: column;
    gap: 0; /* Reset gap since margin-bottom handles it on inputs */
  }
}

/* 2. Small Phone & High-Density Fixes */
@media (max-width: 480px) {
  body {
    padding: 0;
    background-color: var(--card-bg); /* Match card to body for "seamless" look */
  }

  .page-wrapper {
    max-width: 100%;
  }

  .premium-card {
    border-radius: 0;
    border: none;
    box-shadow: none;
  }

  .brand-panel {
    padding: 3rem 1rem 2rem;
  }

  /* Scale down the logo to prevent it from dominating the screen */
  .main-logo {
    max-width: 180px;
    margin-bottom: 1.5rem;
  }

  .form-header h2 {
    font-size: 1.5rem;
  }

  /* Increase touch targets for mobile inputs */
  .submit-btn {
    padding: 1.2rem;
    font-size: 1rem;
  }

  .checkmark {
    width: 28px; /* Slightly larger for easier tapping */
    height: 28px;
  }
}

/* 3. Handling the "Blobs" on Mobile */
@media (max-width: 860px) {
  .blob-1 {
    width: 200px;
    height: 200px;
    top: -50px;
    left: -50px;
  }
  .blob-2 {
    width: 150px;
    height: 150px;
    bottom: -30px;
    right: -30px;
  }
}

/* Layout Wrapper */
.page-wrapper {
  width: 100%;
  max-width: 1000px;
}

.premium-card {
  display: flex;
  background-color: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-color);
  animation: scaleIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ================= Left Panel (Branding) ================= */
.brand-panel {
  flex: 0 0 40%;
  background: var(--brand-bg);
  color: var(--brand-text);
  padding: 3rem;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-content {
  position: relative;
  z-index: 2;
}

.logo-mark {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 1.2rem;
  margin-bottom: 2rem;
  letter-spacing: 1px;
}

.brand-panel h1 {
  font-size: 2.2rem;
  line-height: 1.1;
  margin-bottom: 1rem;
  font-weight: 700;
}

.brand-panel p {
  color: var(--brand-text-muted);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 2.5rem;
}

.feature-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.feature-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  font-size: 0.95rem;
}

.feature-list svg {
  width: 20px;
  height: 20px;
  color: var(--primary);
}

/* Abstract Background Blobs */
.blob-1, .blob-2 {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  z-index: 1;
  opacity: 0.5;
}
.blob-1 {
  width: 300px;
  height: 300px;
  background: var(--primary);
  top: -100px;
  left: -100px;
}
.blob-2 {
  width: 250px;
  height: 250px;
  background: #4f46e5;
  bottom: -50px;
  right: -50px;
}

/* ================= Right Panel (Form) ================= */
.form-panel {
  flex: 1;
  padding: 3rem;
}

.form-header {
  margin-bottom: 2.5rem;
}

.form-header h2 {
  font-size: 1.8rem;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.form-header p {
  color: var(--text-muted);
}

.input-row {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.input-row > * { flex: 1; }

/* Floating Label Inputs */
.input-group {
  position: relative;
  margin-bottom: 1.5rem;
}

.input-group input:not([type="time"]),
.input-group textarea {
  width: 100%;
  padding: 1.2rem 1rem 0.6rem 1rem;
  background-color: #111827; /* forced color */
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: #ffffff; /* fixed (also corrected your syntax) */
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.input-group textarea {
  resize: vertical;
  min-height: 120px;
}

.input-group label:not(.static-label) {
  position: absolute;
  left: 1rem;
  top: 1rem;
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
  transition: all 0.2s ease;
}

/* Floating Animation */
.input-group input:focus ~ label,
.input-group input:not(:placeholder-shown) ~ label,
.input-group textarea:focus ~ label,
.input-group textarea:not(:placeholder-shown) ~ label {
  top: 0.4rem;
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 600;
}

.input-group input:focus,
.input-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
  background-color: var(--card-bg);
}

/* Select & Time Inputs (Static labels work better here) */
.static-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.muted { font-weight: 400; opacity: 0.8; }

.input-group select,
.input-group input[type="time"] {
  width: 100%;
  padding: 0.85rem 1rem;
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
}

.input-group select:focus,
.input-group input[type="time"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

/* Custom Checkbox */
.checkbox-wrapper {
  margin: 1rem 0 2rem;
}

.custom-checkbox {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.custom-checkbox input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  width: 24px;
  height: 24px;
  background-color: var(--input-bg);
  border: 2px solid var(--border-color);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.checkmark svg {
  width: 16px;
  height: 16px;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.2s ease;
}

.custom-checkbox input:checked ~ .checkmark {
  background-color: var(--primary);
  border-color: var(--primary);
}

.custom-checkbox input:checked ~ .checkmark svg {
  opacity: 1;
  transform: scale(1);
}

.custom-checkbox input:focus ~ .checkmark {
  box-shadow: 0 0 0 4px var(--primary-light);
}

.checkbox-text {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.checkbox-text a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}
.checkbox-text a:hover { text-decoration: underline; }

/* Premium Submit Button */
.submit-btn {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 8px 20px var(--primary-light);
}

.submit-btn svg {
  width: 20px;
  height: 20px;
  transition: transform 0.2s ease;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(43, 127, 255, 0.25);
}

.submit-btn:hover svg {
  transform: translateX(4px);
}

.submit-btn:active {
  transform: translateY(0);
}

/* Animations */
@keyframes scaleIn {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- THE PERFECT COLOR MATCH AUTOFILL FIX --- */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus,
input:-internal-autofill-selected {
  /* 1. Force the background to match your card color exactly */
  /* If #161c2d isn't quite right, try #111827 or your --card-bg variable */
  -webkit-box-shadow: 0 0 0px 1000px #161c2d inset !important;
  
  /* 2. Force the text to stay white */
  -webkit-text-fill-color: #ffffff !important;
  
  /* 3. Keep the border subtle so it doesn't stand out */
  border: 1px solid rgba(255, 255, 255, 0.1) !important;

  /* 4. Kill the browser's 'blue' highlight */
  caret-color: white;
  
  /* 5. Prevent the color from snapping back if you click away */
  transition: background-color 5000000s ease-in-out 0s;
}

/* Ensure the box doesn't change color when you click it after autofilling */
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0px 1000px #161c2d inset, 0 0 0 2px rgba(43, 127, 255, 0.2) !important;
}

/* --- THE FINAL BOSS OF AUTOFILL FIXES --- */

/* 1. Target every single possible autofill state including internal ones */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-internal-autofill-previewed,
input:-internal-autofill-selected {
    /* Kill the border and outline completely */
    border: 1px solid var(--border-color) !important;
    outline: none !important;
    
    /* Use a very long transition to 'freeze' the styles */
    transition: background-color 50000s ease-in-out 0s, color 50000s ease-in-out 0s;
    
    /* Force the background color using an inset shadow */
    -webkit-box-shadow: 0 0 0px 1000px #161c2d inset !important;
    
    /* Force text color */
    -webkit-text-fill-color: #ffffff !important;
}

/* 2. This specifically targets the "White Border" ring */
input:focus-visible {
    outline: none !important;
    border: 1px solid var(--primary) !important;
}

/* 3. Global reset for the 'Focus' state which causes that white box */
:focus {
    outline: 0 !important;
    outline: none !important;
}

/* 4. This is a hack for Chrome - it stops the 'blue/white' selection border */
::-webkit-contacts-auto-fill-button {
  visibility: hidden;
  display: none !important;
  pointer-events: none;
}

/* --- Final Autofill Fix: No Transparency, No Invisibility --- */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
  /* 1. Force the background to stay dark using an internal shadow */
  /* Use the exact hex code of your card background here if it differs */
  -webkit-box-shadow: 0 0 0px 1000px #161c2d inset !important;
  
  /* 2. Force the text to stay white */
  -webkit-text-fill-color: #ffffff !important;
  
  /* 3. Force the border to stay visible and solid */
  border: 1px solid rgba(255, 255, 255, 0.1) !important;

  /* 4. The Magic Trick: Prevent the browser from ever finishing the color change */
  transition: background-color 50000s ease-in-out 0s;
  
  /* 5. Ensure the font matches your premium look */
  font-family: inherit !important;
  font-size: 1rem !important;
}

/* Ensure that even when clicked/focused, the autofill doesn't freak out */
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0px 1000px #161c2d inset, 0 0 0 4px rgba(43, 127, 255, 0.2) !important;
  border-color: #2b7fff !important;
}

.main-logo {
  display: block;
  width: 100%;
  max-width: 280px; /* Adjust this to control how "big" it feels */
  height: auto;
  margin-bottom: 2.5rem;
  
  /* Adds a subtle premium depth to the image */
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.4));
  
  /* Smooth entrance animation */
  animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* On mobile, we might want the logo a bit smaller to save space */
@media (max-width: 860px) {
  .main-logo {
    max-width: 220px;
    margin-left: auto;
    margin-right: auto;
  }
  
  .brand-panel p {
    text-align: center;
  }
  
  .feature-list {
    align-items: center;
  }
}

.stagger-1 { animation: slideUp 0.5s ease 0.1s both; }
.stagger-2 { animation: slideUp 0.5s ease 0.2s both; }
.stagger-3 { animation: slideUp 0.5s ease 0.3s both; }
.stagger-4 { animation: slideUp 0.5s ease 0.4s both; }
.stagger-5 { animation: slideUp 0.5s ease 0.5s both; }
.stagger-6 { animation: slideUp 0.5s ease 0.6s both; }
.stagger-7 { animation: slideUp 0.5s ease 0.7s both; }

/* Responsive Design */
@media (max-width: 860px) {
  .premium-card {
    flex-direction: column;
  }
  
  .brand-panel {
    padding: 2.5rem 2rem;
  }
  
  .form-panel {
    padding: 2.5rem 2rem;
  }
  
  .input-row {
    flex-direction: column;
    gap: 0;
  }
}

@media (max-width: 480px) {
  body { padding: 0; }
  
  .page-wrapper { max-width: 100%; }
  
  .premium-card {
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
}
