@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;700&display=swap');

/* Custom Font for Nastaliq text */
@font-face {
    font-family: 'IranNastaliq';
    src: url('https://github.com/emenmousavi/tamannah/blob/main/fonts/IranNastaliq.ttf?raw=true') format('truetype');
    font-weight: normal;
    font-style: normal;
}

:root {
    --primary-color: #2196F3; /* Blue */
    --secondary-color: rgba(240, 248, 255, 0.8); /* Semi-transparent light blue/grey */
    --text-color: #333;
    --accent-color: #64B5F6; /* Lighter blue accent */
    --link-color: var(--text-color);
    --link-hover-color: var(--primary-color);
    --header-bg-color: rgba(255, 255, 255, 0.85);
    --footer-bg-color: rgba(51, 51, 51, 0.85);
    --footer-text-color: #eee;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: all 0.3s ease-in-out;
}

body {
    font-family: 'Vazirmatn', sans-serif;
    color: var(--text-color);
    line-height: 1.7;
    direction: rtl;
    text-align: right;
    overflow-x: hidden;
    background-color: #333;
    background-image: url('https://github.com/emenmousavi/tamannah/blob/main/images/1280px-Beautiful_view_of_Tabriz_in_Iran.jpg?raw=true');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(3px);
    z-index: -1;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 30px;
}

header {
    background-color: var(--header-bg-color);
    backdrop-filter: blur(10px);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    font-family: 'IranNastaliq', serif;
    font-size: 2.5rem;
    color: var(--primary-color);
    text-decoration: none;
    line-height: 1;
}

nav ul {
    list-style: none;
    display: flex;
}

nav li {
    margin-right: 20px;
}

nav a {
    text-decoration: none;
    color: var(--link-color);
    font-size: 1rem;
    font-weight: 700;
    position: relative;
    padding: 0.5rem 0;
}

nav a::before {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease-in-out;
}

nav a:hover {
    color: var(--link-hover-color);
}

nav a:hover::before {
    width: 100%;
}

/* Hamburger Menu & Mobile Nav (Default Hidden) */
.hamburger, 
.mobile-nav {
    display: none;
}

main {
    padding-top: 80px;
    background-color: var(--secondary-color);
    padding-bottom: 40px;
}

.hero {
    text-align: center;
    padding: 120px 0;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeUp 0.8s ease-out 0.3s forwards;
    background-color: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(5px);
    margin-bottom: 20px;
}

.hero h1 {
    font-size: 2.8rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.hero h2 {
    font-size: 1.4rem;
    color: var(--text-color);
    font-weight: 300;
}

.section {
    padding: 80px 0;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeUp 0.8s ease-out 0.4s forwards;
}

.section h2 {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 40px;
    color: var(--primary-color);
    position: relative;
    padding-bottom: 10px;
    display: inline-block;
}

.section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 2px;
    background-color: var(--accent-color);
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 40px;
    justify-content: center;
    padding: 0 20px;
}

.book-item {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    text-align: center;
    padding: 20px;
    animation: fadeIn 0.8s ease-in-out forwards;
    opacity: 0;
    transform: translateY(20px);
}

.book-item:nth-child(1) { animation-delay: 0.1s; }
.book-item:nth-child(2) { animation-delay: 0.2s; }
.book-item:nth-child(3) { animation-delay: 0.3s; }
.book-item:nth-child(4) { animation-delay: 0.4s; }
.book-item:nth-child(5) { animation-delay: 0.5s; }
.book-item:nth-child(6) { animation-delay: 0.6s; }
.book-item:nth-child(7) { animation-delay: 0.7s; }
.book-item:nth-child(8) { animation-delay: 0.8s; }

