html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2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        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

/* ============================================
   Mobile-First Responsive Design Enhancements
   ============================================ */

/* Base Typography - Ensure readable font sizes on mobile */
@media (max-width: 767.98px) {
    body {
        font-size: 1rem;
        line-height: 1.6;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    h4 {
        font-size: 1.125rem;
    }
    
    h5, h6 {
        font-size: 1rem;
    }
}

/* Touch-Friendly Interactive Elements */
@media (max-width: 767.98px) {
    /* Minimum touch target size of 44x44px for better mobile UX */
    .btn,
    .nav-link,
    a.btn,
    button {
        min-height: 44px;
        padding: 0.625rem 1rem;
    }
    
    .btn-sm {
        min-height: 38px;
        padding: 0.5rem 0.75rem;
    }
    
    /* Increase spacing between interactive elements */
    .btn + .btn,
    .nav-item + .nav-item {
        margin-top: 0.5rem;
    }
}

/* Responsive Images */
img {
    max-width: 100%;
    height: auto;
}

.img-fluid {
    max-width: 100%;
    height: auto;
}

/* Responsive Tables */
@media (max-width: 767.98px) {
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        font-size: 0.875rem;
    }
    
    /* Stack table cells on very small screens if needed */
    .table-stack-mobile thead {
        display: none;
    }
    
    .table-stack-mobile tbody,
    .table-stack-mobile tr,
    .table-stack-mobile td {
        display: block;
        width: 100%;
    }
    
    .table-stack-mobile tr {
        margin-bottom: 1rem;
        border: 1px solid #dee2e6;
        border-radius: 0.375rem;
        padding: 0.75rem;
    }
    
    .table-stack-mobile td {
        text-align: right;
        padding-left: 50%;
        position: relative;
        border: none;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
    
    .table-stack-mobile td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 50%;
        padding-left: 0.75rem;
        font-weight: 600;
        text-align: left;
    }
}

/* Form Controls - Better mobile experience */
@media (max-width: 767.98px) {
    .form-control,
    .form-select {
        font-size: 1rem;
        min-height: 44px;
    }
    
    .form-label {
        font-weight: 600;
        margin-bottom: 0.5rem;
    }
    
    /* Better spacing for form groups */
    .mb-3 {
        margin-bottom: 1.25rem !important;
    }
}

/* Card Layouts - Ensure proper stacking */
@media (max-width: 767.98px) {
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1.25rem;
    }
}

/* Container Padding - Better mobile spacing */
@media (max-width: 767.98px) {
    .container,
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Utility Classes for Mobile Optimization */
.mobile-hidden {
    display: none !important;
}

@media (min-width: 768px) {
    .mobile-hidden {
        display: block !important;
    }
    
    .desktop-hidden {
        display: none !important;
    }
}

@media (max-width: 767.98px) {
    .desktop-hidden {
        display: block !important;
    }
    
    /* Mobile-specific text alignment */
    .text-center-mobile {
        text-align: center !important;
    }
    
    .text-start-mobile {
        text-align: left !important;
    }
    
    /* Full width on mobile */
    .w-100-mobile {
        width: 100% !important;
    }
    
    /* Remove horizontal padding on mobile */
    .px-0-mobile {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

/* Prevent horizontal scroll on mobile */
body {
    overflow-x: hidden;
}

/* Smooth scrolling for better mobile experience */
html {
    scroll-behavior: smooth;
}

/* Improve tap highlight color */
a, button, .btn {
    -webkit-tap-highlight-color: rgba(27, 110, 194, 0.2);
}

/* Better focus states for keyboard navigation */
a:focus,
button:focus,
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid #1b6ec2;
    outline-offset: 2px;
}

/* ============================================
   Accessibility Enhancements (WCAG 2.1 AA)
   ============================================ */

/* Skip to main content link - for keyboard users */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: #fff;
    padding: 8px 12px;
    text-decoration: none;
    z-index: 100;
    border-radius: 0 0 4px 0;
}

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

/* Ensure links are distinguishable from regular text */
a:not(.btn):not(.nav-link) {
    text-decoration: underline;
}

a:not(.btn):not(.nav-link):hover {
    text-decoration: none;
}

/* Screen reader only content */
.sr-only,
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focusable when navigated to via keyboard */
.sr-only-focusable:focus,
.visually-hidden-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0s !important;
        scroll-behavior: auto !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn-primary {
        border: 2px solid currentColor;
    }
    
    .form-control,
    .form-select {
        border: 2px solid currentColor;
    }
}

