@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;700&display=swap');

:root {
    --bg-color: #f9fafc;
    --text-color: #333;
    --header-bg: #fff;
    --accent-color: #00b9b9;
    --accent-dark: #008080;
    --card-bg: #fff;
    --shadow-color: rgba(0, 0, 0, 0.08);
    --footer-bg-start: #111;
    --footer-bg-end: #222;
    --footer-text: #aaa;
    --border-color: #e0e0e0;
    --button-depth: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #ddd;
    --header-bg: #1e1e1e;
    --accent-color: #00dada;
    --accent-dark: #00b9b9;
    --card-bg: #1e1e1e;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --footer-bg-start: #000;
    --footer-bg-end: #111;
    --footer-text: #ccc;
    --border-color: #444;
    --button-depth: inset 0 2px 4px rgba(255, 255, 255, 0.1), 0 1px 2px rgba(255, 255, 255, 0.05);
}

body {
    margin: 0;
    font-family: "Vazirmatn", sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    direction: rtl;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    font-size: 16px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- تولبار --- */
header {
    background: var(--header-bg);
    box-shadow: 0 2px 6px var(--shadow-color);
    padding: 5px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 55px;
    transition: box-shadow 0.3s ease, background 0.3s ease;
}
header:hover {
    box-shadow: 0 4px 12px rgba(0, 185, 185, 0.1);
}
header .logo {
    display: flex;
    align-items: center;
}
header .logo img {
    width: 130px;
    height: 55px;
    object-fit: contain;
}
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
nav a {
    margin: 0 12px;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 400;
    font-size: 1rem;
    transition: color 0.3s ease, background-color 0.3s ease;
    padding: 4px 8px;
    border-radius: 4px;
}
nav a.active {
    color: var(--accent-color);
    background-color: rgba(0, 185, 185, 0.1);
    font-weight: 700;
}
nav a:hover {
    color: var(--accent-color);
    background-color: rgba(0, 185, 185, 0.05);
}
.theme-switch {
    display: flex;
    align-items: center;
    margin-left: 20px;
}
.theme-switch input {
    display: none;
}
.theme-switch-label {
    position: relative;
    display: inline-block;
    width: 56px;
    height: 28px;
    background-color: #ccc;
    border-radius: 28px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    overflow: hidden;
}
.theme-switch-label::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background-color: #fff;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.theme-switch-label .sun-icon,
.theme-switch-label .moon-icon {
    display: none;
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.theme-switch-label .sun-icon {
    content: '\f185';
    left: 8px;
    color: #ffd700;
    opacity: 1;
}
.theme-switch-label .moon-icon {
    content: '\f186';
    right: 8px;
    color: #292929;
    opacity: 0;
}
.theme-switch input:checked+.theme-switch-label {
    background-color: var(--accent-color);
}
.theme-switch input:checked+.theme-switch-label::before {
    transform: translateX(28px);
}
.theme-switch input:checked+.theme-switch-label .sun-icon {
    opacity: 0;
    transform: translateY(-50%) translateX(-10px);
}
.theme-switch input:checked+.theme-switch-label .moon-icon {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}
.theme-switch input:not(:checked)+.theme-switch-label .sun-icon {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}
.theme-switch input:not(:checked)+.theme-switch-label .moon-icon {
    opacity: 0;
    transform: translateY(-50%) translateX(10px);
}
.nav-toggle {
    display: none;
}
.nav-toggle-label {
    display: none;
    cursor: pointer;
    width: 35px;
    height: 35px;
    position: relative;
    transition: background-color 0.3s ease;
}
.nav-toggle-label img {
    width: 30px;
    height: 30px;
    padding: 8px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
@media screen and (max-width: 768px) {
    header {
        justify-content: space-between;
        padding: 10px 20px;
        align-items: center;
    }
    .nav-toggle-label {
        display: flex;
        align-items: center;
        justify-content: center;
        order: -1;
    }
    .logo {
        margin-right: 10px;
        margin-left: 0;
    }
    .theme-switch {
        margin-right: auto;
        margin-left: 0;
    }
    nav {
        display: none;
        position: absolute;
        top: 55px;
        right: 0;
        width: 100%;
        background: var(--header-bg);
        box-shadow: 0 2px 6px var(--shadow-color);
        padding: 20px 0;
        opacity: 0;
        transform: translateY(-20px);
        transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .nav-toggle:checked~nav {
        display: block;
        opacity: 1;
        transform: translateY(0);
    }
    nav a:hover,
    nav a.active {
        border-right: 4px solid var(--accent-color);
        background-color: rgba(0, 185, 185, 0.05);
        transform: translateX(-5px);
    }
    nav a {
        display: block;
        margin: 10px 0;
        padding: 10px 40px;
        text-align: right;
        border-right: 4px solid transparent;
        font-size: 1rem;
        transition: border-color 0.3s ease, background-color 0.3s ease, transform 0.3s ease;
    }
    nav a:hover {
        border-right: 4px solid var(--accent-color);
        background-color: rgba(0, 185, 185, 0.05);
        transform: translateX(-5px);
    }
}
@media screen and (min-width: 769px) {
    .nav-toggle-label {
        display: none;
    }
}

/* --- بخش محتوا --- */
.content {
    padding: 40px 20px;
    max-width: 1200px;
    margin: auto;
    text-align: right;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 8px var(--shadow-color);
    transition: background 0.3s ease;
}
.content h1 {
    font-size: 2rem;
    color: var(--text-color);
    margin: 10px 0 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- لودینگ اولیه --- */
.initial-loader {
    text-align: center;
    padding: 80px 20px;
    transition: opacity 0.6s ease;
}
.initial-loader p {
    margin-top: 20px;
    color: var(--accent-color);
    font-weight: 500;
    font-size: 1.1rem;
}
.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- گرید و کارت‌های جدید --- */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 28px;
    margin-top: 30px;
}

.blog-card {
    background: var(--card-bg);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 25px var(--shadow-color);
    transition: all 0.35s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
    user-select: none;
    -webkit-user-select: none;
}
.blog-card:hover {
    transform: translateY(-12px);
    box-shadow: 0 20px 40px rgba(0, 185, 185, 0.18);
}
.blog-image {
    position: relative;
    overflow: hidden;
    height: 200px;
}
.blog-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* بزرگ شدن عکس کاملاً حذف شد */
    transition: none !important;
}
.blog-card:hover .blog-image img {
    transform: none !important;
}
.blog-card-content {
    padding: 22px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.blog-card h2 {
    margin: 0 0 12px;
    font-size: 1.35rem;
    line-height: 1.4;
    color: var(--accent-color);
    font-weight: 700;
}
.blog-card .excerpt {
    flex-grow: 1;
    margin: 0 0 16px;
    color: #666;
    font-size: 0.95rem;
    line-height: 1.7;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}
[data-theme="dark"] .blog-card .excerpt {
    color: #bbb;
}
.blog-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: #777;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
    margin-top: auto;
}
[data-theme="dark"] .blog-meta {
    color: #aaa;
}
.blog-meta span i {
    margin-left: 5px;
}

/* --- پیام وقتی پست نیست --- */
.no-posts {
    text-align: center;
    padding: 80px 20px;
    font-size: 1.3rem;
    color: #999;
    font-weight: 500;
}

/* --- صفحه‌بندی --- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 60px 0 20px;
    flex-wrap: wrap;
}
.page-btn {
    min-width: 44px;
    height: 44px;
    padding: 0 14px;
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}
.page-btn:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: translateY(-3px);
}
.page-btn.active {
    background: var(--accent-color);
    color: white;
    font-weight: 700;
    cursor: default;
    pointer-events: none;
}
.page-dots {
    color: #999;
    font-size: 1.3rem;
    padding: 0 5px;
}

/* --- ریسپانسیو --- */
@media screen and (max-width: 768px) {
    .content {
        padding: 30px 15px;
    }
    .content h1 {
        font-size: 1.8rem;
    }
    .blog-card h2 {
        font-size: 1.25rem;
    }
}
@media screen and (max-width: 480px) {
    .blog-grid {
        grid-template-columns: 1fr;
        padding: 0 10px;
    }
}

/* --- فوتر (کاملاً دست نخورده) --- */
footer {
    background: linear-gradient(180deg, var(--footer-bg-start), var(--footer-bg-end));
    color: var(--footer-text);
    padding: 40px 20px;
    text-align: center;
    font-size: 1rem;
    font-weight: 300;
    position: relative;
    overflow: hidden;
}
footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top center, rgba(0, 185, 185, 0.05), transparent);
    z-index: 0;
}
.footer-content {
    max-width: 1200px;
    margin: auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 20px;
    position: relative;
    z-index: 1;
}
.footer-section {
    flex: 1;
    min-width: 200px;
}
.footer-section h4 {
    color: #fff;
    margin-bottom: 15px;
    font-weight: 400;
    font-size: 1rem;
    position: relative;
}
.footer-section h4::after {
    content: '';
    display: block;
    width: 30px;
    height: 2px;
    background: var(--accent-color);
    margin-top: 5px;
}
.footer-section a {
    display: block;
    color: var(--footer-text);
    text-decoration: none;
    margin-bottom: 8px;
    font-size: 0.875rem;
    transition: color 0.3s ease, transform 0.3s ease;
}
.footer-section a:hover {
    color: var(--accent-color);
    transform: scale(1.06);
}
.social-icons {
    display: flex;
    justify-content: center;
    gap: 15px;
}
.social-icons a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-dark));
    color: #fff;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 185, 185, 0.3);
}
.social-icons a:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 185, 185, 0.4);
}
.social-icons img {
    width: 24px;
    height: 24px;
}
.footer-bottom {
    margin-top: 20px;
    border-top: 1px solid #333;
    padding-top: 20px;
    position: relative;
    z-index: 1;
}
@media screen and (max-width: 768px) {
    .social-icons {
        flex-wrap: nowrap;
    }
    footer {
        font-size: 0.9375rem;
    }
}

/* رنگ اصلی فیروزه‌ای برای لینک‌ها */
a {
    color: var(--accent-color);
    text-decoration: none;
}
a:hover {
    color: var(--accent-dark);
}

/* Dark mode adjustments */
[data-theme="dark"] .content p,
[data-theme="dark"] .blog-card p,
[data-theme="dark"] .blog-meta,
[data-theme="dark"] .no-posts {
    color: #bbb;
}
[data-theme="dark"] .content h1,
[data-theme="dark"] .blog-card h2 {
    color: #eee;
}

/* فونت ثابت در دسکتاپ */
@media screen and (min-width: 769px) {
    .content h1 {
        font-size: 2rem !important;
    }
    .content p,
    footer {
        font-size: 1rem !important;
    }
}