/* Reset & Base Cosmic Theme */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.cosmic-theme {
    font-family: 'Inter', 'Vazirmatn', sans-serif;
    background: #03050b;
    color: #ffffff;
    overflow-x: hidden;
    min-height: 100vh;
}

#cosmic-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(ellipse at 30% 40%, #0a0f2a, #010105);
}

.app-container {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Glassmorphism */
.main-header {
    background: rgba(10, 20, 40, 0.7);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 255, 255, 0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    gap: 2rem;
    flex-wrap: wrap;
}

.logo-area .brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.3rem;
}

.logo-area .brand i {
    color: #0af;
    font-size: 1.8rem;
}

.logo-area .brand span {
    color: #fff;
}

.logo-area .brand span span {
    color: #0af;
    font-weight: 300;
}

/* Navigation */
.main-nav .nav-list {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.main-nav .nav-list a {
    text-decoration: none;
    color: #eef;
    font-weight: 500;
    transition: 0.3s;
}

.main-nav .nav-list a:hover {
    color: #0af;
    text-shadow: 0 0 5px #0af;
}

/* Language Switcher */
.lang-switcher {
    position: relative;
}

.lang-btn {
    background: rgba(0, 170, 255, 0.2);
    border: 1px solid #0af;
    padding: 8px 16px;
    border-radius: 30px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lang-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: rgba(10, 20, 40, 0.95);
    backdrop-filter: blur(12px);
    list-style: none;
    border-radius: 12px;
    overflow: hidden;
    min-width: 100px;
    z-index: 101;
    border: 1px solid rgba(0, 255, 255, 0.3);
}

.lang-switcher:hover .lang-dropdown {
    display: block;
}

.lang-dropdown li a {
    display: block;
    padding: 8px 16px;
    color: white;
    text-decoration: none;
}

.lang-dropdown li a:hover,
.lang-dropdown li a.active {
    background: #0af;
    color: #000;
}

/* Mobile Toggle */
.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #0af;
    cursor: pointer;
}

/* Footer */
.main-footer {
    background: rgba(5, 10, 20, 0.9);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(0, 255, 255, 0.2);
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-brand i {
    font-size: 2rem;
    color: #0af;
    margin-bottom: 1rem;
}

.social-icons {
    display: flex;
    gap: 1rem;
}

.social-icons a {
    color: white;
    font-size: 1.4rem;
    transition: 0.3s;
}

.social-icons a:hover {
    color: #0af;
    transform: translateY(-3px);
}

.footer-bottom {
    text-align: center;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 1rem;
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Responsive */
@media (max-width: 1024px) {
    .header-flex {
        padding: 1rem 1.5rem; /* Slightly less padding for tablets */
    }
    .container {
        padding: 0 15px; /* Adjust container padding for tablets */
    }
    .articles-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); /* Adjust card size for tablets */
    }
}

@media (max-width: 768px) {
    .mobile-toggle {
        display: block;
    }
    .main-nav {
        display: none;
        width: 100%;
        order: 3; /* Ensures it appears below other header elements */
        background: rgba(10, 20, 40, 0.95); /* Semi-transparent dark background for mobile nav */
        backdrop-filter: blur(8px); /* Blur effect for mobile nav */
        border-top: 1px solid rgba(0, 255, 255, 0.2);
        box-shadow: 0 5px 15px rgba(0,0,0,0.3);
        padding-bottom: 1rem; /* Add some bottom padding */
        position: absolute; /* Position relative to the header-flex parent */
        top: 100%; /* Position below the header */
        left: 0;
        right: 0;
        z-index: 99; /* Ensure it's above other content but below lang-dropdown */
    }
    .main-nav.active {
        display: block;
    }
    .nav-list {
        flex-direction: column;
        align-items: center; /* Center nav items */
        padding: 1rem 0;
        gap: 1rem; /* Reduce gap for mobile nav items */
    }
    .main-nav .nav-list a {
        padding: 0.5rem 1rem; /* Make nav links more clickable */
        width: 100%; /* Full width for clickable area */
        text-align: center;
    }
    .main-nav .nav-list a:hover {
        background: rgba(0, 170, 255, 0.1); /* Hover background for mobile nav */
        border-radius: 5px;
    }
    .header-flex {
        justify-content: space-between;
        padding: 1rem 1rem; /* Further reduce padding for smaller screens */
        gap: 1rem; /* Reduce gap in header */
    }
    .lang-switcher {
        order: 2;
    }
    .lang-dropdown {
        left: 0;
        right: auto;
        min-width: unset; /* Allow dropdown to shrink */
        width: 100%; /* Take full width of parent */
    }
    .logo-area .brand {
        font-size: 1.2rem; /* Slightly smaller logo text */
    }
    .logo-area .brand i {
        font-size: 1.6rem; /* Slightly smaller icon */
    }

    .footer-content {
        grid-template-columns: 1fr; /* Stack footer columns */
        text-align: center; /* Center content in footer */
    }
    .social-icons {
        justify-content: center; /* Center social icons */
    }
    .articles-grid {
        grid-template-columns: 1fr; /* Stack article cards */
    }
    .article-card {
        max-width: 90%; /* Limit width for better readability on single column */
        margin: 0 auto; /* Center single column cards */
    }
}

/* Utility */
.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Further adjustments for very small screens */
@media (max-width: 480px) {
    body.cosmic-theme {
        font-size: 15px; /* Slightly smaller base font size */
    }
    .header-flex {
        padding: 0.8rem 0.8rem;
    }
    .logo-area .brand {
        font-size: 1.1rem;
    }
    .logo-area .brand i {
        font-size: 1.5rem;
    }
    .mobile-toggle {
        font-size: 1.6rem;
    }
    .main-nav .nav-list a {
        font-size: 1rem;
    }
    .lang-btn {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
    .lang-dropdown li a {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
    .article-card-content h2 a {
        font-size: 1.2rem;
    }
    .article-meta {
        font-size: 0.75rem;
    }
    .pagination a, .pagination span {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
    .notice-fallback {
        top: 50px; /* Further adjust top position if header height changes */
        font-size: 0.8rem;
        padding: 8px 10px;
    }
    .footer-content {
        gap: 1.5rem; /* Reduce gap in footer */
    }
    .articles-grid {
        gap: 1.5rem; /* Reduce gap in article grid */
    }
}

/* Utility */
.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Category & Article Cards (cosmic style) */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.article-card {
    background: rgba(15, 25, 45, 0.6);
    backdrop-filter: blur(8px);
    border-radius: 24px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 255, 255, 0.2);
}

.article-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 30px rgba(0, 170, 255, 0.2);
    border-color: #0af;
}

.article-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.article-card-content {
    padding: 1.5rem;
}

.article-card-content h2 a {
    color: white;
    text-decoration: none;
    font-size: 1.3rem;
}

.article-meta {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    font-size: 0.8rem;
    color: #aaf;
}


.notice-fallback {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.95), rgba(255, 152, 0, 0.95));
    color: #1a1a1a;
    text-align: center;
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    position: sticky;
    top: 70px; /* Default top position, adjusted in media queries */
    z-index: 99;
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255,255,255,0.3);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.notice-fallback i {
    margin-left: 8px;
    font-size: 1rem;
}


/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 2rem 0;
}

.pagination a, .pagination span {
    padding: 8px 16px;
    background: rgba(0,170,255,0.2);
    border-radius: 30px;
    text-decoration: none;
    color: white;
}

.pagination .active {
    background: #0af;
    color: black;
}