:root {
  --primary: #0050c8;
  --primary-dark: #003c96;
  --black: #111;
  --white: #fff;
  --gray: #f9f9f9;
  --border: #ddd;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(0,0,0,0.08);
  font-family: "Inter", "Segoe UI", sans-serif;
}

/* Layout */
.modern-form-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
  color: var(--black);
}

/* Header */
.modern-header {
  text-align: center;
  margin-bottom: 2rem;
}
.modern-header h1 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 800;
}
.modern-header p {
  color: #666;
}

/* Form */
.modern-form {
  background: var(--white);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  border: 1px solid var(--border);
}

/* Section titles */
.form-section h2 {
  font-size: 1.1rem;
  font-weight: 700;
  border-left: 5px solid var(--primary);
  padding-left: .5rem;
  margin-bottom: 1rem;
}

/* Grid */
.form-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.span-2 { grid-column: span 2; }

/* Floating labels */
.input-group {
  position: relative;
}
.input-group input,
.input-group select,
.input-group textarea {
  width: 100%;
  padding: 1rem .9rem .6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .95rem;
  background: var(--gray);
  transition: all .2s ease;
}
.input-group label {
  position: absolute;
  left: .9rem;
  top: 1rem;
  color: #666;
  font-size: .9rem;
  pointer-events: none;
  transition: .2s ease all;
}
.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
  border-color: var(--primary);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(0,80,200,0.1);
}
.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label,
.input-group textarea:focus + label,
.input-group textarea:not(:placeholder-shown) + label,
.input-group select:focus + label,
.input-group select:not([value=""]) + label {
  top: .3rem;
  font-size: .75rem;
  color: var(--primary);
}

/* Radios */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
.radio-group label {
  padding: .7rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--gray);
  cursor: pointer;
  transition: all .2s;
}
.radio-group input { margin-right: .4rem; }
.radio-group label:hover { border-color: var(--primary); }

/* Button */
.btn-primary {
  background: var(--black);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  padding: 1rem 1.6rem;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: background .25s ease;
  width: 100%;
}
.btn-primary:hover {
  background: var(--primary-dark);
}

/* Highlight missing fields */
.invalid-highlight {
  animation: pulse 1s ease;
  border-color: red !important;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255,0,0,.5); }
  100% { box-shadow: 0 0 0 10px rgba(255,0,0,0); }
}

/* Responsive */
@media (max-width: 600px) {
  .modern-form { padding: 1.2rem; }
  .form-section h2 { font-size: 1rem; }
}
.hidden { display: none !important; }
.req { color: #d22; }



/* ==== RESPONSIVE FIXES (keep your current look) ==== */
.modern-form-container,
.fg-form { overflow-x: hidden; }

@media (max-width: 900px) {
  /* force one column on tablets/phones */
  .form-grid,
  .grid-auto {
    grid-template-columns: 1fr !important;
  }
  .span-2 {
    grid-column: 1 / -1 !important;
  }
}

@media (max-width: 600px) {
  .modern-form,
  .cv-form { padding: 1rem !important; }

  /* avoid iOS auto-zoom on inputs */
  input, select, textarea { font-size: 16px; }

  /* ensure the submit is reachable */
  .form-submit { position: sticky; bottom: 0; background: linear-gradient(180deg, transparent, #fff 35%); padding-top: .5rem; }
  .btn-primary { width: 100%; }
}

/* highlight first invalid field without breaking your theme */
.invalid-highlight {
  outline: 2px solid #e11; 
  box-shadow: 0 0 0 6px rgba(255, 0, 0, .15) !important;
  border-color: #e11 !important;
}





/* ===== PREVIEW MODAL ===== */
.preview-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.preview-modal.hidden { display: none; }

.modal-content {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 2rem;
  animation: fadeIn .25s ease;
}
@keyframes fadeIn { from{opacity:0;transform:translateY(10px);} to{opacity:1;transform:none;} }

.preview-body p { margin: .6rem 0; color: #333; }
.modal-actions {
  display: flex; gap: 1rem; justify-content: flex-end; margin-top: 1.5rem;
}
.btn-secondary {
  background: #f0f0f0; color: #111; border-radius: 10px;
  padding: .8rem 1.2rem; cursor: pointer; font-weight: 600;
}
.btn-secondary:hover { background: #e0e0e0; }




/* ==== SUCCESS MESSAGE ==== */
.form-success {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 100vh;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn .3s ease;
}
.success-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 6px 30px rgba(0,0,0,0.25);
  padding: 2rem 2.5rem;
  text-align: center;
  max-width: 400px;
  width: 90%;
}
.success-card h3 {
  color: #0a9f3d;
  margin-bottom: .5rem;
  font-size: 1.3rem;
}
.success-card p { color: #333; }
.fade-out { opacity: 0; transition: opacity 1.5s ease; }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
