/* RESET */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Global Styles */
@import url("https://fonts.googleapis.com/css2?family=Public+Sans:wght@400;500;600;700&display=swap");

:root {
  --primary-color: #0445af;
  --error-color: #e74c3c;
  --success-color: #2ecc71;
  --text-color: #333;
  --text-light: #666;
  --border-color: #ccc;
  --bg-light: #f5f8ff;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
}

/* Ensure proper focus styles for accessibility */
*:focus-visible {
  outline: 3px solid var(--primary-color);
  outline-offset: 2px;
}

html,
body {
  font-family: "Public Sans", "Helvetica Neue", Arial, sans-serif;
  background-color: #fff;
  color: var(--text-color);
  line-height: 1.5;
  font-size: 16px;
}

/* Improved container responsiveness */
.login-container,
.form-container {
  width: 100%;
  max-width: 400px;
  margin: var(--spacing-xl) auto;
  background: #fff;
  border-radius: 12px;
  padding: var(--spacing-lg) var(--spacing-xl);
  box-shadow: var(--shadow);
  position: relative;
}

/* Larger container for multi-step form and admin pages */
.form-container {
  max-width: 900px;
  padding: var(--spacing-xl);
}

@media (max-width: 768px) {
  .login-container,
  .form-container {
    margin: var(--spacing-md);
    padding: var(--spacing-md);
    width: calc(100% - var(--spacing-md) * 2);
  }
}

/* Header Styling */
.login-header h2 {
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: #0445af;
  text-align: center;
}

.login-header p {
  font-size: 1rem;
  margin-bottom: 20px;
  color: #666;
  text-align: center;
}

/* Form Fields - Floating Label Style */
.login-field {
  position: relative;
  margin-bottom: var(--spacing-lg);
}

.login-form label {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  color: #666;
  pointer-events: none;
  transition: 0.2s ease all;
  background: #fff;
  padding: 0 4px;
  z-index: 1;
}

.login-form input {
  width: 100%;
  padding: var(--spacing-md) var(--spacing-md);
  font-size: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  transition: border-color 0.2s ease;
  position: relative;
  background: transparent;

  /* High contrast when focused */
  &:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color);
  }
}

/* Move label up when input is focused or has content */
.login-form input:focus ~ label,
.login-form input:not(:placeholder-shown) ~ label {
  top: 0;
  transform: translateY(-50%);
  font-size: 0.85rem;
  color: #0445af;
  background: #fff;
}

/* Hide placeholder by default */
.login-form input::placeholder {
  opacity: 0;
}

/* Show placeholder only when input is focused */
.login-form input:focus::placeholder {
  opacity: 1;
  color: #666;
}

/* Submit Button */
.login-submit {
  width: 100%;
  padding: var(--spacing-md);
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  background: var(--primary-color);
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 10px;
  position: relative;

  /* Better focus states */
  &:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
  }

  /* Disabled state */
  &:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.7;
  }
}

.login-submit:not(:disabled):hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* Error Message */
.error {
  color: var(--error-color);
  font-size: 0.9rem;
  text-align: center;
  margin-top: var(--spacing-md);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: 4px;
  background-color: rgba(231, 76, 60, 0.1);
  display: none; /* Hide by default */
}

.error:not(:empty) {
  display: block; /* Show only when there's content */
}

/* Logout Button */
.logout-btn {
  position: absolute;
  top: var(--spacing-md);
  right: var(--spacing-md);
  background: none;
  border: 2px solid transparent;
  cursor: pointer;
  padding: var(--spacing-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s ease;

  /* Improved touch target size for mobile */
  min-height: 44px;
  min-width: 44px;

  /* Better focus states */
  &:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
  }

  /* Tooltip styles */
  &::before {
    content: attr(aria-label);
    position: absolute;
    bottom: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    padding: 5px 10px;
    border-radius: 4px;
    background-color: #333;
    color: white;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
  }

  /* Hover effects */
  &:hover {
    background-color: var(--bg-light);
    border-color: var(--primary-color);
    transform: translateY(-1px);

    &::before {
      opacity: 1;
      visibility: visible;
      transform: translateX(-50%) scale(1);
    }
  }
}

.logout-icon {
  display: block;
}

/* Settings Button */
.settings-btn {
  position: absolute;
  top: var(--spacing-md);
  right: calc(var(--spacing-md) + 48px);
  background: none;
  border: 2px solid transparent;
  cursor: pointer;
  padding: var(--spacing-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s ease;

  /* Improved touch target size for mobile */
  min-height: 44px;
  min-width: 44px;

  /* Better focus states */
  &:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
  }

  /* Tooltip styles */
  &::before {
    content: attr(aria-label);
    position: absolute;
    bottom: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    padding: 5px 10px;
    border-radius: 4px;
    background-color: #333;
    color: white;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
  }

  /* Hover effects */
  &:hover {
    background-color: var(--bg-light);
    border-color: var(--primary-color);
    transform: translateY(-1px);

    &::before {
      opacity: 1;
      visibility: visible;
      transform: translateX(-50%) scale(1);
    }
  }
}

