/* ============================================
   ACCESSIBILITY WIDGET
   Provides accessibility options for users
   ============================================ */

.accessibility-widget {
  position: fixed;
  top: 50%;
  right: 30px;
  margin-top: -30px; /* Half of button height (60px / 2) */
  z-index: 998;
}

.accessibility-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #2c3e50;
  color: white;
  border: 3px solid white;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  transition: background 0.3s ease, box-shadow 0.3s ease;
  position: relative;
}

.accessibility-button:hover {
  background: #34495e;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.accessibility-button:focus {
  outline: 3px solid #ff6b35;
  outline-offset: 3px;
}

/* Close Button - appears on hover */
.accessibility-close {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e74c3c;
  color: white;
  border: 2px solid white;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 1000;
}

.accessibility-widget:hover .accessibility-close {
  display: flex;
}

.accessibility-close:hover {
  background: #c0392b;
  transform: scale(1.1);
}

/* Accessibility Panel */
.accessibility-panel {
  position: fixed;
  top: 50%;
  right: 110px;
  margin-top: -160px; /* Approximate center based on content height */
  width: 320px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  padding: 20px;
  display: none;
  z-index: 999;
  max-height: 70vh;
  overflow-y: auto;
}

.accessibility-panel.active {
  display: block;
  animation: slideLeft 0.3s ease;
}

@keyframes slideLeft {
  from {
    opacity: 0;
    right: 90px;
  }
  to {
    opacity: 1;
    right: 110px;
  }
}

.accessibility-panel h3 {
  margin: 0 0 15px 0;
  font-size: 1.3rem;
  color: #2c3e50;
  text-align: center;
}

.accessibility-option {
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.accessibility-option:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.accessibility-option label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 1rem;
  color: #333;
  cursor: pointer;
  padding: 8px 0;
}

.accessibility-option input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.accessibility-option input[type="range"] {
  width: 100%;
  margin-top: 8px;
  cursor: pointer;
}

.font-size-controls {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.font-size-controls button {
  flex: 1;
  padding: 8px;
  border: 1px solid #ddd;
  background: #f8f9fa;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.font-size-controls button:hover {
  background: #e9ecef;
  border-color: #adb5bd;
}

.font-size-controls button:active {
  transform: scale(0.95);
}

.reset-button {
  width: 100%;
  padding: 12px;
  margin-top: 15px;
  background: #ff6b35;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.reset-button:hover {
  background: #ff8c42;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

/* Accessibility States */
body.high-contrast {
  filter: contrast(1.5);
}

body.grayscale {
  filter: grayscale(100%);
}

body.large-cursor * {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><circle cx="16" cy="16" r="10" fill="black" stroke="white" stroke-width="2"/></svg>')
      16 16,
    auto;
}

body.highlight-links a:not(.accessibility-button):not(.reset-button) {
  background-color: yellow;
  color: black;
  text-decoration: underline;
  padding: 2px 4px;
}

body.line-height-increased p,
body.line-height-increased li,
body.line-height-increased span {
  line-height: 2;
}

body.letter-spacing-increased p,
body.letter-spacing-increased li,
body.letter-spacing-increased span,
body.letter-spacing-increased h1,
body.letter-spacing-increased h2,
body.letter-spacing-increased h3 {
  letter-spacing: 2px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .accessibility-widget {
    top: auto;
    bottom: 80px;
    right: 20px;
    margin-top: 0;
  }

  .accessibility-button {
    width: 50px;
    height: 50px;
    font-size: 24px;
  }

  .accessibility-panel {
    right: 20px;
    bottom: 140px;
    top: auto;
    margin-top: 0;
    width: calc(100vw - 40px);
    max-width: 320px;
  }

  .accessibility-panel.active {
    animation: slideUp 0.3s ease;
  }

  @keyframes slideUp {
    from {
      opacity: 0;
      bottom: 120px;
    }
    to {
      opacity: 1;
      bottom: 140px;
    }
  }
}
