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

body {
    font-family: 'Estedad', 'Vazirmatn', 'Inter', 'Segoe UI', Tahoma, sans-serif;
    background: #fafafa;
    color: #1a1a1a;
    line-height: 1.7;
    font-size: 16px;
    font-weight: 400;
}

body.dark-theme {
    background: #0a1628;
    color: #e0e0e0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

html {
    scroll-behavior: smooth;
}

.reading-progress {
    position: fixed;
    top: 0;
    right: 0;
    width: 0%;
    height: 3px;
    background: #8b5e3c;
    z-index: 10000;
}

.mag-header {
    background: white;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: all 0.3s ease;
}

body.dark-theme .mag-header {
    background: #0f1a2e;
    border-bottom-color: #1e2a3a;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    flex-wrap: wrap;
    gap: 15px;
    transition: all 0.3s ease;
}

.logo-link {
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
}

.signature-logo {
    font-family: 'Great Vibes', 'Playfair Display', 'Segoe Script', 'Brush Script MT', cursive;
    font-size: 2.5rem;
    font-weight: 400;
    color: #1a1a1a;
    transition: all 0.3s ease;
    display: inline-block;
    font-style: italic;
}

body.dark-theme .signature-logo {
    color: #ffd700;
}

.logo-link:hover .signature-logo {
    opacity: 0.85;
}

.theme-toggle {
    background: #f0f0f0;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    opacity: 1;
    pointer-events: auto;
}

body.dark-theme .theme-toggle {
    background: #1e2a3a;
    color: #ffd700;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(139,94,60,0.4);
}

body.dark-theme .theme-toggle:hover {
    box-shadow: 0 0 15px rgba(255,215,0,0.4);
}

.toggle-icon {
    font-size: 1.4rem;
    transition: all 0.3s ease;
}

.theme-toggle.animate .toggle-icon {
    animation: iconSpinFull 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes iconSpinFull {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.2); }
    100% { transform: rotate(360deg) scale(1); }
}

.mag-nav {
    display: flex;
    justify-content: center;
    gap: 30px;
    padding: 12px 0;
    border-top: 1px solid #e0e0e0;
    flex-wrap: wrap;
    transition: all 0.3s ease;
    opacity: 1;
    visibility: visible;
    height: auto;
}

body.dark-theme .mag-nav {
    border-top-color: #1e2a3a;
}

.nav-link {
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    color: #555;
    transition: all 0.3s ease;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
    position: relative;
}

body.dark-theme .nav-link {
    color: #b0c4de;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    right: 0;
    width: 0;
    height: 2px;
    background: #8b5e3c;
    transition: width 0.3s ease;
}

body.dark-theme .nav-link::after {
    background: #ffd700;
}

.nav-link:hover::after {
    width: 100%;
}

.nav-link:hover {
    color: #8b5e3c;
}

body.dark-theme .nav-link:hover {
    color: #ffd700;
}

.mag-header.scrolled {
    padding: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.mag-header.scrolled .header-top {
    justify-content: center;
    padding: 6px 0;
}

.mag-header.scrolled .logo-link {
    margin: 0 auto;
}

.mag-header.scrolled .signature-logo {
    font-size: 1.5rem;
}

.mag-header.scrolled .theme-toggle {
    display: none;
}

.mag-header.scrolled .mag-nav {
    opacity: 0;
    visibility: hidden;
    height: 0;
    padding: 0;
    margin: 0;
    border-top: none;
    overflow: hidden;
}

body.dark-theme .mag-header.scrolled {
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.floating-theme-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: #f0f0f0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.floating-theme-toggle:hover {
    transform: scale(1.1);
}

body.dark-theme .floating-theme-toggle {
    background: #1e2a3a;
    color: #ffd700;
}

.floating-theme-toggle .toggle-icon {
    font-size: 1.3rem;
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 40px;
    margin: 40px 0;
}

.about-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 40px;
    transition: all 0.3s ease;
}

body.dark-theme .about-card {
    background: #0f1a2e;
    border-color: #1e2a3a;
}

