/* M3 Forms CSS - Extracted from Form.cshtml */

:root {
  --md-sys-color-primary: #001740;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-surface: #FFFFFF;
  --md-sys-color-surface-container: #FFFFFF;
  --md-sys-color-surface-container-highest: #FFFFFF;
  --md-sys-color-outline: #162650;
  --md-sys-color-outline-variant: rgba(22, 38, 80, 0.12);
  --md-sys-color-error: #ba1a1a;
  --md-sys-color-on-surface: #162650;
  --md-sys-color-on-surface-variant: #162650;
}

:root {
  --md-ref-typeface-brand: 'Rubik Variable', sans-serif;
  --md-ref-typeface-plain: 'Rubik Variable', sans-serif;
}

.md3 .umbraco-forms-fieldset md-filled-text-field {
  border-radius: 4px 4px 0 0 !important;
}

.md3 input[type=number]::-webkit-inner-spin-button,
.md3 input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.md3 input[type=number] {
  -moz-appearance: textfield;
}

/* Placeholder styling for Material Design 3 components - dimmer style */
.md3 md-filled-text-field::part(input)::placeholder,
.md3 md-filled-select::part(input)::placeholder {
  color: #6b7280;
  opacity: 0.7;
  font-weight: 400;
}

/* Fieldset styling */
.md3 .umbraco-forms-fieldset {
  border: none;
  padding: 0;
  margin: 0 0 24px 0;
}

.md3 .umbraco-forms-fieldset legend {
  font-size: 18px;
  font-weight: 600;
  color: #162650;
  margin-bottom: 16px;
  padding: 0;
}

/* Field wrapper styling */
.md3 .umbraco-forms-field-wrapper {
  margin-bottom: 16px;
}

.md3 .umbraco-forms-field-wrapper:last-child {
  margin-bottom: 0;
}

/* Label styling */
.md3 .umbraco-forms-field-wrapper label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #162650;
  margin-bottom: 8px;
}

/* Required field indicator */
.md3 .umbraco-forms-field-wrapper label.required::after {
  content: " *";
  color: #ba1a1a;
}

/* Error styling */
.md3 .field-validation-error {
  color: #ba1a1a;
  font-size: 12px;
  margin-top: 4px;
  display: block;
}

.md3 .field-validation-valid:not(.umbraco-forms-field-wrapper):not(.md3-checkbox-wrapper):not(.md3-dataconsent-wrapper):not(.md3-radio-wrapper) {
  display: none;
}

/* Material Design 3 component styling */
.md3 md-filled-text-field,
.md3 md-filled-select {
  width: 100%;
  --md-filled-text-field-container-color: #FFFFFF;
  --md-filled-text-field-input-text-color: #162650;
  --md-filled-text-field-label-text-color: #162650;
  --md-filled-text-field-supporting-text-color: #162650;
  --md-filled-text-field-error-text-color: #ba1a1a;
  --md-filled-text-field-input-text-placeholder-color: #6b7280;
  --md-filled-text-field-input-text-placeholder-opacity: 0.7;
  --md-filled-text-field-input-text-placeholder-weight: 400;
}

/* Filled variant: witte achtergrond + alleen onderrand */
.md3 md-filled-text-field::part(container),
.md3 md-filled-select::part(container) {
  background: #fff;
  box-shadow: none !important;
}

.md3 md-filled-text-field::part(field), 
.md3 md-filled-select::part(field) {
  background: #fff;
}

.md3 md-filled-text-field::part(container) { 
  border-bottom: 1px solid #162650; 
  border-radius: 8px 8px 0 0; 
}

.md3 md-filled-select::part(container) { 
  border-bottom: 1px solid #162650; 
  border-radius: 8px 8px 0 0; 
}

/* Error state styling */
.md3 .umbraco-forms-field-wrapper:has(.field-validation-error) md-filled-text-field::part(container) { 
  border-bottom-color: var(--md-sys-color-error) !important;
}

.md3 .umbraco-forms-field-wrapper:has(.field-validation-error) md-filled-select::part(container) { 
  border-bottom-color: var(--md-sys-color-error) !important;
}

.md3 .umbraco-forms-field-wrapper:has(.field-validation-error) md-filled-select { 
  error: true;
}

/* Forceer witte container via tokens (voor browsers/versies die parts negeren) */
.md3 md-filled-text-field,
.md3 md-filled-select {
  --md-filled-text-field-container-color: #FFFFFF;
  --md-select-container-color: #FFFFFF;
}

/* Native select (multiple) fallback */
.md3 select {
  width: 100%;
  border: none;
  border-bottom: 1px solid #162650;
  background: #fff;
  padding: 12px 16px;
  font-size: 16px;
  color: #162650;
  border-radius: 8px 8px 0 0;
  padding: 12px 16px;
}