.book-cover {
    width: 100%;
    max-width: 200px;
    height: auto;
    border-radius: 5px;
    margin-bottom: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.book-item h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.book-item p {
    font-size: 1rem;
    color: #666;
    margin-bottom: 5px;
}

.book-item .download-link {
    display: inline-block;
    text-decoration: none;
    color: #fff;
    background-color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 10px 25px;
    border-radius: 5px;
    font-weight: 700;
    margin-top: 15px;
}

.book-item .download-link:hover {
    background-color: transparent;
    color: var(--primary-color);
}

footer {
    background-color: var(--footer-bg-color);
    backdrop-filter: blur(5px);
    color: var(--footer-text-color);
    padding: 40px 0;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeUp 0.8s ease-out 0.5s forwards;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.footer-nav ul {
    list-style: none;
    display: flex;
    margin-bottom: 20px;
}

.footer-nav li {
    margin: 0 15px;
}

.footer-nav a {
    text-decoration: none;
    color: var(--footer-text-color);
    font-size: 0.9rem;
    font-weight: 700;
}

.footer-nav a:hover {
    color: var(--primary-color);
}

.social-links {
    margin-bottom: 20px;
}

.social-links a {
    color: var(--footer-text-color);
    font-size: 1.3rem;
    margin: 0 10px;
    text-decoration: none;
    opacity: 0.8;
}

.social-links a:hover {
    opacity: 1;
    transform: scale(1.1);
}

.social-links a[title="تلگرام"]:hover { color: #0088cc; }
.social-links a[title="اینستاگرام"]:hover { color: #C13584; }
.social-links a[title="ایمیل"]:hover { color: #4CAF50; }

footer p {
    font-size: 0.8rem;
    opacity: 0.7;
}

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

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

/* Responsive Design & Mobile Menu Fix */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    header nav {
        display: none !important;
    }

    /* دکمه همبرگری */
    .hamburger {
        display: flex !important;
        flex-direction: column;
        justify-content: space-around;
        width: 30px;
        height: 25px;
        cursor: pointer;
        z-index: 10001;
        padding: 2px;
    }

    .hamburger span {
        width: 100%;
        height: 3px;
        background-color: var(--primary-color);
        border-radius: 2px;
        transition: all 0.3s ease-in-out;
    }

    .hamburger.open span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 6px);
    }

    .hamburger.open span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.open span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -6px);
    }

    /* منوی کشویی موبایل */
    .mobile-nav {
        display: block !important;
        position: fixed;
        top: 60px;
        right: -100%;
        width: 100%;
        height: calc(100vh - 60px);
        background-color: var(--header-bg-color);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        transition: right 0.3s ease-in-out;
        z-index: 10000;
        padding-top: 20px;
    }

    .mobile-nav.active {
        right: 0 !important;
    }

    .mobile-nav ul {
        list-style: none !important;
        padding: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .mobile-nav li {
        margin: 12px 0;
        width: 100%;
        text-align: center;
    }

    .mobile-nav a {
        font-size: 1.1rem;
        font-weight: 700;
        color: var(--link-color);
        text-decoration: none;
        display: block;
        padding: 10px;
    }

    main {
        padding-top: 90px;
    }

    .hero {
        padding: 80px 0;
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .hero h2 {
        font-size: 1.1rem;
    }

    .section {
        padding: 60px 0;
    }

    .section h2 {
        font-size: 1.6rem;
    }

    .books-grid {
        grid-template-columns: 1fr;
        gap: 25px;
        padding: 0 10px;
    }

    .book-item {
        padding: 15px;
    }

    .book-item h3 {
        font-size: 1.3rem;
    }

    .book-item p {
        font-size: 0.9rem;
    }

    .book-item .download-link {
        padding: 8px 20px;
        font-size: 0.9rem;
    }

    .footer-nav ul {
        flex-direction: column;
        align-items: center;
    }

    .footer-nav li {
        margin: 10px 0;
    }

    .social-links a {
        margin: 0 8px;
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }

    .logo a {
        font-size: 1.8rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero h2 {
        font-size: 1rem;
    }

    .books-grid {
        padding: 0 5px;
    }

    .book-item {
        padding: 12px;
    }

    .book-item h3 {
        font-size: 1.2rem;
    }
}
