/**
 * Growzy Community - Accessibility Styles
 * WCAG 2.1 AA Compliant
 *
 * Bu dosya tum accessibility (erisilebilirlik) stillerini icerir.
 * - Focus state'ler
 * - Skip link'ler
 * - Screen reader-only utility class'lar
 * - High contrast mode destegi
 * - Reduced motion destegi
 * - Minimum touch target boyutlari
 */

/* =====================================================
   SCREEN READER ONLY UTILITIES
   ===================================================== */

.sr-only,
.screen-reader-text,
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Make visible when focused (for skip links) */
.sr-only-focusable:focus,
.sr-only-focusable:active,
.screen-reader-text:focus,
.screen-reader-text:active {
    position: static !important;
    width: auto !important;
    height: auto !important;
    padding: inherit !important;
    margin: inherit !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
}

/* =====================================================
   SKIP LINKS
   ===================================================== */

.skip-link,
.skip-to-content,
.skip-navigation {
    position: absolute;
    top: -100px;
    left: 16px;
    background: var(--color-accent, #6366F1);
    color: #fff;
    padding: 12px 24px;
    z-index: 100000;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: top 0.3s ease;
}

.skip-link:focus,
.skip-to-content:focus,
.skip-navigation:focus {
    top: 16px;
    outline: 3px solid #fff;
    outline-offset: 2px;
}

/* =====================================================
   FOCUS STYLES - WCAG AA COMPLIANT
   ===================================================== */

/* Global Focus Style */
:focus {
    outline: 2px solid var(--color-accent, #6366F1);
    outline-offset: 2px;
}

/* Focus Visible - Modern browsers */
:focus-visible {
    outline: 3px solid var(--color-accent, #6366F1);
    outline-offset: 3px;
}

/* Remove focus for mouse users, keep for keyboard */
:focus:not(:focus-visible) {
    outline: none;
}

/* Specific Element Focus Styles */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
[tabindex]:focus {
    outline: 2px solid var(--color-accent, #6366F1);
    outline-offset: 2px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--color-accent, #6366F1);
    outline-offset: 3px;
}

/* Form Input Focus with Box Shadow */
input:focus,
select:focus,
textarea:focus {
    border-color: var(--color-accent, #6366F1);
    box-shadow: 0 0 0 3px var(--color-accent-subtle, rgba(99, 102, 241, 0.2));
}

/* Button Focus */
.btn:focus,
.button:focus,
button:focus {
    outline: 2px solid var(--color-accent, #6366F1);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--color-accent-subtle, rgba(99, 102, 241, 0.2));
}

/* Link Focus with Underline */
a:focus {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

/* Card Focus */
.card:focus,
.growzy-feed-card:focus,
article:focus {
    outline: 2px solid var(--color-accent, #6366F1);
    outline-offset: 4px;
}

/* Tab Focus */
.tab:focus,
.growzy-tab:focus,
[role="tab"]:focus {
    outline: 2px solid var(--color-accent, #6366F1);
    outline-offset: 2px;
    z-index: 1;
}

/* Dropdown Menu Item Focus */
.dropdown-item:focus,
.menu-item a:focus {
    background: var(--color-accent-subtle, rgba(99, 102, 241, 0.1));
    outline: 2px solid var(--color-accent, #6366F1);
    outline-offset: -2px;
}

/* Modal Focus */
.modal:focus,
.modal-content:focus {
    outline: none;
}

/* Checkbox and Radio Focus */
input[type="checkbox"]:focus,
input[type="radio"]:focus {
    outline: 2px solid var(--color-accent, #6366F1);
    outline-offset: 2px;
}

/* =====================================================
   FOCUS WITHIN (Container Focus)
   ===================================================== */

.card:focus-within,
.growzy-feed-card:focus-within,
.form-group:focus-within {
    box-shadow: 0 0 0 2px var(--color-accent-subtle, rgba(99, 102, 241, 0.2));
}

/* =====================================================
   MINIMUM TOUCH TARGET SIZES (44x44px WCAG)
   ===================================================== */

/* Buttons */
button,
.btn,
.button,
[role="button"] {
    min-height: 44px;
    min-width: 44px;
}

/* Links in navigation */
nav a,
.nav-menu a,
.menu a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 12px;
}

/* Form Controls */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="search"],
input[type="url"],
input[type="number"],
select,
textarea {
    min-height: 44px;
    padding: 10px 14px;
}

/* Checkbox and Radio Labels */
input[type="checkbox"],
input[type="radio"] {
    min-width: 24px;
    min-height: 24px;
}

label.checkbox-label,
label.radio-label {
    display: flex;
    align-items: center;
    min-height: 44px;
    gap: 8px;
    cursor: pointer;
}

/* Icon Buttons */
.icon-btn,
.action-btn,
.growzy-action-btn {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* =====================================================
   REQUIRED AND OPTIONAL INDICATORS
   ===================================================== */

.required,
.required-indicator {
    color: var(--color-error, #EF4444);
    font-weight: 600;
}

.optional,
.optional-indicator {
    color: var(--color-text-tertiary, #9CA3AF);
    font-size: 0.875em;
    font-weight: normal;
}

/* =====================================================
   ERROR STATES - ACCESSIBLE
   ===================================================== */

.error,
.is-invalid,
[aria-invalid="true"] {
    border-color: var(--color-error, #EF4444) !important;
}

.error:focus,
.is-invalid:focus,
[aria-invalid="true"]:focus {
    outline-color: var(--color-error, #EF4444);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.error-message,
.form-error,
[role="alert"] {
    color: var(--color-error, #EF4444);
    font-size: 0.875rem;
    margin-top: 4px;
}

/* =====================================================
   SUCCESS STATES - ACCESSIBLE
   ===================================================== */

.success,
.is-valid,
[aria-invalid="false"] {
    border-color: var(--color-success, #10B981);
}

.success-message {
    color: var(--color-success, #10B981);
    font-size: 0.875rem;
    margin-top: 4px;
}

/* =====================================================
   HIGH CONTRAST MODE SUPPORT
   ===================================================== */

@media (prefers-contrast: high) {
    /* Increase border widths */
    input,
    select,
    textarea,
    button,
    .btn,
    .card,
    .growzy-feed-card {
        border-width: 3px !important;
    }

    /* Ensure text has sufficient contrast */
    body {
        color: #000;
        background: #fff;
    }

    /* Active states with underline */
    .active,
    .current,
    [aria-selected="true"],
    [aria-current="page"] {
        text-decoration: underline;
        text-decoration-thickness: 3px;
        text-underline-offset: 4px;
    }

    /* Focus styles */
    :focus {
        outline-width: 4px !important;
    }

    /* Required indicator */
    .required {
        text-decoration: underline;
    }

    /* Links */
    a {
        text-decoration: underline;
    }

    /* Buttons */
    button,
    .btn {
        border: 3px solid currentColor !important;
    }

    /* Disabled states */
    [disabled],
    .disabled {
        opacity: 0.7;
        text-decoration: line-through;
    }
}

/* =====================================================
   REDUCED MOTION SUPPORT
   ===================================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    /* Disable hover transforms */
    .card:hover,
    .btn:hover,
    button:hover,
    .growzy-feed-card:hover {
        transform: none !important;
    }

    /* Remove parallax effects */
    .parallax {
        background-attachment: scroll !important;
    }

    /* Disable auto-playing media */
    video[autoplay],
    [data-autoplay] {
        display: none;
    }
}

/* =====================================================
   DARK MODE ACCESSIBILITY
   ===================================================== */

@media (prefers-color-scheme: dark) {
    :focus {
        outline-color: #818CF8;
    }

    .skip-link {
        background: #818CF8;
    }

    /* Ensure sufficient contrast in dark mode */
    .error,
    .error-message {
        color: #FCA5A5;
    }

    .success,
    .success-message {
        color: #6EE7B7;
    }
}

/* =====================================================
   LIVE REGION ANNOUNCEMENTS
   ===================================================== */

[aria-live="polite"],
[aria-live="assertive"],
.live-region {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* =====================================================
   LOADING STATES - ACCESSIBLE
   ===================================================== */

[aria-busy="true"] {
    cursor: wait;
    opacity: 0.7;
}

.loading,
.spinner {
    /* Ensure loading indicators are visible */
    min-width: 24px;
    min-height: 24px;
}

/* =====================================================
   DISABLED STATES - ACCESSIBLE
   ===================================================== */

[disabled],
[aria-disabled="true"],
.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

button[disabled],
.btn[disabled] {
    background: var(--color-border, #E5E7EB);
    color: var(--color-text-tertiary, #9CA3AF);
}

/* =====================================================
   EXPANDED/COLLAPSED STATES
   ===================================================== */

[aria-expanded="false"] + .collapsible-content,
[aria-expanded="false"] + .accordion-content {
    display: none;
}

[aria-expanded="true"] + .collapsible-content,
[aria-expanded="true"] + .accordion-content {
    display: block;
}

/* Visual indicator for expandable elements */
[aria-expanded]::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 8px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid currentColor;
    transition: transform 0.2s ease;
}

[aria-expanded="true"]::after {
    transform: rotate(180deg);
}

/* =====================================================
   TEXT SPACING SUPPORT (WCAG 1.4.12)
   ===================================================== */

/* These styles ensure content remains readable when users
   apply custom text spacing via browser extensions */
body {
    line-height: 1.5 !important;
    letter-spacing: normal;
    word-spacing: normal;
}

p {
    margin-bottom: 1.5em;
}

/* =====================================================
   PRINT STYLES - ACCESSIBLE
   ===================================================== */

@media print {
    .skip-link,
    .screen-reader-text,
    [aria-hidden="true"] {
        display: none !important;
    }

    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }

    abbr[title]::after {
        content: " (" attr(title) ")";
    }
}
