@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;800&family=Montserrat:wght@700;800&display=swap');
@import url('https://cdn.jsdelivr.net/npm/@fontsource/opendyslexic/index.css');

:host {
  --y-acc-primary: #3b82f6;
  --y-acc-primary-dark: #1d4ed8;
  --y-acc-accent: #60a5fa;
  --y-acc-text-main: #1e293b;
  --y-acc-text-muted: #64748b;
  --y-acc-bg-glass: rgba(255, 255, 255, 0.85);
  --y-acc-border: rgba(255, 255, 255, 0.4);
  --y-acc-shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.3);
  --y-acc-radius: 24px;
  --y-acc-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --y-acc-font: 'Outfit', sans-serif;
  --y-indicator-active: #3b82f6;
  --y-indicator-inactive: #e2e8f0;
}

#y-accessibility-bar,
#y-acc-modal,
button {
  font-family: var(--y-acc-font);
}

/* --- Trigger Button --- */
#y-accessibility-button {
  position: fixed;
  width: 65px;
  height: 65px;
  background: linear-gradient(135deg, var(--y-acc-primary), var(--y-acc-primary-dark));
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  z-index: 2147483647;
  box-shadow: 0 10px 25px rgba(59, 130, 246, 0.4);
  transition: var(--y-acc-transition);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  margin: 0;
}

#y-accessibility-button.active {
  background: #a94343;
}

#y-accessibility-button i {
  font-size: 30px;
}

/* --- Main Panel --- */
#y-accessibility-bar {
  position: fixed;
  width: 400px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 120px);
  background: var(--y-acc-bg-glass);
  backdrop-filter: blur(25px) saturate(200%);
  -webkit-backdrop-filter: blur(25px) saturate(200%);
  border: 1px solid var(--y-acc-border);
  border-radius: var(--y-acc-radius);
  box-shadow: var(--y-acc-shadow-xl);
  display: flex;
  flex-direction: column;
  z-index: 2147483646;
  opacity: 0;
  visibility: hidden;
  transform: translateY(30px) scale(0.95);
  transition: var(--y-acc-transition);
  overflow: hidden;
}

#y-accessibility-bar.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* --- Header --- */
#y-accessibility-title {
  padding: 20px;
  background: rgba(255, 255, 255, 0.4);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.y-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
}

.y-header-top h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--y-acc-text-main);
  letter-spacing: -0.02em;
}

.y-close-btn {
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.5;
  transition: all 0.2s;
}

.y-close-btn:hover {
  opacity: 1;
  color: #ef4444;
  transform: rotate(90deg);
}

.y-lang-switcher {
  display: flex;
  gap: 6px;
  background: rgba(0, 0, 0, 0.06);
  padding: 4px;
  border-radius: 12px;
}

.y-lang-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 4px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  color: var(--y-acc-text-muted);
}

.y-lang-btn.active {
  background: white;
  color: var(--y-acc-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* --- Accordion --- */
#y-accessibility-accordion {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  padding-bottom: 20px;
}

.y-acc-item {
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.y-acc-header {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
}

.y-acc-header:hover {
  background: rgba(255, 255, 255, 0.5);
}

.y-acc-header span {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--y-acc-text-main);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.y-acc-arrow {
  font-size: 12px;
  transition: transform 0.3s;
  color: var(--y-acc-text-muted);
}

.y-acc-item.open .y-acc-arrow {
  transform: rotate(180deg);
}

.y-acc-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease-out;
  background: rgba(0, 0, 0, 0.02);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 0 20px;
}

.y-acc-item.open .y-acc-content {
  max-height: 1200px;
  padding-top: 15px;
  padding-bottom: 20px;
}

/* --- Controls --- */
.y-acc-content button {
  position: relative;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 20px;
  padding: 18px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.3s;
  min-height: 110px;
}

.y-acc-content button:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.06);
  border-color: var(--y-acc-primary);
}

.y-acc-content button i {
  font-size: 24px;
  color: var(--y-acc-primary);
}

.y-btn-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--y-acc-text-main);
  text-align: center;
  line-height: 1.3;
}

button.active {
  border-color: var(--y-acc-primary) !important;
  box-shadow: 0 0 0 1px var(--y-acc-primary) inset, 0 8px 16px rgba(59, 130, 246, 0.1) !important;
}

.y-checkmark {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 18px;
  height: 18px;
  background: var(--y-acc-primary);
  color: white;
  border-radius: 6px;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

button.active .y-checkmark {
  opacity: 1;
  transform: scale(1);
}

/* --- Level Indicators --- */
.y-level-bar {
  display: flex;
  gap: 3px;
  width: 100%;
  margin-top: 4px;
}

.y-level-dot {
  flex: 1;
  height: 4px;
  background: var(--y-indicator-inactive);
  border-radius: 2px;
}

.y-level-dot.active {
  background: var(--y-indicator-active);
}

/* --- Footer --- */
#y-accessibility-footer {
  padding: 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(255, 255, 255, 0.2);
}

.y-footer-row {
  display: flex;
  gap: 10px;
}

#y-accessibility-reset,
#y-accessibility-statement-btn {
  flex: 1;
  padding: 12px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  background: white;
  border: 1px solid #e2e8f0;
}

#y-accessibility-reset {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.2);
}

#y-accessibility-reset:hover {
  background: #ef4444;
  color: white;
}

#y-accessibility-statement-btn {
  color: var(--y-acc-primary);
  border-color: rgba(59, 130, 246, 0.2);
}

#y-accessibility-statement-btn:hover {
  background: var(--y-acc-primary);
  color: white;
}

