/* ===== ENHANCED MOBILE NAVIGATION STYLES ===== */

/* Mobile Navigation Container */
.mobile-nav {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

/* Enhanced Mobile Navigation Collapse */
.mobile-nav .navbar-collapse,
#mainNavigation {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 15px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    margin-top: 1rem;
    padding: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    max-height: 80vh;
    overflow-y: auto;
    width: 100% !important;
    display: block !important;
}

/* Show mobile navigation when collapsed */
@media (max-width: 1199.98px) {
    .mobile-nav {
        display: block !important;
    }
    
    #mainNavigation.collapse:not(.show) {
        display: none !important;
    }
    
    #mainNavigation.collapse.show {
        display: block !important;
    }
}

/* Mobile Navigation Content */
.mobile-nav-content .nav-menu,
.mobile-nav-content > .nav-menu {
    gap: 0.25rem;
    width: 100%;
    display: block !important;
}

/* Enhanced Mobile Navigation Links */
.mobile-nav .nav-link,
.mobile-nav-content .nav-link,
#mainNavigation .nav-link {
    padding: 1rem 1.25rem !important;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    color: #2c3e50 !important;
    font-weight: 500;
    display: flex !important;
    align-items: center;
    position: relative;
    overflow: hidden;
    width: 100%;
    text-decoration: none;
}

/* Navigation items */
.mobile-nav .nav-item,
.mobile-nav-content .nav-item,
#mainNavigation .nav-item {
    width: 100%;
    display: block !important;
    margin-bottom: 0.5rem;
}

/* Hover effects for mobile links */
.mobile-nav .nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.1), transparent);
    transition: left 0.6s;
}

.mobile-nav .nav-link:hover::before {
    left: 100%;
}

.mobile-nav .nav-link:hover {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white !important;
    transform: translateX(8px) scale(1.02);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    border-bottom-color: transparent;
}

.mobile-nav .nav-link:hover i {
    color: white !important;
    transform: scale(1.1);
}

.mobile-nav .nav-link:last-child {
    border-bottom: none;
}

/* Enhanced Mobile Dropdown Menus */
.mobile-nav .dropdown-menu,
.mobile-nav-content .dropdown-menu,
#mainNavigation .dropdown-menu {
    position: static !important;
    float: none;
    width: calc(100% - 2rem) !important;
    margin: 0.5rem 1rem 0;
    box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0.5rem 0;
    transform: none !important;
    display: block !important;
}

/* Show dropdown when active */
.mobile-nav .dropdown.show .dropdown-menu,
.mobile-nav-content .dropdown.show .dropdown-menu,
#mainNavigation .dropdown.show .dropdown-menu {
    display: block !important;
    opacity: 1;
    visibility: visible;
}

.mobile-nav .dropdown:not(.show) .dropdown-menu,
.mobile-nav-content .dropdown:not(.show) .dropdown-menu,
#mainNavigation .dropdown:not(.show) .dropdown-menu {
    display: none !important;
}

/* Enhanced Mobile Dropdown Items */
.mobile-nav .dropdown-item,
.mobile-nav-content .dropdown-item,
#mainNavigation .dropdown-item {
    border-radius: 8px;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    color: #374151 !important;
    margin: 0.25rem 0.5rem;
    display: flex !important;
    align-items: center;
    width: calc(100% - 1rem);
    text-decoration: none;
}

.mobile-nav .dropdown-item:hover {
    background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
    color: #3b82f6 !important;
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

/* Mobile User Actions */
.mobile-user-actions {
    border-top: 2px solid var(--border-color) !important;
}

.mobile-user-actions .btn {
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-weight: var(--font-weight-medium);
}

/* Enhanced Search Box for Mobile */
.mobile-nav .search-box .form-control {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    font-size: 1rem;
    background: white;
}

.mobile-nav .search-box .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(93, 89, 255, 0.15);
}

.mobile-nav .search-box .btn {
    border-radius: var(--radius-md);
    border: 2px solid var(--primary-color);
    padding: var(--spacing-md) var(--spacing-lg);
}

/* ===== RESPONSIVE BREAKPOINT IMPROVEMENTS ===== */

