/* Reset and base styles */
* {
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Header styles */
.app-header {
  text-align: center;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.app-header h1 {
  background: linear-gradient(45deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 3em;
  margin: 0 0 15px 0;
  font-weight: 800;
  letter-spacing: -1px;
}

.app-header h2 {
  color: #4a5568;
  font-size: 1.6em;
  margin: 0 0 10px 0;
  font-weight: 600;
}

.app-header h3 {
  color: #718096;
  font-size: 1.2em;
  margin: 0;
  font-weight: 400;
  font-style: italic;
}

/* Section navigation */
.section-nav {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 25px;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.radio-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 12px 20px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.8);
  min-width: 160px;
  justify-content: center;
  font-weight: 500;
  position: relative;
  overflow: hidden;
}

.radio-label::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  transition: left 0.5s;
}

.radio-label:hover::before {
  left: 100%;
}

.radio-label:hover {
  border-color: #667eea;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.radio-label input[type="radio"] {
  margin-right: 10px;
  transform: scale(1.2);
  accent-color: #667eea;
}

.radio-label input[type="radio"]:checked + span {
  color: #4c51bf;
  font-weight: 600;
}

.radio-label:has(input[type="radio"]:checked) {
  border-color: #667eea;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}

/* Form styles */
.application-form {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.form-section {
  display: none;
}

.form-section.active {
  display: block;
  animation: slideIn 0.4s ease-out;
}

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

.form-section h3 {
  background: linear-gradient(45deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 1.8em;
  margin: 0 0 30px 0;
  padding-bottom: 15px;
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(45deg, #667eea, #764ba2) 1;
  position: relative;
  font-weight: 700;
}

.dynamic-section {
  margin-bottom: 40px;
  padding: 25px;
  background: rgba(102, 126, 234, 0.05);
  border-radius: 16px;
  border: 1px solid rgba(102, 126, 234, 0.1);
}

.dynamic-section h4 {
  color: #4c51bf;
  font-size: 1.3em;
  margin: 0 0 20px 0;
  font-weight: 600;
}

.fields-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 25px;
  margin-bottom: 30px;
}

/* Field styles */
.form-field {
  display: flex;
  flex-direction: column;
}

.form-field.full-width {
  grid-column: 1 / -1;
}

.form-field label {
  font-weight: 600;
  margin-bottom: 8px;
  color: #2d3748;
  display: flex;
  align-items: center;
}

.required {
  color: #e53e3e;
  margin-left: 4px;
  font-size: 1.2em;
}

.form-field input,
.form-field select,
.form-field textarea {
  padding: 14px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(5px);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  background: white;
}

.form-field input:read-only {
  background-color: #f7fafc;
  color: #718096;
}

.form-field textarea {
  resize: vertical;
  min-height: 100px;
}

/* Entry styles */
.entry {
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 25px;
  margin-bottom: 25px;
  position: relative;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(5px);
  transition: all 0.3s ease;
}

.entry:hover {
  border-color: #cbd5e0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.entry h5 {
  color: #4c51bf;
  margin: 0 0 20px 0;
  font-size: 1.1em;
  font-weight: 600;
}

.remove-entry {
  position: absolute;
  top: 15px;
  right: 15px;
  background: linear-gradient(45deg, #fc8181, #e53e3e);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(229, 62, 62, 0.3);
}

.remove-entry:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(229, 62, 62, 0.4);
}

.add-button {
  background: linear-gradient(45deg, #48bb78, #38a169);
  color: white;
  border: none;
  padding: 14px 28px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-self: start;
  box-shadow: 0 4px 15px rgba(72, 187, 120, 0.3);
}

.add-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(72, 187, 120, 0.4);
}

.add-button::before {
  content: '+';
  margin-right: 8px;
  font-size: 18px;
  font-weight: bold;
}

/* Checkbox and radio styles */
.checkbox-group,
.radio-option {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
  background: rgba(102, 126, 234, 0.02);
}

.checkbox-group:hover,
.radio-option:hover {
  background: rgba(102, 126, 234, 0.05);
}

.checkbox-group input[type="checkbox"],
.radio-option input[type="radio"] {
  margin-right: 12px;
  transform: scale(1.3);
  accent-color: #667eea;
}

.checkbox-group label,
.radio-option label {
  cursor: pointer;
  font-weight: normal;
  margin-bottom: 0;
}

/* Signature section */
.signature-section {
  margin-top: 40px;
  padding: 30px;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
}

.signature-section label {
  font-weight: 600;
  margin-bottom: 15px;
  display: block;
  color: #2d3748;
}

/* Form actions */
.form-actions {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 40px;
  padding-top: 30px;
  border-top: 2px solid #e2e8f0;
}

.submit-button,
.reset-button {
  padding: 16px 32px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 160px;
  position: relative;
  overflow: hidden;
}

.submit-button {
  background: linear-gradient(45deg, #667eea, #764ba2);
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.submit-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.reset-button {
  background: linear-gradient(45deg, #a0aec0, #718096);
  color: white;
  box-shadow: 0 4px 15px rgba(160, 174, 192, 0.4);
}

.reset-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(160, 174, 192, 0.5);
}

/* Preview section */
.preview-section {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 30px;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  margin-top: 30px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.preview-section h3 {
  background: linear-gradient(45deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 20px 0;
  font-weight: 600;
}

.preview-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.preview-controls button {
  background: linear-gradient(45deg, #0891b2, #06b6d4);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.preview-controls button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(8, 145, 178, 0.3);
}

#preview-content {
  background: rgba(248, 250, 252, 0.8);
  padding: 25px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  max-height: 500px;
  overflow-y: auto;
}

#preview-content pre {
  margin: 0;
  white-space: pre-wrap;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: #2d3748;
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
}

.preview-table th,
.preview-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
  font-size: 13px;
}

.preview-table th {
  background: rgba(102, 126, 234, 0.1);
  font-weight: 600;
  color: #4c51bf;
}

.hidden {
  display: none;
}

/* Validation styles */
.form-field.error input,
.form-field.error select,
.form-field.error textarea {
  border-color: #e53e3e;
  box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.1);
}

.error-message {
  color: #e53e3e;
  font-size: 13px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  font-weight: 500;
}

.error-message::before {
  content: '⚠';
  margin-right: 6px;
  font-size: 14px;
}

/* Responsive design */
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }
  
  .app-header h1 {
    font-size: 2.2em;
  }
  
  .radio-group {
    flex-direction: column;
    gap: 10px;
  }
  
  .radio-label {
    min-width: auto;
  }
  
  .fields-container {
    grid-template-columns: 1fr;
  }
  
  .application-form {
    padding: 25px;
  }
  
  .form-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .submit-button,
  .reset-button {
    width: 100%;
    max-width: 300px;
  }
  
  .app-header {
    padding: 25px;
  }
  
  .dynamic-section {
    padding: 20px;
  }
}