.y-footer-branding {
  text-align: center;
  margin-top: 15px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.y-footer-branding a {
  display: block;
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.y-footer-branding a:hover {
  opacity: 1;
}

.y-footer-branding img {
  height: 16px;
  width: auto;
  display: block;
}

/* --- Modal --- */
#y-acc-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2147483647;
  padding: 20px;
}

#y-acc-modal-overlay.active {
  display: flex;
}

#y-acc-modal {
  background: white;
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  animation: y-slide-up 0.4s ease-out;
}

#y-acc-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
}

#y-acc-modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  color: #1e293b;
}

#y-acc-modal-close {
  font-size: 24px;
  cursor: pointer;
  opacity: 0.5;
  transition: 0.2s;
}

#y-acc-modal-close:hover {
  opacity: 1;
  color: #ef4444;
}

#y-acc-modal-body {
  padding: 24px;
  overflow-y: auto;
  line-height: 1.7;
  color: #475569;
  font-size: 0.95rem;
}

#y-acc-modal-body p {
  margin: 0 0 16px 0;
}

#y-acc-modal-body p:last-child {
  margin: 0;
}

/* --- GLOBAL CLASSES (Applied to main document) --- */

body.y-acc-contrast {
  background: #000 !important;
  color: #fff !important;
}

body.y-acc-contrast *:not(#y-accessibility-shadow-host *) {
  background-color: #000 !important;
  color: #fff !important;
  border-color: #fff !important;
}

/* Inverted Colors */
body.y-acc-contrast-inverted {
  filter: invert(1) hue-rotate(180deg) !important;
}

body.y-acc-contrast-inverted img,
body.y-acc-contrast-inverted video,
body.y-acc-contrast-inverted #y-accessibility-shadow-host {
  filter: invert(1) hue-rotate(180deg) !important;
}

/* Sepia Mode */
body.y-acc-contrast-sepia {
  filter: sepia(1) !important;
}

body.y-acc-contrast-sepia #y-accessibility-shadow-host {
  filter: sepia(0) !important;
}

/* Yüksek Kontrast Ekstra Tweakleri */
body.y-acc-contrast-sepia {
  background-color: #f4ecd8 !important;
  color: #5b4636 !important;
}


/* Hiding Images */
body.y-acc-hide-images img,
body.y-acc-hide-images svg,
body.y-acc-hide-images video,
body.y-acc-hide-images canvas {
  visibility: hidden !important;
  opacity: 0 !important;
}

body.y-acc-highlight-links a:not(#y-accessibility-shadow-host a) {
  background-color: #ffff00 !important;
  color: #000 !important;
  outline: 3px solid #ffeb3b !important;
  text-decoration: underline !important;
  font-weight: 800 !important;
  border-radius: 4px;
  padding: 0 4px;
}

body.y-acc-simple-font *:not(#y-accessibility-shadow-host *) {
  font-family: 'Arial', 'Helvetica', sans-serif !important;
}

@font-face {
  font-family: 'OpenDyslexic';
  src: url('https://cdn.jsdelivr.net/npm/@fontsource/opendyslexic/files/opendyslexic-all-400-normal.woff2') format('woff2');
}

body.y-acc-dyslexia *:not(#y-accessibility-shadow-host *) {
  font-family: 'OpenDyslexic', sans-serif !important;
}

body.y-acc-spacing *:not(#y-accessibility-shadow-host *) {
  word-spacing: 0.25em !important;
  letter-spacing: 0.15em !important;
  line-height: 2 !important;
}

body.y-acc-stop-anim *,
body.y-acc-stop-anim *::before,
body.y-acc-stop-anim *::after {
  animation: none !important;
  transition: none !important;
}

/* CURSOR STYLES */
body.y-acc-cursor-white,
body.y-acc-cursor-white * {
  cursor: url("data:image/svg+xml,%3Csvg width='32' height='32' viewBox='0 0 32 32' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 2L12 28L16 18L26 14L2 2Z' fill='white' stroke='black' stroke-width='2'/%3E%3C/svg%3E") 2 2, auto !important;
}

body.y-acc-cursor-black,
body.y-acc-cursor-black * {
  cursor: url("data:image/svg+xml,%3Csvg width='32' height='32' viewBox='0 0 32 32' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 2L12 28L16 18L26 14L2 2Z' fill='black' stroke='white' stroke-width='2'/%3E%3C/svg%3E") 2 2, auto !important;
}

body.y-acc-cursor-yellow,
body.y-acc-cursor-yellow * {
  cursor: url("data:image/svg+xml,%3Csvg width='32' height='32' viewBox='0 0 32 32' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 2L12 28L16 18L26 14L2 2Z' fill='%23ffff00' stroke='black' stroke-width='2'/%3E%3C/svg%3E") 2 2, auto !important;
}

/* READING MODE HIGHLIGHT */
.y-acc-reading-highlight {
  outline: 4px solid #3b82f6 !important;
  background-color: rgba(59, 130, 246, 0.1) !important;
  transition: outline 0.2s !important;
}

/* COLOR BLINDNESS */
.y-filter-protanopia {
  filter: url('#y-acc-filters-protanopia') !important;
}

.y-filter-deuteranopia {
  filter: url('#y-acc-filters-deuteranopia') !important;
}

.y-filter-tritanopia {
  filter: url('#y-acc-filters-tritanopia') !important;
}

.y-filter-achromatopsia {
  filter: grayscale(1) !important;
}



/* SATURATION */
body.y-accessibility-low-saturation {
  filter: saturate(0.5);
}

body.y-accessibility-high-saturation {
  filter: saturate(2);
}

@media (max-width: 600px) {
  #y-accessibility-bar {
    width: 100%;
    right: 0;
    bottom: 0;
    max-height: 85vh;
    border-radius: 24px 24px 0 0;
  }
}