.settings-icon {
  display: block;
}

/* Multi-Step Form Text Styles */
.question-number {
  font-size: 0.9rem;
  font-weight: 500;
  color: #666;
  margin-bottom: 4px;
}

.question-title {
  font-size: 1.4rem;
  font-weight: 600;
  color: #111;
  margin-bottom: 6px;
}

.question-desc {
  font-size: 1rem;
  color: #666;
  margin-bottom: 20px;
}

/* Mailbox Options */
.mailbox-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mailbox-option {
  display: flex;
  align-items: center;
  background-color: #f5f8ff;
  border: 2px solid #d0d8ec;
  border-radius: 8px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.mailbox-option:hover {
  border-color: #0445af;
}

.mailbox-letter {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 32px;
  height: 32px;
  border: 2px solid #0445af;
  background-color: #fff;
  color: #0445af;
  border-radius: 4px;
  margin-right: 12px;
  font-weight: 600;
}

.mailbox-text {
  flex: 1;
  font-size: 1rem;
  color: #0445af;
}

.mailbox-option input[type="radio"] {
  display: none;
}

.mailbox-check {
  width: 24px;
  height: 24px;
  background-repeat: no-repeat;
  background-position: center;
  background-image: none;
}

.mailbox-option input[type="radio"]:checked + .mailbox-check {
  background-image: url('data:image/svg+xml;utf8,<svg fill="none" stroke="%230445AF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5 12l5 5l10-10"/></svg>');
}

/* File Upload Area */
.file-upload-area {
  width: 100%;
  min-height: 200px;
  border: 2px dashed #d0d8ec;
  border-radius: 8px;
  text-align: center;
  padding: 20px;
  cursor: pointer;
  margin-bottom: 24px;
  transition: all 0.3s ease;
}

.file-upload-area:hover,
.file-upload-area.drag-over {
  border-color: #0445af;
  background-color: rgba(4, 69, 175, 0.05);
}

.file-upload-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #0445af;
}

.file-upload-icon p {
  margin-top: 8px;
  font-size: 1rem;
  color: #444;
}

.file-limit {
  font-size: 0.9rem;
  color: #666;
  margin-top: 4px;
}

.file-selected {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #0445af;
}

.file-selected p {
  font-size: 1rem;
  color: #444;
}

#reselectFileBtn {
  padding: 6px 10px;
  font-size: 0.9rem;
  border: 1px solid #0445af;
  background: #fff;
  color: #0445af;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s ease;
}

#reselectFileBtn:hover {
  background: #f5f8ff;
}

/* Rich Text Editor */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.editor-toolbar button {
  padding: 10px 12px;
  font-size: 1rem;
  background: #f7f7f7;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.editor-toolbar button:hover {
  background: #eaeaea;
}

.editor-toolbar button.active-format {
  background-color: #f5f8ff;
  border: 2px solid #0445af;
  color: #0445af;
}

.editor-toolbar button.tooltip-btn {
  /* Tooltip styles */
  &::before {
    content: attr(aria-label);
    position: absolute;
    bottom: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    padding: 5px 10px;
    border-radius: 4px;
    background-color: #333;
    color: white;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
  }

  /* Hover effects */
  &:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) scale(1);
  }
}

.heading-dropdown {
  position: relative;
  display: inline-block;
}

.heading-dropdown button {
  padding: 10px 12px;
  font-size: 1rem;
  background: #f7f7f7;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dropdown-toggle {
  padding: 10px 12px;
  font-size: 1rem;
  background: #f7f7f7;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dropdown-menu {
  display: none;
  position: absolute;
  z-index: 999;
  background-color: #fff;
  min-width: 100%;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-top: 2px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.dropdown-menu.show {
  display: block;
}

.dropdown-menu .dropdown-item {
  width: 100%;
  padding: 8px 12px;
  background: #fff;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease;
}

.dropdown-menu .dropdown-item:hover {
  background: #eee;
}

.rich-editor {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: var(--spacing-md);
  min-height: 180px;
  background: #fff;
  font-size: 1rem;
  line-height: 1.6;
  margin-top: var(--spacing-sm);
  overflow-y: auto;
  font-family: inherit !important;

  &:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color);
  }
}

.rich-editor * {
  font-family: inherit !important;
  max-width: 100%;
}

/* Heading styles for rich text editor */
.rich-editor h1 {
  font-size: 2em;
  margin-top: 0.67em;
  margin-bottom: 0.67em;
  font-weight: bold;
}

.rich-editor h2 {
  font-size: 1.5em;
  margin-top: 0.83em;
  margin-bottom: 0.83em;
  font-weight: bold;
}

