/* Modern CSS with CSS Variables and Clean Design */

:root {
    /* Color Palette */
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --text-color: #2c3e50;
    --text-light: #7f8c8d;
    --bg-color: #ffffff;
    --bg-light: #f8f9fa;
    --bg-dark: #ecf0f1;
    --border-color: #dee2e6;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    font-family: 'Vazir', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    direction: rtl;
    text-align: right;
    color: var(--text-color);
    background-color: var(--bg-light);
    line-height: 1.8;
    font-size: 16px;
}

#board {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    line-height: 1.3;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }

p {
    margin-bottom: var(--spacing-sm);
    text-align: justify;
}

/* Links */
a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-color);
    text-decoration: none;
}

/* Header */
header {
    background: var(--bg-color);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: var(--spacing-sm) 0;
}

header .container {
    display: grid;
    grid-template-columns: 150px 1fr;
    grid-template-areas: "logo menu";
    align-items: center;
    gap: var(--spacing-md);
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

header .logo {
    grid-area: logo;
    display: flex;
    align-items: center;
}

header .logo img {
    max-height: 80px;
    width: auto;
}

header nav {
    grid-area: menu;
    display: flex;
    justify-content: flex-start;
}

header nav ul {
    list-style: none;
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
    margin: 0;
    padding: 0;
}

header nav ul li {
    display: inline-block;
}

header nav ul li a {
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: var(--transition);
}

header nav ul li a:hover {
    background: var(--bg-dark);
    color: var(--secondary-color);
}

.featured-menu-star {
    color: #a86300;
    margin-inline-end: 0.25em;
}

/* Mobile Menu */
header .mobile {
    display: none;
}

.menu-icon {
    cursor: pointer;
    font-size: 2rem;
    color: var(--primary-color);
}

.check-box {
    display: none;
}

/* Main Content */
.main {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-lg);
    margin: var(--spacing-lg) 0;
}

/* Cards and Sections */
.notes, .telegram, .board {
    background: var(--bg-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
}

.notes {
    box-shadow: none;
}

.headline {
    border-bottom: 3px solid var(--secondary-color);
    padding-bottom: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.headline h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin: 0;
}

.notes ul {
    list-style: none;
    padding: 0;
}

.notes ul li {
    padding: var(--spacing-xs) 0;
    border-bottom: 1px solid var(--bg-dark);
    transition: var(--transition);
}

.notes ul li:hover {
    padding-right: var(--spacing-sm);
    background: var(--bg-light);
}

.notes ul li:last-child {
    border-bottom: none;
}

/* Board Section */
.board {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    position: relative;
    overflow: hidden;
}

.telegram,
.board {
    background: none;
    border: none;
    box-shadow: none;
}

.board img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: none;
}

.board-with-featured {
    flex-direction: column;
    justify-content: flex-start;
    gap: 1rem;
    min-height: 0;
    padding: clamp(.75rem, 2vw, 1.25rem);
}

.board-featured {
    width: 100%;
}

.board-featured h2 {
    margin-bottom: .65rem;
    font-size: 1.1rem;
}

.board-featured ul {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 7rem), 1fr));
    gap: .65rem;
    list-style: none;
}

.board-featured a {
    display: flex;
    flex-direction: column;
    gap: .45rem;
    height: 100%;
    padding: .45rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-color);
    color: var(--primary-color);
    font-size: .84rem;
    font-weight: 700;
    line-height: 1.55;
}

.board-featured a:hover,
.board-featured a:focus-visible {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.board-featured-cover {
    display: grid;
    place-items: center;
    grid-template: minmax(0, 1fr) / minmax(0, 1fr);
    height: 8rem;
    background: #edf3ef;
    border-radius: var(--radius-sm);
}

.board-featured-cover img {
    max-height: 100%;
    object-fit: contain;
}

/* Books Carousel */
.books {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--spacing-md);
    padding: var(--spacing-lg) 0;
}

.books div {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: var(--transition);
}

.books div:hover {
    transform: translateY(-5px);
}

.books div img {
    width: 150px;
    height: 220px;
    object-fit: cover;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.books div img:hover {
    box-shadow: var(--shadow-lg);
}

/* Categories */
.categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-lg);
    margin: var(--spacing-lg) 0;
}

