/**
 * Accessibility CSS - WCAG 2.2 Compliance
 * Screen reader only content and accessibility improvements
 */

/* Screen reader only text */
.sr-only {
    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;
}

/* Skip to content link for keyboard navigation */
.skip-link {
    position: absolute;
    top: -100px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 100000;
    border-radius: 3px;
    font-weight: 700;
    border: 2px solid transparent;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

.skip-link:focus {
    top: 6px;
    border-color: #fff;
    outline: none;
    opacity: 1;
    transform: translateY(0);
}

/* Focus indicators for better keyboard navigation */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus,
[tabindex]:focus {
    outline: 2px solid #005fcc;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    .course-card,
    .news-card {
        border: 1px solid currentColor;
    }
}

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

/* Ensure sufficient color contrast */
.text-muted {
    color: #6c757d !important;
}

/* Improve button accessibility */
button:disabled,
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Ensure interactive elements are large enough - only for buttons and form elements */
button,
.btn,
input[type="button"],
input[type="submit"],
input[type="reset"],
input,
textarea,
select {
    min-height: 44px;
}

/* Only apply min-width to actual buttons, not all links */
button,
.btn,
input[type="button"],
input[type="submit"],
input[type="reset"] {
    min-width: 44px;
}

/* For navigation and text links, only ensure adequate touch target */
.nav-menu a,
.hamburger,
.social-links a,  .social-links span{
    min-height: 44px;
    min-width: 44px;
}

/* Improve form accessibility */
label {
    font-weight: 700;
    margin-bottom: 0.5rem;
}

input:required,
textarea:required,
select:required {
    border-left: 3px solid #dc3545;
}

input:valid,
textarea:valid,
select:valid {
    border-left: 3px solid #28a745;
}

/* Error states */
.error {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Success states */
.success {
    color: #28a745;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Improve table accessibility */
table {
    border-collapse: collapse;
    width: 100%;
}

th,
td {
    border: 1px solid #dee2e6;
    padding: 0.75rem;
    text-align: left;
}

th {
    background-color: #f8f9fa;
    font-weight: 700;
}

/* Improve list accessibility */
ul[role="list"],
ol[role="list"] {
    list-style: none;
    padding: 0;
}

/* Improve navigation accessibility - removed position override to preserve fixed navbar */

/* Improve modal/dialog accessibility */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 2rem;
    border-radius: 0.5rem;
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
}

/* Improve hamburger menu accessibility */
.hamburger[aria-expanded="true"] .bar:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger[aria-expanded="true"] .bar:nth-child(2) {
    opacity: 0;
}

.hamburger[aria-expanded="true"] .bar:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Improve pagination accessibility */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 2rem 0;
}

.pagination .page-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #dee2e6;
    background: #fff;
    color: #007bff;
    text-decoration: none;
    border-radius: 0.25rem;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination .page-btn:hover,
.pagination .page-btn:focus {
    background: #e9ecef;
    border-color: #adb5bd;
}

.pagination .page-btn.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}


/* Improve share buttons accessibility */
.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    text-decoration: none;
    margin: 0 0.25rem;
}

.share-btn.facebook {
    background: #1877f2;
    color: #fff;
}

.share-btn.twitter {
    background: #1da1f2;
    color: #fff;
}

.share-btn.linkedin {
    background: #0077b5;
    color: #fff;
}

.share-btn:hover,
.share-btn:focus {
    opacity: 0.8;
    transform: scale(1.05);
}

/* Improve hamburger menu accessibility and responsiveness */
.hamburger {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: none; /* Hidden by default on desktop */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    position: relative;
}

/* Show hamburger only on mobile and tablets */
@media (max-width: 950px) {
    .hamburger {
        display: flex;
    }
}

.hamburger .bar {
    width: 25px;
    height: 3px;
    background: currentColor;
    margin: 3px 0;
    transition: all 0.3s ease;
    display: block;
    border-radius: 2px;
    position: relative;
}

/* Hamburger animation when active - perfect X */
.hamburger.active .bar:nth-child(1) {
    transform: rotate(45deg);
    position: absolute;
    top: 50%;
    left: 50%;
    margin-left: -12.5px;
    margin-top: -1.5px;
}

.hamburger.active .bar:nth-child(2) {
    opacity: 0;
    transform: translateX(-20px);
}

.hamburger.active .bar:nth-child(3) {
    transform: rotate(-45deg);
    position: absolute;
    top: 50%;
    left: 50%;
    margin-left: -12.5px;
    margin-top: -1.5px;
}

/* Ensure main navigation is visible on desktop */
@media (min-width: 951px) {
    .nav-menu {
        display: flex !important;
    }
    
    .hamburger {
        display: none !important;
    }
}

/* Mobile navigation styles */
@media (max-width: 950px) {
    .nav-container {
        position: relative;
    }
    
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        flex-direction: column;
        padding: 1rem 0;
        z-index: 1000;
        border-radius: 0 0 8px 8px;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-menu li {
        margin: 0;
        border-bottom: 1px solid #eee;
    }
    
    .nav-menu li:last-child {
        border-bottom: none;
    }
    
    .nav-menu a {
        display: block;
        padding: 1rem 1.5rem;
        color: #333;
        text-decoration: none;
        transition: background-color 0.2s ease;
    }
    
    .nav-menu a:hover,
    .nav-menu a:focus {
        background: #f8f9fa;
        outline: none;
    }
    
    .nav-menu a.active {
        background: #005fcc;
        color: #fff;
    }
}

/* Breadcrumb accessibility improvements - only focus styles */
.breadcrumb a:focus {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

/* Improve course and news cards accessibility */
.course-card,
.news-card {
    position: relative;
}

.course-card:focus-within,
.news-card:focus-within {
    outline: 2px solid #005fcc;
    outline-offset: 2px;
}

/* Improve form labels and inputs */
.contact-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.contact-form input,
.contact-form textarea,
.contact-form select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 0.25rem;
    font-size: 1rem;
}

.contact-form input:focus,
.contact-form textarea:focus,
.contact-form select:focus {
    border-color: #005fcc;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 95, 204, 0.2);
}

/* Improve stats section accessibility */
.stats {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.stat {
    text-align: center;
    min-width: 220px;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #005fcc;
    display: block;
}

.stat-label {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.5rem;
}