/* Extra small devices (phones, 576px and down) */
@media (max-width: 575.98px) {
    .container {
        padding-left: var(--spacing-md);
        padding-right: var(--spacing-md);
    }
    
    .header-main .logo h1 {
        font-size: 1.2rem !important;
    }
    
    .header-main .logo small {
        font-size: 0.75rem;
    }
    
    .logo-box {
        width: 40px !important;
        height: 40px !important;
        font-size: 0.9rem !important;
    }
    
    .top-bar {
        font-size: 0.8rem;
    }
    
    .top-bar .social-links {
        display: none;
    }
    
    .top-bar .language-switcher {
        display: none;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .display-4 {
        font-size: 1.8rem !important;
    }
    
    .card-body {
        padding: var(--spacing-md) !important;
    }
    
    .featured-main .card-img-top {
        height: 250px !important;
    }
    
    .category-card .card-img-top {
        height: 150px !important;
    }
    
    .mobile-nav .navbar-collapse {
        margin-top: var(--spacing-sm);
        padding: var(--spacing-md);
        margin-left: calc(-1 * var(--spacing-md));
        margin-right: calc(-1 * var(--spacing-md));
        border-radius: 0;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .featured-main .card-img-top {
        height: 280px !important;
    }
    
    .category-card .card-img-top {
        height: 180px !important;
    }
    
    .header-main .logo h1 {
        font-size: 1.3rem !important;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .navbar-toggler {
        display: block !important;
    }
    
    .nav-menu {
        display: none !important;
    }
    
    .mobile-nav {
        display: block !important;
    }
    
    .header-main .col-md-8 {
        display: flex;
        justify-content: flex-end;
        align-items: center;
    }
    
    .featured-main .card-img-top {
        height: 300px !important;
    }
    
    .category-card .card-img-top {
        height: 200px !important;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .nav-link span {
        display: inline !important;
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
    
    .featured-main .card-img-top {
        height: 350px !important;
    }
    
    .category-card .card-img-top {
        height: 220px !important;
    }
}

/* ===== CARD HOVER EFFECTS ===== */
.article-card, .featured-main, .featured-secondary, .category-card {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.article-card:hover, .featured-main:hover, .featured-secondary:hover, .category-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1), 0 5px 15px rgba(0, 0, 0, 0.08);
}

.card-img-wrapper {
    overflow: hidden;
    position: relative;
}

.card-img-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 0%, rgba(93, 89, 255, 0.1) 100%);
    opacity: 0;
    transition: var(--transition);
    z-index: 1;
}

.article-card:hover .card-img-wrapper::before,
.featured-main:hover .card-img-wrapper::before,
.featured-secondary:hover .card-img-wrapper::before,
.category-card:hover .card-img-wrapper::before {
    opacity: 1;
}

.card-img-wrapper img {
    transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.article-card:hover .card-img-wrapper img,
.featured-main:hover .card-img-wrapper img,
.featured-secondary:hover .card-img-wrapper img,
.category-card:hover .card-img-wrapper img {
    transform: scale(1.08);
}

/* ===== CATEGORY OVERLAY EFFECTS ===== */
.category-overlay {
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    transform: translateY(20px);
}

.category-card:hover .category-overlay {
    opacity: 1 !important;
    transform: translateY(0);
}

/* ===== LOADING STATES ===== */
.loading-card {
    animation: pulse 1.5s ease-in-out infinite alternate;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0.7;
    }
}

/* Skeleton loading for images */
.card-img-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
@media (prefers-reduced-motion: reduce) {
    .article-card, .featured-main, .featured-secondary, .category-card,
    .card-img-wrapper img, .category-overlay {
        transition: none !important;
        animation: none !important;
    }
    
    .article-card:hover, .featured-main:hover, .featured-secondary:hover, .category-card:hover {
        transform: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid var(--dark-color) !important;
    }
    
    .nav-link {
        border: 1px solid transparent;
    }
    
    .nav-link:hover, .nav-link:focus {
        border-color: var(--primary-color);
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .top-bar, .main-header, .mobile-nav, .navbar-toggler,
    .btn, .pagination, .mobile-user-actions {
        display: none !important;
    }
    
    .card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ccc;
    }
    
    .card-img-wrapper img {
        max-height: 200px;
        object-fit: cover;
    }
    
    a {
        color: #000 !important;
        text-decoration: underline !important;
    }
    
    .text-muted-custom {
        color: #666 !important;
    }
}

/* ===== FOCUS MANAGEMENT ===== */
.nav-link:focus-visible,
.btn:focus-visible,
.form-control:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 0.2rem rgba(93, 89, 255, 0.25);
}

.card a.stretched-link:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: var(--radius-md);
    z-index: 1000;
}

.skip-link:focus {
    top: 6px;
}

/* ===== UTILITY CLASSES FOR RESPONSIVE DESIGN ===== */
.text-responsive {
    font-size: clamp(0.875rem, 2.5vw, 1rem);
}

.heading-responsive {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
}

.spacing-responsive {
    padding: clamp(1rem, 3vw, 2rem);
}

.container-responsive {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: clamp(1rem, 3vw, 2rem);
    padding-right: clamp(1rem, 3vw, 2rem);
}