.categories > div {
    background: var(--bg-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.categories > div:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.categories ul {
    list-style: none;
    padding: 0;
}

.categories ul li {
    padding: var(--spacing-xs) 0;
    border-bottom: 1px solid var(--bg-dark);
}

.categories ul li:last-child {
    border-bottom: none;
}

/* About Section */
.about {
    background: var(--bg-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    margin: var(--spacing-lg) 0;
    box-shadow: var(--shadow-sm);
}

/* Route Bar (Breadcrumb) */
.route-bar {
    background: var(--bg-color);
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-md);
    margin: var(--spacing-md) 0;
    font-size: 0.9rem;
    box-shadow: var(--shadow-sm);
}

.route-bar a, .route-bar span {
    color: var(--text-light);
}

.route-bar a:hover {
    color: var(--secondary-color);
}

/* Comments Section */
.comments {
    background: var(--bg-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin: var(--spacing-lg) 0;
    box-shadow: var(--shadow-sm);
}

.comments-header {
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.comments-header h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.comment {
    background: var(--bg-light);
    border-right: 4px solid var(--secondary-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    transition: var(--transition);
}

.comment:hover {
    box-shadow: var(--shadow-sm);
    background: var(--bg-color);
}

.comment-author {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: var(--spacing-xs);
}

.comment-date {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: var(--spacing-sm);
}

.comment-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.8;
    color: var(--text-color);
}

/* Attachment */
.attachment {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: var(--bg-light);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin: var(--spacing-md) 0;
}

.attachment div {
    text-align: center;
}

.attachment .submit {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: 'Vazir';
    font-weight: 500;
    transition: var(--transition);
}

.attachment .submit:hover {
    background: #c0392b;
    transform: scale(1.05);
}

/* Footer */
footer {
    background: var(--primary-color);
    color: white;
    padding: var(--spacing-xl) var(--spacing-lg);
    margin-top: var(--spacing-xl);
}

footer .container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: var(--spacing-lg);
}

footer h5 {
    color: white;
    margin-bottom: var(--spacing-md);
    font-size: 1.2rem;
}

footer p {
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.9);
}

.footer-social {
    container-type: inline-size;
}

.footer-social-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.625rem;
    list-style: none;
}

@container (max-width: 26.5rem) {
    .footer-social-links {
        grid-template-columns: 1fr;
    }
}

.footer-social-link {
    --social-color: #a7c8ff;
    --social-icon-bg: #254b83;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.625rem;
    height: 100%;
    padding: 0.625rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-lg);
    background: linear-gradient(to left, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
    color: white;
    transition: background-color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.footer-social-bale { --social-color: #73edcc; --social-icon-bg: #154f49; }
.footer-social-facebook { --social-color: #a7c8ff; --social-icon-bg: #254b83; }
.footer-social-linkedin { --social-color: #a3d9ff; --social-icon-bg: #1e5278; }
.footer-social-telegram { --social-color: #8fe7ff; --social-icon-bg: #1b5669; }
.footer-student-text { white-space: pre-line; }

.footer-social-icon {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-md);
    background: var(--social-icon-bg);
    color: var(--social-color);
    font-size: 1.1rem;
}

.footer-social-label {
    font-size: 0.9375rem;
    font-weight: 700;
    line-height: 1.5;
}

.footer-social-label bdi {
    display: block;
    color: #d0deea;
    font-size: 0.75rem;
    font-weight: 400;
    text-align: right;
    overflow-wrap: anywhere;
}

.footer-social-arrow {
    color: #bfcedb;
    font-size: 0.75rem;
}

.footer-social-link:hover,
.footer-social-link:focus-visible {
    border-color: var(--social-color);
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
}

.footer-social-link:focus-visible {
    outline: 2px solid var(--social-color);
    outline-offset: 2px;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
    .footer-social-link:hover {
        transform: translateY(-2px);
    }
}

footer .fa {
    margin-left: var(--spacing-xs);
}

/* Link Styles */
.link-pdf {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-sm);
    background: rgba(52, 152, 219, 0.1);
    border: 2px solid var(--secondary-color);
    border-radius: var(--radius-md);
    color: var(--secondary-color);
    font-weight: 600;
    transition: var(--transition);
}

.link-pdf:hover {
    background: var(--secondary-color);
    color: white;
}

.link-pdf::before {
    content: 'PDF: ';
    font-weight: 700;
}

/* Telegram */
.telegram {
    display: flex;
    justify-content: center;
    align-items: center;
}

.telegram > a {
    max-width: 100%;
}

.telegram img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
}

/* Responsive Design */
@media only screen and (max-width: 1024px) {
    .main {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .categories {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media only screen and (max-width: 856px) {
    header .container {
        grid-template-columns: 1fr 150px;
        grid-template-areas: "mobile logo";
    }
    
    header nav {
        display: none;
    }
    
    header .mobile {
        display: flex;
        align-items: center;
        grid-area: mobile;
    }
    
    header .mobile .menu-icon {
        position: relative;
        right: auto;
        top: auto;
    }
    
    header .mobile ul {
        position: absolute;
        right: 0;
        top: 100%;
        width: 100%;
        background: var(--bg-color);
        box-shadow: var(--shadow-lg);
        display: none;
        padding: var(--spacing-sm);
    }
    
    header .mobile ul li {
        display: block;
        border-bottom: 1px solid var(--border-color);
        padding: var(--spacing-sm);
    }
    
    .check-box:checked ~ ul {
        display: block;
    }
    
    .main {
        grid-template-columns: 1fr;
    }
    
    .board {
        display: none;
    }

    .board-with-featured {
        display: flex;
    }

    .board-slider {
        display: none;
    }
    
    footer .container {
        grid-template-columns: 1fr;
    }
}

@media only screen and (max-width: 520px) {
    .categories {
        grid-template-columns: 1fr;
    }
    
    .books {
        grid-template-columns: repeat(2, 1fr);
    }
    
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.3rem; }
    h3 { font-size: 1.1rem; }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }
.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }

/* Modern Image Slider */
.image-slider {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.slider-container {
    display: flex;
    transition: transform 0.5s ease-in-out;
}

.slide {
    min-width: 100%;
    position: relative;
}

.slide img {
    width: 100%;
    height: auto;
    display: block;
}

.slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: var(--transition);
    z-index: 10;
}

.slider-nav:hover {
    background: white;
    box-shadow: var(--shadow-md);
}

.slider-nav.prev {
    right: 10px;
}

.slider-nav.next {
    left: 10px;
}

.slider-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: var(--transition);
}

.dot.active {
    background: white;
    transform: scale(1.2);
}
