/* ========================================
   ACCESSIBILITY - WCAG 2.1 AA Compliance
   Focus Indicators & Keyboard Navigation
   ======================================== */

/* Focus Visible - Modern approach */
*:focus {
    outline: 3px solid #66cc66;
    outline-offset: 2px;
}

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

/* Restore outline for keyboard users */
*:focus-visible {
    outline: 3px solid #66cc66;
    outline-offset: 2px;
}

/* Enhanced focus for interactive elements */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus,
[role="button"]:focus {
    box-shadow: 0 0 0 4px rgba(102, 204, 102, 0.3);
    border-color: #66cc66;
}

/* Focus for buttons with custom styles */
.button:focus,
.submit-button:focus,
.cta-button:focus {
    box-shadow: 0 0 0 4px rgba(102, 204, 102, 0.4);
    outline: 3px solid #66cc66;
    outline-offset: 2px;
}

/* Skip link for keyboard navigation */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: #fff;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 100000;
    border-radius: 0 0 4px 0;
    font-weight: 600;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid #66cc66;
    outline-offset: 2px;
}

/* Visually hidden (accessible to screen readers) */
.visually-hidden,
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus trap for modals */
.modal-overlay:focus {
    outline: none;
}

.modal-content:focus-within {
    outline: 3px solid #66cc66;
    outline-offset: -3px;
}

/* Better contrast for placeholder text */
::-webkit-input-placeholder {
    color: #666;
    opacity: 1;
}

::-moz-placeholder {
    color: #666;
    opacity: 1;
}

:-ms-input-placeholder {
    color: #666;
    opacity: 1;
}

::placeholder {
    color: #666;
    opacity: 1;
}

/* Improved contrast for links */
a {
    color: #2c3e50;
    text-decoration-skip-ink: auto;
}

a:hover,
a:focus {
    text-decoration: underline;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    *:focus,
    *:focus-visible {
        outline-width: 4px;
        outline-offset: 3px;
    }
}

/* 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;
    }
}

/* Touch target minimum size (44x44px WCAG 2.5.5) */
@media (pointer: coarse) {
    button,
    a,
    input[type="submit"],
    input[type="button"],
    [role="button"] {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Error messages - accessible announcements */
.error-message {
    color: #e74c3c;
    font-size: 0.875rem;
    margin-top: 4px;
    display: none;
}

.error-message[aria-live="polite"] {
    display: block;
}

input:invalid:not(:placeholder-shown) + .error-message {
    display: block;
}

/* Success states */
input:valid:not(:placeholder-shown) {
    border-color: #27ae60;
}

input:invalid:not(:placeholder-shown) {
    border-color: #e74c3c;
}

/* Loading states */
[aria-busy="true"] {
    opacity: 0.6;
    pointer-events: none;
}

/* Disabled states with better visibility */
:disabled,
[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
}