.md3 select:focus { 
  outline: none; 
  border-bottom-color: var(--md-sys-color-primary); 
}

/* Checkbox styling - green theme */
.md3 md-checkbox {
  --md-checkbox-selected-icon-color: #001740;
  --md-checkbox-selected-focus-icon-color: #001740;
  --md-checkbox-selected-hover-icon-color: #001740;
  --md-checkbox-selected-pressed-icon-color: #001740;
  --md-checkbox-unselected-focus-outline-color: #001740;
  --md-checkbox-unselected-hover-outline-color: #001740;
  --md-checkbox-unselected-pressed-outline-color: #001740;
}

/* Radio button styling */
.md3 md-radio {
  --md-radio-selected-icon-color: #001740;
  --md-radio-selected-focus-icon-color: #001740;
  --md-radio-selected-hover-icon-color: #001740;
  --md-radio-selected-pressed-icon-color: #001740;
  --md-radio-unselected-focus-outline-color: #001740;
  --md-radio-unselected-hover-outline-color: #001740;
  --md-radio-unselected-pressed-outline-color: #001740;
}

/* File upload styling */
/* .md3 .md3-file {
  position: relative;
  display: block;
  width: 100%;
  padding: 12px 12px 8px 16px;
  border-radius: 8px 8px 0 0;
  border-bottom: 1px solid #162650;
  background: #FFFFFF;
} */

.md3 .md3-text-field__outline { 
  display: none; 
}

.md3 .md3-file__input {
  display: none;
}

.md3 .md3-file__placeholder { 
  color: #6b7280; 
  overflow: hidden; 
  text-overflow: ellipsis; 
  padding-right: 12px; 
  opacity: 0.7; 
  font-weight: 400; 
}

.md3 .md3-file__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 12px 8px 16px;
  border-radius: 8px 8px 0 0;
  border-bottom: 1px solid #162650;
  background: #FFFFFF;
}

.md3 .md3-file:focus-within .md3-file__label { 
  border-bottom-color: var(--md-sys-color-primary); 
}

.md3 .md3-file__input.input-validation-error + .md3-file__label { 
  border-bottom-color: var(--md-sys-color-error); 
}

/* Textarea styling */
.md3 md-filled-text-field[type="textarea"] {
  --md-filled-text-field-container-height: 120px !important;
  --md-filled-text-field-input-text-line-height: 1.5 !important;
}

.md3 md-filled-text-field[type="textarea"]::part(input) {
  resize: vertical;
  min-height: 100px !important;
  max-height: 200px !important;
  overflow-y: auto !important;
  line-height: 1.5 !important;
}

/* Force height on the container as well */
.md3 md-filled-text-field[type="textarea"] {
  --md-filled-text-field-container-height: 120px !important;
}

/* Auto-grow textarea class */
.md3 .auto-grow-textarea {
  transition: height 0.2s ease-out !important;
}

/* Additional specificity for Material Design components */
.md3 md-filled-text-field[type="textarea"]::part(container) {
  min-height: 120px !important;
}

/* File upload size indicators and visual feedback */
.md3-file__size-info {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  margin-top: 4px;
  display: inline-block;
  font-weight: 500;
}

.md3-file__size-info--ok {
  background: #e8f5e8;
  color: #2e7d32;
  border: 1px solid #4caf50;
}

.md3-file__size-info--warning {
  background: #fff3e0;
  color: #f57c00;
  border: 1px solid #ff9800;
}

.md3-file__size-info--error {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #f44336;
}

.md3-file__size-info .file-size {
  font-weight: 600;
}

/* Enhanced file upload error styling */
.md3-file__error {
  color: #c62828;
  border-color: #f44336;
}

/* File upload container improvements */
.md3-file {
  position: relative;
}

.md3-file__error {
  margin-top: 4px;
  color: #c62828;
  line-height: 1.4;
}

.md3-file__error br {
  margin-bottom: 4px;
}

/* Individual file management styling */
.md3-file__list {
  margin-top: 8px;
  background: #fafafa;
  padding: 8px;
}

.md3-file__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px;
  margin-bottom: 4px;
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.md3-file__item:last-child {
  margin-bottom: 0;
}

.md3-file__item:hover {
  border-color: #001740;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.file-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.file-name {
  font-weight: 500;
  font-size: 14px;
  word-break: break-all;
}

.file-size {
  font-size: 12px;
  font-weight: 500;
}

.file-size.ok {
  color: #2e7d32;
}

.file-size.warning {
  color: #f57c00;
}