.rich-editor h3 {
  font-size: 1.17em;
  margin-top: 1em;
  margin-bottom: 1em;
  font-weight: bold;
}

.rich-editor h4 {
  font-size: 1em;
  margin-top: 1.33em;
  margin-bottom: 1.33em;
  font-weight: bold;
}

.rich-editor h5 {
  font-size: 0.83em;
  margin-top: 1.67em;
  margin-bottom: 1.67em;
  font-weight: bold;
}

.rich-editor h6 {
  font-size: 0.67em;
  margin-top: 2.33em;
  margin-bottom: 2.33em;
  font-weight: bold;
}

.rich-editor[contenteditable]:empty:before {
  content: "Typ hier uw bericht...";
  color: #999;
  pointer-events: none;
}

.rich-editor ul,
.rich-editor ol {
  margin: 0;
  padding-left: 1.5rem;
  list-style-position: inside;
}

.rich-editor li {
  margin: 0.5rem 0;
  text-indent: 0;
}

/* Text Answer Field */
.text-answer {
  width: 100%;
  font-size: 1rem;
  border: none;
  border-bottom: 2px solid #d0d8ec;
  padding: 10px 0;
  color: #333;
  outline: none;
  transition: border-color 0.2s ease;
}

.text-answer::placeholder {
  color: #999;
}

.text-answer:focus {
  border-color: #0445af;
}

/* Navigation Buttons */
.nav-group {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  width: 100%;
}

.prev-step,
.next-step,
.submit-btn {
  flex: 1;
  padding: var(--spacing-md);
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 24px;

  /* Better focus states */
  &:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
  }
}

.prev-step {
  background: #e0e0e0;
  color: var(--text-color);
}

.prev-step:hover,
.next-step:hover,
.submit-btn:hover {
  opacity: 0.9;
}

.next-step,
.submit-btn {
  background: var(--primary-color);
  color: #fff;
}

/* Multi-Step Form Visibility */
.form-step {
  display: none;
}

.form-step.active {
  display: block;
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Report Abuse Link */
.report-abuse {
  margin-top: 16px;
  font-size: 0.9rem;
  color: #666;
}

.report-abuse a {
  color: #0445af;
  text-decoration: none;
}

.report-abuse a:hover {
  text-decoration: underline;
}

/* Unified Link Styling */
.login-container a,
.form-container a {
  color: #0445af;
  text-decoration: none;
  font-size: 1rem;
  text-align: center;
}

.login-container a:hover,
.form-container a:hover {
  text-decoration: underline;
}

/* Admin Panel Specific Styles */
/* Container override for admin panel */
.admin-container {
  position: relative;
  max-width: 900px;
}

/* Users Table */
.users-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--spacing-lg);

  @media (max-width: 480px) {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

.users-table th,
.users-table td {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: left;
}

.users-table th {
  background-color: #f5f8ff;
  color: #0445af;
  font-weight: 600;
}

.users-table tr:nth-child(even) {
  background-color: #f9f9f9;
}

/* Constrain the Delete column */
.delete-col {
  width: 1px;
  white-space: nowrap;
}

/* Delete button styling */
.delete-btn {
  padding: 10px 12px;
  font-size: 1rem;
  background: #f7f7f7;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Delete button hover effect */
.delete-btn:hover {
  background: #eaeaea;
}

/* Message box styling for admin */
.message-box {
  background-color: #f5f8ff;
  border: 2px solid #d0d8ec;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 20px;
  color: #0445af;
  font-weight: 600;
  text-align: center;
  display: none;
}

/* Notification Page Styles */
.notification-content {
  text-align: center;
  padding: 20px 0;
}

.notification-content p {
  color: #666;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* Skip to main content link for keyboard users */
.skip-to-content {
  position: absolute;
  top: -100%;
  left: 0;
  background: var(--primary-color);
  color: white;
  padding: var(--spacing-sm) var(--spacing-md);
  z-index: 100;

  &:focus {
    top: 0;
  }
}

/* Next/Prev Buttons */
.next-step,
.prev-step {
  display: flex !important; /* Override inline style */
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  opacity: 1;
  flex: 1;
  position: relative;
}

.next-step {
  background: var(--primary-color);
  color: #fff;
}

.prev-step {
  background: #e0e0e0;
  color: var(--text-color);
}

/* Disabled state for next button */
.next-step:disabled {
  background-color: #ccc !important;
  color: #666;
  cursor: not-allowed;
  opacity: 0.7;
  transform: none;
  pointer-events: none;
}

.next-step:not(:disabled):hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* Tooltip for disabled next button */
.next-step:disabled::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 12px;
  background-color: #333;
  color: white;
  font-size: 0.875rem;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  pointer-events: none;
  z-index: 1000;
}

.next-step:disabled:hover::before {
  opacity: 1;
  visibility: visible;
}