/* Ensure proper color contrast for validation messages */
.valid-feedback,
.is-valid ~ .valid-feedback {
    color: #146c00; /* Darker green for better contrast */
}

/* Make sure disabled buttons are clearly distinguished */
.btn:disabled,
.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Alert/Status message styling for better accessibility */
.alert {
    border-left: 4px solid;
}

.alert-success {
    border-left-color: #26b050;
}

.alert-danger {
    border-left-color: #e50000;
}

.alert-warning {
    border-left-color: #ffc107;
}

.alert-info {
    border-left-color: #17a2b8;
}

/* Ensure modal backdrop is visible to all users */
.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.7);
}

/* Improve table accessibility */
table caption {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    color: #6c757d;
    text-align: left;
    caption-side: top;
}

/* Focus styles for keyboard navigation in tables */
table th:focus,
table td:focus {
    outline: 2px solid #1b6ec2;
    outline-offset: -2px;
}

/* Make sure text can be resized up to 200% */
html {
    font-size: 100%;
}

/* Ensure consistent focus indicator thickness */
:focus-visible {
    outline: 2px solid #1b6ec2;
    outline-offset: 2px;
}

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

/* Ensure required field indicators are accessible */
.required::after,
label.required::after {
    content: " *";
    color: #e50000;
    font-weight: bold;
}

/* Better contrast for placeholder text */
::placeholder {
    color: #6c757d;
    opacity: 1;
}

:-ms-input-placeholder {
    color: #6c757d;
}

::-ms-input-placeholder {
    color: #6c757d;
}

/* ============================================
   Home Page Grid Layouts
   ============================================ */

/* Grid layouts for different sections */
.events-grid,
.departments-grid,
.courses-grid,
.faculty-grid,
.news-grid {
    display: grid;
    gap: 30px;
}

/* 2 columns on tablet, 3 on desktop */
.events-grid,
.news-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

/* 2 columns on tablet, 3 on desktop for departments */
.departments-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

/* 2 columns on tablet, 4 on desktop for courses */
.courses-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

/* 2 columns on tablet, 3 on desktop for faculty */
.faculty-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

/* Add staggered animation to grid items */
.events-grid > *,
.departments-grid > *,
.courses-grid > *,
.faculty-grid > *,
.news-grid > * {
    animation: fadeInScale 0.5s ease-out backwards;
}

/* Staggered animation delays for first 4 items */
.events-grid > *:nth-child(1),
.departments-grid > *:nth-child(1),
.courses-grid > *:nth-child(1),
.faculty-grid > *:nth-child(1),
.news-grid > *:nth-child(1) { 
    animation-delay: 0.1s; 
}

.events-grid > *:nth-child(2),
.departments-grid > *:nth-child(2),
.courses-grid > *:nth-child(2),
.faculty-grid > *:nth-child(2),
.news-grid > *:nth-child(2) { 
    animation-delay: 0.2s; 
}

.events-grid > *:nth-child(3),
.departments-grid > *:nth-child(3),
.courses-grid > *:nth-child(3),
.faculty-grid > *:nth-child(3),
.news-grid > *:nth-child(3) { 
    animation-delay: 0.3s; 
}

.events-grid > *:nth-child(4),
.departments-grid > *:nth-child(4),
.courses-grid > *:nth-child(4),
.faculty-grid > *:nth-child(4),
.news-grid > *:nth-child(4) { 
    animation-delay: 0.4s; 
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments for grid layouts */
@media (max-width: 768px) {
    .events-grid,
    .departments-grid,
    .courses-grid,
    .faculty-grid,
    .news-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    /* Disable staggered animations on mobile for better performance */
    .events-grid > *,
    .departments-grid > *,
    .courses-grid > *,
    .faculty-grid > *,
    .news-grid > * {
        animation: fadeInUp 0.4s ease-out;
        animation-delay: 0s !important;
    }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .events-grid,
    .news-grid,
    .departments-grid,
    .faculty-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .courses-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