.file-size.error {
  color: #c62828;
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.md3-file__remove {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.md3-file__remove:hover {
  background: #ffebee;
  color: #c62828;
}

.md3-file__add-more {
  margin-top: 8px;
  text-align: center;
}

.md3-file__add-button {
  background: #001740;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.md3-file__add-button:hover {
  background: #002a5c;
  transform: translateY(-1px);
}

/* File size breakdown styling */
.md3-file__size-breakdown {
  margin-top: 8px;
  padding: 8px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  background: white;
}

.file-item {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 12px;
}

.file-item:last-child {
  border-bottom: none;
}

.file-item.error {
  background: #ffebee;
  color: #c62828;
}

.file-item.warning {
  background: #fff3e0;
  color: #f57c00;
}

.file-item.ok {
  background: #e8f5e8;
  color: #2e7d32;
}

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus management for accessibility */
.md3-file__input:focus {
  outline: 2px solid #001740;
  outline-offset: 2px;
}

.md3-file__add-button:focus {
  outline: 2px solid #001740;
  outline-offset: 2px;
}

.md3-file__button:focus {
  outline: 2px solid #001740;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .md3-file__item {
    border: 1px solid;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .md3-file__item,
  .md3-file__add-button {
    transition: none;
  }
}

/* Conditional fields styling */
.md3 .conditional-hidden {
  display: none !important;
}

.md3 .conditional-visible {
  display: block !important;
}

/* Button styling */
.md3 .md3-file__button {
  background: #001740;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.md3 .md3-file__button:hover {
  background: #002a5c;
  transform: translateY(-1px);
}

.md3 .md3-file__button:active {
  transform: translateY(0);
}

/* Password field styling - match text input appearance */
.md3 md-filled-text-field[type="password"] {
  --md-filled-text-field-container-color: #FFFFFF;
  --md-filled-text-field-input-text-color: #162650;
  --md-filled-text-field-supporting-text-color: #162650;
}

.md3 md-filled-text-field[type="password"]::part(container) {
  background: #fff !important;
  border-bottom: 1px solid #162650 !important;
  border-radius: 8px 8px 0 0 !important;
}

.md3 md-filled-text-field[type="password"]::part(field) {
  background: #fff !important;
}

.md3 md-filled-text-field[type="password"]:focus-within::part(container) {
  border-bottom-color: #001740 !important;
}

.md3 md-filled-text-field[type="password"][error]::part(container) {
  border-bottom-color: #ba1a1a !important;
}

.md3 md-filled-text-field[type="password"]::part(input) {
  color: #162650 !important;
  caret-color: #162650 !important;
}

/* Password field placeholder styling */
.md3 md-filled-text-field[type="password"] {
  --md-filled-text-field-input-text-placeholder-color: #6b7280;
  --md-filled-text-field-input-text-placeholder-opacity: 0.7;
  --md-filled-text-field-input-text-placeholder-weight: 400;
}

.md3 md-filled-text-field[type="password"]::part(input)::placeholder {
  color: #6b7280 !important;
  opacity: 0.7 !important;
  font-weight: 400 !important;
}

.md3 md-filled-text-field[type="password"]::part(label) {
  color: #162650 !important;
}

.md3 md-filled-text-field[type="password"]:focus-within::part(label) {
  color: #162650 !important;
}

/* Password autofill styling */
.md3 md-filled-text-field[type="password"]:has(input:-webkit-autofill)::part(container) {
  background-color: #FFFFFF !important;
  border-radius: 8px 8px 0 0 !important;
}

.md3 md-filled-text-field[type="password"]:has(input:-webkit-autofill)::part(container) {
  background-color: #FFFFFF !important;
  border-bottom: 1px solid #162650 !important;
}

.md3 md-filled-text-field[type="password"]:has(input:-webkit-autofill)::part(field) {
  background-color: #FFFFFF !important;
}

/* M3 Button Styling */
.md3 .btn {
  display: inline-block;
  padding: 16px 25px;
  border: none;
  border-radius: 4px;
  font-size: 18px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  line-height: 1.2;
}

.md3 .btn-primary {
  height: 56px;
  background-color: #001740;
  color: #fff;
  border: 2px solid #001740;
}

.md3 .btn-primary:hover {
  background-color: #002a5c;
  border-color: #002a5c;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 23, 64, 0.3);
}

.md3 .btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 23, 64, 0.3);
}

.md3 .btn-primary:focus {
  outline: 2px solid #001740;
  outline-offset: 2px;
}

.md3 .btn-secondary {
  height: 56px;
  background-color: transparent;
  color: #001740;
  border: 2px solid #001740;
}

.md3 .btn-secondary:hover {
  background-color: #001740;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 23, 64, 0.2);
}

.md3 .btn-secondary:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 23, 64, 0.2);
}

.md3 .btn-secondary:focus {
  outline: 2px solid #001740;
  outline-offset: 2px;
}

/* Form navigation styling */
.md3 .umbraco-forms-navigation {
  margin-top: 32px;
  display: flex;
  gap: 16px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

/* Buttons */
.md3 .umbraco-forms-field-wrapper > span[data-valmsg-for] {
  display: none !important;
}

