/* Accessibility Styles */

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Focus Visible Enhancement */
.focus-visible-enabled *:focus {
    outline: 3px solid #3b82f6;
    outline-offset: 2px;
}

.focus-visible-enabled button:focus,
.focus-visible-enabled a:focus,
.focus-visible-enabled input:focus,
.focus-visible-enabled select:focus,
.focus-visible-enabled textarea:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
}

/* High Contrast Mode */
.high-contrast {
    background-color: #000 !important;
    color: #fff !important;
}

.high-contrast * {
    background-color: #000 !important;
    color: #fff !important;
    border-color: #fff !important;
}

.high-contrast a {
    color: #ffff00 !important;
    text-decoration: underline !important;
}

.high-contrast button,
.high-contrast .btn {
    background-color: #fff !important;
    color: #000 !important;
    border: 2px solid #fff !important;
}

.high-contrast input,
.high-contrast select,
.high-contrast textarea {
    background-color: #000 !important;
    color: #fff !important;
    border: 2px solid #fff !important;
}

/* Font Size Options */
.font-size-small {
    font-size: 12px;
}

.font-size-normal {
    font-size: 16px;
}

.font-size-large {
    font-size: 20px;
}

.font-size-xlarge {
    font-size: 24px;
}

.font-size-large h1 { font-size: 2.5rem; }
.font-size-large h2 { font-size: 2rem; }
.font-size-large h3 { font-size: 1.75rem; }
.font-size-large p { font-size: 1.25rem; }

.font-size-xlarge h1 { font-size: 3rem; }
.font-size-xlarge h2 { font-size: 2.5rem; }
.font-size-xlarge h3 { font-size: 2rem; }
.font-size-xlarge p { font-size: 1.5rem; }

/* Keyboard Navigation Indicators */
.keyboard-nav-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 1rem 2rem;
    border-radius: 0.5rem;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.keyboard-nav-indicator.show {
    opacity: 1;
}

/* Accessible Tables */
table[role="table"] {
    border-collapse: collapse;
    width: 100%;
}

table[role="table"] th {
    background-color: #f3f4f6;
    font-weight: 600;
    text-align: left;
    padding: 0.75rem;
}

table[role="table"] td {
    padding: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

/* Skip Links */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #3b82f6;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* Accessible Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.form-error {
    color: #dc2626;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.form-error::before {
    content: "⚠ ";
}

/* Accessible Buttons */
button[disabled],
.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

button:not([disabled]):hover,
.btn:not([disabled]):hover {
    transform: scale(1.05);
    transition: transform 0.2s;
}

/* Loading States */
.loading {
    position: relative;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print Styles */
@media print {
    .no-print,
    nav,
    .sidebar,
    button,
    #accessibility-toggle {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }
}
