/**
 * Defences Form Controls - Modern Slate Dark Theme
 * High contrast, accessible checkboxes, radios, and inputs
 */

/* ============================================
   CHECKBOXES - High Contrast Dark Theme
   ============================================ */

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  width: 18px;
  height: 18px;
  border: 2px solid #3a3a3a;
  border-radius: 4px;
  background: #0a0a0a;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
  margin-top: 2px; /* Align with text */
}

/* Hover State */
input[type="checkbox"]:hover {
  border-color: #f59e0b;
  background: #1a1a1a;
  transform: scale(1.05);
}

/* Focus State - WCAG AA Compliant */
input[type="checkbox"]:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

/* Checked State */
input[type="checkbox"]:checked {
  background: #f59e0b;
  border-color: #f59e0b;
}

/* Checkmark Icon */
input[type="checkbox"]:checked::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 5px;
  width: 4px;
  height: 8px;
  border: solid #0a0a0a;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Disabled State */
input[type="checkbox"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

input[type="checkbox"]:disabled:hover {
  border-color: #3a3a3a;
  background: #0a0a0a;
  transform: none;
}

/* ============================================
   RADIO BUTTONS - High Contrast Dark Theme
   ============================================ */

input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  width: 18px;
  height: 18px;
  border: 2px solid #3a3a3a;
  border-radius: 50%;
  background: #0a0a0a;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Hover State */
input[type="radio"]:hover {
  border-color: #f59e0b;
  background: #1a1a1a;
  transform: scale(1.05);
}

/* Focus State */
input[type="radio"]:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

/* Checked State */
input[type="radio"]:checked {
  border-color: #f59e0b;
  background: #0a0a0a;
}

/* Inner Dot */
input[type="radio"]:checked::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
}

/* Disabled State */
input[type="radio"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

input[type="radio"]:disabled:hover {
  border-color: #3a3a3a;
  background: #0a0a0a;
  transform: none;
}

/* ============================================
   TEXT INPUTS - Enhanced Dark Theme
   ============================================ */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="tel"],
input[type="number"],
input[type="date"],
textarea,
select {
  background: #0a0a0a;
  border: 2px solid #2e2e2e;
  border-radius: 8px;
  color: #f5f5f5;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
  transition: all 0.2s ease;
  width: 100%;
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder,
input[type="search"]::placeholder,
textarea::placeholder {
  color: #94a3b8;
  opacity: 1;
}

/* Hover State */
input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
input[type="search"]:hover,
textarea:hover,
select:hover {
  border-color: #3a3a3a;
  background: #0f0f0f;
}

/* Focus State */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
  background: #0a0a0a;
}

/* Error State */
input[type="text"].error,
input[type="email"].error,
input[type="password"].error,
textarea.error {
  border-color: #dc2626;
}

input[type="text"].error:focus,
input[type="email"].error:focus,
input[type="password"].error:focus,
textarea.error:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Success State */
input[type="text"].success,
input[type="email"].success,
input[type="password"].success {
  border-color: #10b981;
}

/* Disabled State */
input[type="text"]:disabled,
input[type="email"]:disabled,
input[type="password"]:disabled,
textarea:disabled,
select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: #0a0a0a;
}

/* ============================================
   SELECT DROPDOWNS
   ============================================ */

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8"><path fill="%23f59e0b" d="M6 8L0 0h12z"/></svg>');
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 8px;
  padding-right: 36px;
  cursor: pointer;
}

select option {
  background: #1a1a1a;
  color: #f5f5f5;
  padding: 8px;
}

/* ============================================
   LABELS - Enhanced Accessibility
   ============================================ */

label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease;
}

label:hover {
  color: #f59e0b;
}

label:has(input:disabled) {
  opacity: 0.6;
  cursor: not-allowed;
}

label:has(input:disabled):hover {
  color: inherit;
}

/* ============================================
   FILTER SECTION LABELS (Sidebar)
   ============================================ */

.filter-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 6px;
  padding-left: 4px;
  margin-left: -4px;
}

.filter-label:hover {
  background: #1a1a1a;
  padding-left: 8px;
  margin-left: 0;
}

.filter-label input[type="checkbox"],
.filter-label input[type="radio"] {
  margin-top: 0;
}

/* ============================================
   TOGGLE SWITCH - For Settings
   ============================================ */

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #2e2e2e;
  transition: 0.3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #f5f5f5;
  transition: 0.3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: #f59e0b;
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

.toggle-switch input:focus + .toggle-slider {
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

/* ============================================
   FORM GROUPS - Spacing & Organization
   ============================================ */

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #f5f5f5;
  margin-bottom: 8px;
}

.form-group .helper-text {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 6px;
}

.form-group .error-text {
  font-size: 12px;
  color: #dc2626;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ============================================
   BUTTONS - Quick Reference
   ============================================ */

button,
.btn {
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  padding: 10px 20px;
  font-size: 14px;
}

button:hover,
.btn:hover {
  transform: translateY(-1px);
}

button:active,
.btn:active {
  transform: translateY(0);
}

button:disabled,
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ============================================
   ACCESSIBILITY - High Contrast Mode
   ============================================ */

@media (prefers-contrast: high) {
  input[type="checkbox"],
  input[type="radio"] {
    border-width: 3px;
  }

  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  textarea,
  select {
    border-width: 3px;
  }
}

/* ============================================
   REDUCED MOTION - Accessibility
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  input[type="checkbox"],
  input[type="radio"],
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  textarea,
  select,
  button,
  .btn,
  label {
    transition: none;
  }

  input[type="checkbox"]:hover,
  input[type="radio"]:hover {
    transform: none;
  }

  button:hover,
  .btn:hover {
    transform: none;
  }
}

/* ============================================
   FILTER SIDEBAR - Collapsible Sections
   ============================================ */

.filter-section-toggle {
  background: none;
  border: none;
  outline: none;
}

.filter-section-toggle:focus {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
  border-radius: 4px;
}

.filter-section-content {
  overflow: hidden;
  transition: all 0.3s ease;
}

.filter-section-content.hidden {
  max-height: 0;
  margin-top: 0 !important;
  opacity: 0;
}

/* ============================================
   DARK MODE - Force Dark (if not default)
   ============================================ */

@media (prefers-color-scheme: dark) {
  /* Already dark by default, but ensure consistency */
  input[type="checkbox"],
  input[type="radio"],
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  textarea,
  select {
    background: #0a0a0a;
    border-color: #2e2e2e;
    color: #f5f5f5;
  }
}
