/* Base Template Enhancements */

/* Body layout improvements */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Skip to content link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: var(--background-base);
    padding: 8px 12px;
    text-decoration: none;
    border-radius: 0 0 4px 4px;
    font-weight: 600;
    z-index: 9999;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
    color: var(--background-base);
}

/* Enhanced navigation */
.navbar {
    backdrop-filter: blur(10px);
    background-color: var(--background-base) !important;
    border-bottom: 1px solid var(--border-color);
}

.navbar-brand {
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Flash message enhancements */
.flash-messages .alert {
    border: none;
    border-left: 4px solid currentColor;
    border-radius: 8px;
    background: var(--background-base);
}

.flash-messages .alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    border-left-color: var(--success-color);
    color: var(--success-color);
}

.flash-messages .alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    border-left-color: var(--danger-color);
    color: var(--danger-color);
}

.flash-messages .alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    border-left-color: var(--warning-color);
    color: var(--warning-color);
}

.flash-messages .alert-info {
    background-color: rgba(0, 171, 228, 0.1);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
}

/* Enhanced footer */
footer {
    margin-top: auto;
    background: var(--gradient-primary) !important;
}

footer h5, footer h6 {
    color: #0F172A !important; /* Dark slate blue - complements the blue gradient */
}

footer p {
    color: #1E293B !important; /* Slightly lighter slate blue for body text */
}

footer .social-links a {
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #1E293B !important; /* Consistent with body text */
}

footer .social-links a:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    color: #0F172A !important; /* Darker on hover for better contrast */
}

footer .social-links a i {
    color: #1E293B !important; /* Consistent icon color */
}

footer .social-links a:hover i {
    color: #0F172A !important; /* Darker on hover */
}

/* Footer link contrast fixes - WCAG AA compliant colors */
footer .text-decoration-none.small {
    color: #334155 !important; /* Medium slate gray for better contrast against blue gradient */
    opacity: 1; /* Remove opacity for consistent contrast */
}

footer .text-decoration-none.small:hover {
    color: #0F172A !important; /* Darker on hover */
    opacity: 1;
    transform: translateX(3px);
    text-decoration: underline; /* Better visual feedback */
}

footer .text-decoration-none.small i {
    color: #334155 !important; /* Consistent with link color */
}

/* Footer copyright and version text contrast fixes */
footer small {
    color: #475569 !important; /* Softer slate gray for secondary text while maintaining readability */
    opacity: 1; /* Remove opacity for consistent contrast */
}

/* Ensure all footer links meet WCAG AA standards */
footer a {
    color: #334155 !important; /* Slate gray that works well with blue gradient */
    text-decoration: none;
}

footer a:hover,
footer a:focus {
    color: #0F172A !important; /* Darker on hover/focus */
    text-decoration: underline;
    outline: 2px solid transparent; /* Focus outline handled by main CSS */
}

/* Footer section headers with proper contrast */
footer .col-lg-2 h6,
footer .col-lg-3 h6 {
    color: #0F172A !important; /* Dark slate for headers */
    font-weight: 600; /* Improve readability */
}

/* Footer icons with proper contrast */
footer i,
footer .fas,
footer .fab {
    color: #334155 !important; /* Match general link colors */
}

/* Special handling for brand elements */
footer .navbar-brand,
footer h5 {
    color: #0F172A !important; /* Brand elements use darkest slate */
}

/* Navigation improvements */
.navbar-nav .nav-link {
    transition: all 0.3s ease;
    border-radius: 6px;
    margin: 0 2px;
}

.navbar-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.badge.rounded-pill {
    padding: 0.5em 0.75em;
    font-weight: 500;
}

/* Dropdown improvements */
.dropdown-menu {
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
}

.dropdown-item {
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background-color: var(--background-light);
    transform: translateX(5px);
}

/* Responsive improvements */
@media (max-width: 768px) {
    .navbar-nav {
        padding: 1rem 0;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        margin: 0.25rem 0;
    }
    
    footer .col-lg-4, 
    footer .col-lg-2, 
    footer .col-lg-3 {
        margin-bottom: 2rem;
    }
}

/* Loading states */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--background-light);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Focus improvements */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 0.25rem rgba(0, 171, 228, 0.25);
}

/* Print styles */
@media print {
    .navbar, .flash-messages, footer {
        display: none !important;
    }
    
    body {
        background: var(--background-base) !important;
        color: var(--text-primary) !important;
    }
}