.about-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

body.dark-theme .about-card:hover {
    box-shadow: 0 8px 20px rgba(255,215,0,0.08);
}

.about-inner {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.about-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
}

.about-text h2 {
    font-size: 1.3rem;
    margin-bottom: 8px;
    font-weight: 700;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

.about-text p {
    font-size: 0.9rem;
    color: #666;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

body.dark-theme .about-text p {
    color: #b0c4de;
}

.about-quote {
    font-size: 0.85rem;
    font-style: italic;
    color: #8b5e3c;
    margin-top: 10px;
    padding-right: 12px;
    border-right: 3px solid #8b5e3c;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

.section-header {
    margin-bottom: 25px;
}

.section-header h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 8px;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

.header-line {
    width: 50px;
    height: 2px;
    background: #8b5e3c;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

.post-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

body.dark-theme .post-card {
    background: #0f1a2e;
    border-color: #1e2a3a;
}

.post-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255,255,255,0.1) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.post-card:hover::before {
    opacity: 1;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.1);
    border-color: #8b5e3c;
}

body.dark-theme .post-card:hover {
    box-shadow: 0 12px 24px rgba(255,215,0,0.1);
    border-color: #ffd700;
}

.card-image {
    width: 100%;
    height: 170px;
    object-fit: cover;
    transition: all 0.5s ease;
}

.post-card:hover .card-image {
    transform: scale(1.05);
}

.card-content {
    padding: 18px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.card-date {
    font-size: 0.75rem;
    color: #888;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

body.dark-theme .card-date {
    color: #8aaec0;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 8px 0;
    line-height: 1.45;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

.card-excerpt {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 16px;
    line-height: 1.6;
    flex: 1;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

body.dark-theme .card-excerpt {
    color: #b0c4de;
}

.card-btn-wrapper {
    margin-top: auto;
    padding-top: 8px;
}

.card-btn {
    background: none;
    border: none;
    color: #8b5e3c;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
    display: inline-block;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

body.dark-theme .card-btn {
    color: #ffd700;
}

.card-btn:hover {
    letter-spacing: 1px;
}

.sidebar {
    position: relative;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sidebar-widget {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    padding: 20px;
}

body.dark-theme .sidebar-widget {
    background: #0f1a2e;
    border-color: #1e2a3a;
}

.widget-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

body.dark-theme .widget-title {
    color: #ffd700;
}

.widget-title-line {
    width: 40px;
    height: 2px;
    background: #8b5e3c;
    margin-bottom: 15px;
}

.popular-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.popular-item {
    display: flex;
    gap: 10px;
    cursor: pointer;
    padding: 8px 8px;
    margin: 0 -8px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s ease;
    border-radius: 8px;
}

body.dark-theme .popular-item {
    border-bottom-color: #1e2a3a;
}

.popular-item:hover {
    background: rgba(139,94,60,0.1);
}

body.dark-theme .popular-item:hover {
    background: rgba(255,215,0,0.1);
}

.popular-number {
    font-size: 1rem;
    font-weight: 700;
    color: #8b5e3c;
    min-width: 28px;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

body.dark-theme .popular-number {
    color: #ffd700;
}

.popular-title {
    font-size: 0.85rem;
    line-height: 1.5;
    color: #555;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

body.dark-theme .popular-title {
    color: #b0c4de;
}

.ad-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none !important;
    padding: 0 !important;
    overflow: hidden;
    transition: all 0.3s ease;
    border-radius: 16px;
    display: block;
}

body.dark-theme .ad-box {
    background: linear-gradient(135deg, #1e3a5f 0%, #0f2a4a 100%);
}

.ad-content {
    padding: 25px 20px;
    text-align: center;
}

.ad-badge {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    color: white;
    margin-bottom: 15px;
    font-weight: 500;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

.ad-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.ad-title {
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

.ad-text {
    color: rgba(255,255,255,0.9);
    font-size: 0.8rem;
    margin-bottom: 15px;
    line-height: 1.5;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

.ad-btn {
    display: inline-block;
    background: white;
    color: #667eea;
    padding: 8px 20px;
    border-radius: 30px;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.3s ease;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
    position: relative;
    overflow: hidden;
}

body.dark-theme .ad-btn {
    background: #ffd700;
    color: #0f1a2e;
}

.ad-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ad-btn:hover::before {
    width: 300px;
    height: 300px;
}

.ad-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.resume-box {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s ease;
}

body.dark-theme .resume-box {
    background: #0f1a2e;
    border-color: #1e2a3a;
}

.resume-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.resume-icon {
    font-size: 1.5rem;
}

.resume-title {
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
    margin: 0;
    color: #1a1a1a;
}

body.dark-theme .resume-title {
    color: #ffd700;
}

.resume-line {
    width: 50px;
    height: 2px;
    background: #8b5e3c;
    margin-bottom: 18px;
}

.resume-projects {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
}

.project-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: #fafafa;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s ease;
}

body.dark-theme .project-item {
    background: #1a2a3a;
}

.project-item:hover {
    background: rgba(139,94,60,0.08);
}

body.dark-theme .project-item:hover {
    background: rgba(255,215,0,0.08);
}

.project-icon {
    font-size: 1.4rem;
    min-width: 36px;
    text-align: center;
}

.project-info {
    flex: 1;
}

.project-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 4px 0;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

body.dark-theme .project-name {
    color: #e0e0e0;
}

.project-desc {
    font-size: 0.7rem;
    color: #888;
    margin: 0;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

body.dark-theme .project-desc {
    color: #8aaec0;
}

.project-arrow {
    font-size: 1rem;
    color: #8b5e3c;
    transition: all 0.3s ease;
    opacity: 0;
}

.project-item:hover .project-arrow {
    opacity: 1;
}

body.dark-theme .project-arrow {
    color: #ffd700;
}

.resume-footer {
    text-align: center;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

body.dark-theme .resume-footer {
    border-top-color: #1e2a3a;
}

.github-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    color: #8b5e3c;
    transition: all 0.3s ease;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
    padding: 6px 12px;
    border-radius: 30px;
    background: rgba(139,94,60,0.1);
}

body.dark-theme .github-link {
    color: #ffd700;
    background: rgba(255,215,0,0.1);
}

.github-link:hover {
    background: #8b5e3c;
    color: white;
}

body.dark-theme .github-link:hover {
    background: #ffd700;
    color: #0f1a2e;
}

.projects-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 15px 0 10px;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
}

body.dark-theme .projects-pagination {
    border-top-color: #1e2a3a;
}

.projects-page-btn {
    background: none;
    border: 1px solid #e0e0e0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
    font-size: 0.75rem;
    transition: all 0.3s ease;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.dark-theme .projects-page-btn {
    border-color: #1e2a3a;
    color: #b0c4de;
}

.projects-page-btn:hover:not(:disabled) {
    background: #8b5e3c;
    border-color: #8b5e3c;
    color: white;
}

body.dark-theme .projects-page-btn:hover:not(:disabled) {
    background: #ffd700;
    border-color: #ffd700;
    color: #0f1a2e;
}

.projects-page-btn.active {
    background: #8b5e3c;
    border-color: #8b5e3c;
    color: white;
}

body.dark-theme .projects-page-btn.active {
    background: #ffd700;
    border-color: #ffd700;
    color: #0f1a2e;
}

.projects-page-nav {
    background: none;
    border: 1px solid #e0e0e0;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
    font-size: 0.7rem;
    transition: all 0.3s ease;
    color: #555;
}

body.dark-theme .projects-page-nav {
    border-color: #1e2a3a;
    color: #b0c4de;
}

.projects-page-nav:hover:not(:disabled) {
    background: #8b5e3c;
    border-color: #8b5e3c;
    color: white;
}

body.dark-theme .projects-page-nav:hover:not(:disabled) {
    background: #ffd700;
    border-color: #ffd700;
    color: #0f1a2e;
}

.projects-page-nav:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.mag-footer {
    background: white;
    border-top: 1px solid #e0e0e0;
    padding: 40px 0 20px;
    margin-top: 50px;
}

body.dark-theme .mag-footer {
    background: #0f1a2e;
    border-top-color: #1e2a3a;
}

.footer-grid {
    text-align: center;
    margin-bottom: 20px;
}

.footer-col h4 {
    font-size: 1rem;
    margin-bottom: 8px;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
    font-weight: 700;
}

body.dark-theme .footer-col h4 {
    color: #ffd700;
}

.footer-col p {
    font-size: 0.8rem;
    color: #888;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

body.dark-theme .footer-col p {
    color: #b0c4de;
}

.footer-email {
    direction: ltr;
    font-family: monospace;
}

.footer-col a {
    text-decoration: none;
    color: #888;
    transition: all 0.3s ease;
    position: relative;
}

.footer-col a:hover {
    color: #8b5e3c;
    padding-right: 5px;
}

body.dark-theme .footer-col a:hover {
    color: #ffd700;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    font-size: 0.75rem;
    color: #888;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

body.dark-theme .footer-bottom {
    border-top-color: #1e2a3a;
    color: #8aaec0;
}

.footer-heart span {
    color: #e25555;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.95);
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.modal-container {
    max-width: 100%;
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    background: white;
    border-radius: 0;
    overflow-y: auto;
    position: relative;
}

body.dark-theme .modal-container {
    background: #0a1628;
}

.modal-close {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 44px;
    height: 44px;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    font-size: 1.4rem;
    cursor: pointer;
    z-index: 10002;
    transition: all 0.3s ease;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    transform: scale(1.1);
    background: #8b5e3c;
    color: white;
}

body.dark-theme .modal-close {
    background: rgba(255,255,255,0.2);
    color: white;
}

body.dark-theme .modal-close:hover {
    background: #ffd700;
    color: #0a1628;
}

.modal-body {
    padding: 40px 20px 60px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.modal-header-article {
    margin-bottom: 30px;
}

.modal-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 15px;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

.modal-date {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 15px;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

body.dark-theme .modal-date {
    color: #8aaec0;
}

.modal-description {
    background: #f5f5f5;
    padding: 15px 20px;
    border-radius: 12px;
    margin: 20px 0;
    border-right: 3px solid #8b5e3c;
}

body.dark-theme .modal-description {
    background: #1a2a3a;
}

.modal-description p {
    margin: 0;
    font-size: 1rem;
    color: #555;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

body.dark-theme .modal-description p {
    color: #b0c4de;
}

.modal-text {
    color: #1a1a1a;
    font-size: 18px;
    line-height: 1.9;
}

body.dark-theme .modal-text {
    color: #e0e0e0;
}

.modal-text p {
    margin-bottom: 1.5em;
    font-size: 18px;
    line-height: 1.9;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

body.dark-theme .modal-text p {
    color: #e0e0e0;
}

.modal-text h1, 
.modal-text h2, 
.modal-text h3, 
.modal-text h4 {
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
    font-weight: 700;
    padding-right: 15px;
    margin: 1.2em 0 0.5em;
    border-right: 4px solid #8b5e3c;
}

body.dark-theme .modal-text h1,
body.dark-theme .modal-text h2,
body.dark-theme .modal-text h3,
body.dark-theme .modal-text h4 {
    border-right-color: #ffd700;
}

.modal-text h1 { font-size: 1.8rem; }
.modal-text h2 { font-size: 1.5rem; }
.modal-text h3 { font-size: 1.3rem; }
.modal-text h4 { font-size: 1.2rem; }

.modal-text strong,
.modal-text b {
    background: linear-gradient(120deg, rgba(255,235,59,0.4) 0%, rgba(255,235,59,0.2) 100%);
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: 700;
    color: inherit;
    display: inline-block;
}

body.dark-theme .modal-text strong,
body.dark-theme .modal-text b {
    background: linear-gradient(120deg, rgba(255,215,0,0.35) 0%, rgba(255,215,0,0.15) 100%);
    color: #ffd700;
}

.modal-text mark {
    padding: 2px 8px;
    border-radius: 8px;
    color: inherit;
    display: inline-block;
}

.modal-text .highlight-yellow,
.modal-text mark.highlight-yellow {
    background: linear-gradient(120deg, rgba(255,235,59,0.5) 0%, rgba(255,235,59,0.25) 100%);
}

.modal-text .highlight-blue,
.modal-text mark.highlight-blue {
    background: linear-gradient(120deg, rgba(78,205,196,0.4) 0%, rgba(78,205,196,0.2) 100%);
}

.modal-text .highlight-green,
.modal-text mark.highlight-green {
    background: linear-gradient(120deg, rgba(46,204,113,0.4) 0%, rgba(46,204,113,0.2) 100%);
}

.modal-text .highlight-pink,
.modal-text mark.highlight-pink {
    background: linear-gradient(120deg, rgba(232,67,147,0.35) 0%, rgba(232,67,147,0.15) 100%);
}

.modal-text .highlight-purple,
.modal-text mark.highlight-purple {
    background: linear-gradient(120deg, rgba(155,89,182,0.4) 0%, rgba(155,89,182,0.2) 100%);
}

.modal-text .highlight-orange,
.modal-text mark.highlight-orange {
    background: linear-gradient(120deg, rgba(243,156,18,0.45) 0%, rgba(243,156,18,0.2) 100%);
}

.modal-text .highlight-red,
.modal-text mark.highlight-red {
    background: linear-gradient(120deg, rgba(220,53,69,0.55) 0%, rgba(220,53,69,0.3) 100%);
}

body.dark-theme .modal-text .highlight-yellow,
body.dark-theme .modal-text mark.highlight-yellow {
    background: linear-gradient(120deg, rgba(255,215,0,0.4) 0%, rgba(255,215,0,0.2) 100%);
    color: #ffd700;
}

body.dark-theme .modal-text .highlight-blue,
body.dark-theme .modal-text mark.highlight-blue {
    background: linear-gradient(120deg, rgba(78,205,196,0.35) 0%, rgba(78,205,196,0.15) 100%);
    color: #4ecdc4;
}

body.dark-theme .modal-text .highlight-green,
body.dark-theme .modal-text mark.highlight-green {
    background: linear-gradient(120deg, rgba(46,204,113,0.35) 0%, rgba(46,204,113,0.15) 100%);
    color: #2ecc71;
}

body.dark-theme .modal-text .highlight-pink,
body.dark-theme .modal-text mark.highlight-pink {
    background: linear-gradient(120deg, rgba(232,67,147,0.3) 0%, rgba(232,67,147,0.15) 100%);
    color: #e84393;
}

body.dark-theme .modal-text .highlight-purple,
body.dark-theme .modal-text mark.highlight-purple {
    background: linear-gradient(120deg, rgba(155,89,182,0.35) 0%, rgba(155,89,182,0.15) 100%);
    color: #9b59b6;
}

body.dark-theme .modal-text .highlight-orange,
body.dark-theme .modal-text mark.highlight-orange {
    background: linear-gradient(120deg, rgba(243,156,18,0.35) 0%, rgba(243,156,18,0.15) 100%);
    color: #f39c12;
}

body.dark-theme .modal-text .highlight-red,
body.dark-theme .modal-text mark.highlight-red {
    background: linear-gradient(120deg, rgba(255,69,85,0.5) 0%, rgba(255,69,85,0.25) 100%);
    color: #ff8888;
}

.modal-text img {
    max-width: 100%;
    height: auto;
    margin: 20px 0;
    border-radius: 12px;
}

.modal-text blockquote {
    border-right: 3px solid #8b5e3c;
    margin: 20px 0;
    padding: 15px 20px;
    background: #f5f5f5;
    font-style: italic;
    border-radius: 12px;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

body.dark-theme .modal-text blockquote {
    background: #1a2a3a;
}

.modal-text code {
    background: #f0f0f0;
    padding: 3px 8px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.9em;
}

body.dark-theme .modal-text code {
    background: #1a2a3a;
    color: #ffd700;
}

.modal-text pre {
    background: #f0f0f0;
    padding: 15px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 20px 0;
}

body.dark-theme .modal-text pre {
    background: #1a2a3a;
}

.modal-text ul, 
.modal-text ol {
    margin: 1em 0;
    padding-right: 1.8em;
}

.modal-text li {
    margin: 0.5em 0;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

.modal-signature {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    text-align: left;
    font-style: italic;
    color: #8b5e3c;
    font-size: 0.9rem;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

body.dark-theme .modal-signature {
    border-top-color: #1e2a3a;
    color: #ffd700;
}

.loading-state {
    text-align: center;
    padding: 50px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e0e0e0;
    border-top-color: #8b5e3c;
    border-radius: 50%;
    margin: 0 auto 15px;
    animation: spin 0.8s linear infinite;
}

.loading-small {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 20px;
}

.loading-small span {
    width: 8px;
    height: 8px;
    background: #8b5e3c;
    border-radius: 50%;
    animation: pulse 1.2s infinite;
}

.loading-small span:nth-child(2) { animation-delay: 0.2s; }
.loading-small span:nth-child(3) { animation-delay: 0.4s; }

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

.empty-state, 
.error-state {
    text-align: center;
    padding: 50px;
    color: #888;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 50px auto 30px;
    flex-wrap: wrap;
}

.pagination-btn {
    background: white;
    border: 1px solid #e0e0e0;
    padding: 10px 28px;
    border-radius: 40px;
    cursor: pointer;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    color: #555;
    min-width: 110px;
}

body.dark-theme .pagination-btn {
    background: #0f1a2e;
    border-color: #1e2a3a;
    color: #b0c4de;
}

.pagination-btn:hover:not(:disabled) {
    background: #8b5e3c;
    border-color: #8b5e3c;
    color: white;
}

body.dark-theme .pagination-btn:hover:not(:disabled) {
    background: #ffd700;
    border-color: #ffd700;
    color: #0f1a2e;
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.pagination-pages {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-page {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid #e0e0e0;
    background: white;
    cursor: pointer;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.dark-theme .pagination-page {
    background: #0f1a2e;
    border-color: #1e2a3a;
    color: #b0c4de;
}

.pagination-page:hover {
    background: #f0f0f0;
    border-color: #8b5e3c;
}

body.dark-theme .pagination-page:hover {
    background: #1e2a3a;
    border-color: #ffd700;
}

.pagination-page.active {
    background: #8b5e3c;
    border-color: #8b5e3c;
    color: white;
}

body.dark-theme .pagination-page.active {
    background: #ffd700;
    border-color: #ffd700;
    color: #0f1a2e;
}

.pagination-info {
    text-align: center;
    font-size: 0.8rem;
    color: #888;
    margin-top: 20px;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

body.dark-theme .pagination-info {
    color: #8aaec0;
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header-top {
        flex-direction: row;
        justify-content: space-between;
        padding: 15px 0;
    }
    
    .signature-logo {
        font-size: 1.8rem;
    }
    
    .theme-toggle {
        width: 36px;
        height: 36px;
    }
    
    .toggle-icon {
        font-size: 1.1rem;
    }
    
    .mag-nav {
        gap: 20px;
        padding: 10px 0;
    }
    
    .nav-link {
        font-size: 0.75rem;
    }
    
    .mag-header.scrolled .signature-logo {
        font-size: 1rem;
    }
    
    .floating-theme-toggle {
        width: 42px;
        height: 42px;
        bottom: 15px;
        right: 15px;
    }
    
    .floating-theme-toggle .toggle-icon {
        font-size: 1.1rem;
    }
    
    .content-grid {
        grid-template-columns: 1fr;
        gap: 30px;
        margin: 30px 0;
    }
    
    .about-card {
        padding: 20px;
        margin-bottom: 30px;
    }
    
    .about-inner {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .about-avatar {
        width: 60px;
        height: 60px;
    }
    
    .about-text h2 {
        font-size: 1.2rem;
    }
    
    .about-text p {
        font-size: 0.85rem;
    }
    
    .about-quote {
        font-size: 0.8rem;
        text-align: center;
    }
    
    .section-header h2 {
        font-size: 1.3rem;
    }
    
    .posts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .card-image {
        height: 180px;
    }
    
    .card-content {
        padding: 15px;
    }
    
    .card-title {
        font-size: 1rem;
    }
    
    .card-excerpt {
        font-size: 0.8rem;
    }
    
    .sidebar {
        gap: 20px;
    }
    
    .sidebar-widget {
        padding: 15px;
    }
    
    .widget-title {
        font-size: 1rem;
    }
    
    .popular-number {
        font-size: 0.9rem;
        min-width: 25px;
    }
    
    .popular-title {
        font-size: 0.8rem;
    }
    
    .ad-content {
        padding: 20px;
    }
    
    .ad-icon {
        font-size: 2.5rem;
    }
    
    .ad-title {
        font-size: 1rem;
    }
    
    .ad-text {
        font-size: 0.75rem;
    }
    
    .resume-box {
        padding: 15px;
    }
    
    .resume-title {
        font-size: 1rem;
    }
    
    .project-item {
        padding: 8px 10px;
    }
    
    .project-icon {
        font-size: 1.2rem;
        min-width: 30px;
    }
    
    .project-name {
        font-size: 0.8rem;
    }
    
    .project-desc {
        font-size: 0.65rem;
    }
    
    .github-link {
        font-size: 0.7rem;
        padding: 4px 10px;
    }
    
    .projects-page-btn {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }
    
    .projects-page-nav {
        padding: 4px 8px;
        font-size: 0.65rem;
    }
    
    .pagination {
        gap: 12px;
        margin: 30px auto 20px;
    }
    
    .pagination-btn {
        padding: 8px 16px;
        font-size: 0.8rem;
        min-width: 80px;
    }
    
    .pagination-page {
        width: 36px;
        height: 36px;
        font-size: 0.8rem;
    }
    
    .pagination-info {
        font-size: 0.7rem;
        margin-top: 15px;
    }
    
    .modal-body {
        padding: 70px 20px 40px;
    }
    
    .modal-text {
        font-size: 16px;
    }
    
    .modal-text p {
        font-size: 16px;
    }
    
    .modal-title {
        font-size: 1.5rem;
    }
    
    .modal-close {
        top: 15px;
        left: 15px;
        width: 38px;
        height: 38px;
        font-size: 1.2rem;
    }
    
    .modal-text h1 { font-size: 1.5rem; }
    .modal-text h2 { font-size: 1.3rem; }
    .modal-text h3 { font-size: 1.2rem; }
    .modal-text h4 { font-size: 1.1rem; }
    
    .modal-text strong,
    .modal-text b {
        padding: 1px 4px;
    }
    
    .modal-text mark {
        padding: 1px 5px;
    }
    
    .footer-grid {
        margin-bottom: 15px;
    }
    
    .footer-col h4 {
        font-size: 0.9rem;
    }
    
    .footer-col p {
        font-size: 0.7rem;
    }
    
    .footer-bottom {
        font-size: 0.65rem;
        padding-top: 15px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }
    
    .signature-logo {
        font-size: 1.5rem;
    }
    
    .mag-nav {
        gap: 15px;
    }
    
    .nav-link {
        font-size: 0.7rem;
    }
    
    .mag-header.scrolled .signature-logo {
        font-size: 0.9rem;
    }
    
    .floating-theme-toggle {
        width: 38px;
        height: 38px;
        bottom: 12px;
        right: 12px;
    }
    
    .card-title {
        font-size: 0.9rem;
    }
    
    .card-excerpt {
        font-size: 0.75rem;
    }
    
    .card-btn {
        font-size: 0.7rem;
    }
    
    .widget-title {
        font-size: 0.9rem;
    }
    
    .popular-title {
        font-size: 0.75rem;
    }
    
    .project-name {
        font-size: 0.75rem;
    }
    
    .project-desc {
        font-size: 0.6rem;
    }
}