@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;
}

/* --- پست‌های وبلاگ --- */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.blog-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 8px var(--shadow-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    border-radius: 16px 16px 0 0;
}

.blog-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 16px rgba(0, 185, 185, 0.2);
}

.blog-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 16px 16px 0 0;
    transition: transform 0.3s ease;
}

.blog-card:hover img {
    transform: scale(1.05);
}

.blog-card-content {
    padding: 20px;
}

.blog-card h2 {
    font-size: 1.25rem;
    color: var(--accent-color);
    margin-bottom: 10px;
    font-weight: 600;
    text-decoration: none;
}

.blog-card p.excerpt {
    font-size: 0.9375rem;
    color: #555;
    line-height: 1.6;
    margin-bottom: 15px;
    font-weight: 300;
    text-decoration: none;
}

.blog-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: #777;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}

.blog-meta span i {
    margin-left: 5px;
}

.loader {
    text-align: center;
    padding: 20px;
    font-size: 1rem;
    color: #777;
    display: none;
}

.loader.active {
    display: block;
}

.no-posts {
    text-align: center;
    padding: 50px;
    font-size: 1.2rem;
    color: #555;
    font-weight: 400;
    display: none;
}

.no-posts.active {
    display: block;
}

@media screen and (max-width: 768px) {
    .content {
        padding: 30px 20px;
    }

    .content h1 {
        font-size: 1.75rem;
        margin: 5px 0 15px;
    }

    .blog-card img {
        height: 180px;
    }

    .blog-card h2 {
        font-size: 1.125rem;
    }

    .blog-card p.excerpt {
        font-size: 0.875rem;
    }

    .blog-meta {
        font-size: 0.8125rem;
    }

    .no-posts {
        font-size: 1rem;
        padding: 30px;
    }
}

/* --- فوتر --- */
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;
}

/* Ensure consistent font scaling in mobile desktop mode */
@media screen and (min-width: 769px) {
    .content h1 {
        font-size: 2rem !important;
    }

    .content p,
    footer {
        font-size: 1rem !important;
    }
}