.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    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: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(35px) saturate(1.8);
    -webkit-backdrop-filter: blur(35px) saturate(1.8);
    border-radius: 0;
    overflow-y: auto;
    position: relative;
    animation: modalFadeIn 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.modal-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.30) 0%,
        rgba(255, 255, 255, 0.08) 50%,
        rgba(255, 255, 255, 0.15) 100%
    );
    pointer-events: none;
    z-index: 0;
}

.modal-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(
        ellipse at 30% 20%,
        rgba(255, 255, 255, 0.15) 0%,
        transparent 70%
    );
    pointer-events: none;
    z-index: 0;
}

body.dark-theme .modal-container {
    background: rgba(15, 26, 46, 0.65);
    backdrop-filter: blur(35px) saturate(1.5);
    -webkit-backdrop-filter: blur(35px) saturate(1.5);
}

body.dark-theme .modal-container::before {
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 215, 0, 0.02) 40%,
        rgba(255, 255, 255, 0.02) 100%
    );
}

body.dark-theme .modal-container::after {
    background: radial-gradient(
        ellipse at 30% 20%,
        rgba(255, 215, 0, 0.04) 0%,
        transparent 70%
    );
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-close {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 44px;
    height: 44px;
    background: transparent !important;
    border: none !important;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10002;
    transition: color 0.3s ease;
    color: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
    padding: 0;
}

body.dark-theme .modal-close {
    color: rgba(255, 255, 255, 0.4);
}

.modal-close:hover {
    color: #8b5e3c !important;
    background: transparent !important;
    border: none !important;
    transform: none !important;
    box-shadow: none !important;
}

body.dark-theme .modal-close:hover {
    color: #ffd700 !important;
    background: transparent !important;
    border: none !important;
    transform: none !important;
    box-shadow: none !important;
}

.modal-close,
.modal-close *,
.modal-close:hover,
.modal-close:hover *,
.modal-close:active,
.modal-close:active *,
.modal-close:focus,
.modal-close:focus * {
    transform: none !important;
    scale: none !important;
    animation: none !important;
    transition: color 0.3s ease !important;
}

.modal-close i {
    width: 28px;
    height: 28px;
    transition: color 0.3s ease;
}

.modal-body {
    padding: 80px 20px 60px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    position: relative;
    z-index: 1;
}

.modal-article {
    direction: rtl;
}

.modal-header-article {
    margin-bottom: 30px;
}

.modal-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 15px;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
    color: #1a1a1a;
    line-height: 1.4;
}

body.dark-theme .modal-title {
    color: #e8e8e8;
}

.modal-date {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

body.dark-theme .modal-date {
    color: #8a9aaa;
}

.modal-date i {
    width: 16px;
    height: 16px;
}

.modal-description {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 15px 20px;
    border-radius: 12px;
    margin: 20px 0;
    border-right: 3px solid #8b5e3c;
}

body.dark-theme .modal-description {
    background: rgba(255, 255, 255, 0.04);
    border-right-color: #d4a84a;
}

.modal-description p {
    margin: 0;
    font-size: 1rem;
    color: #444;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

body.dark-theme .modal-description p {
    color: #b0b8c8;
}

.modal-text {
    color: #1a1a1a;
    font-size: 18px;
    line-height: 1.9;
}

body.dark-theme .modal-text {
    color: #e8e8e8;
}

.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: #e8e8e8;
}

.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: #d4a84a;
}

.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(139, 94, 60, 0.10) 0%, rgba(139, 94, 60, 0.04) 100%);
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: 700;
    color: #6b3e2c;
    display: inline-block;
}

body.dark-theme .modal-text strong,
body.dark-theme .modal-text b {
    background: linear-gradient(120deg, rgba(255, 215, 0, 0.10) 0%, rgba(255, 215, 0, 0.04) 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(139, 94, 60, 0.10) 0%, rgba(139, 94, 60, 0.04) 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.10) 0%, rgba(255, 215, 0, 0.04) 100%);
}

.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: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-style: italic;
    border-radius: 12px;
    font-family: 'Estedad', 'Vazirmatn', sans-serif;
}

body.dark-theme .modal-text blockquote {
    background: rgba(255, 255, 255, 0.03);
    border-right-color: #d4a84a;
}

.modal-text code {
    background: rgba(0, 0, 0, 0.04);
    padding: 3px 8px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.9em;
}

body.dark-theme .modal-text code {
    background: rgba(255, 255, 255, 0.06);
    color: #ffd700;
}

.modal-text pre {
    background: rgba(0, 0, 0, 0.04);
    padding: 15px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 20px 0;
}

body.dark-theme .modal-text pre {
    background: rgba(255, 255, 255, 0.04);
}

.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 rgba(0, 0, 0, 0.06);
    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: rgba(255, 255, 255, 0.06);
    color: #d4a84a;
}


@media (max-width: 768px) {
    .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;
    }

    .modal-close i {
        width: 22px;
        height: 22px;
    }

    .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;
    }

    .post-stats {
        padding: 6px 16px;
        gap: 8px;
    }

    .stat-text {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .modal-body {
        padding: 60px 15px 30px;
    }

    .modal-close {
        top: 12px;
        left: 12px;
        width: 34px;
        height: 34px;
    }

    .modal-close i {
        width: 20px;
        height: 20px;
    }

    .modal-title {
        font-size: 1.3rem;
    }

    .modal-text {
        font-size: 15px;
    }

    .modal-text p {
        font-size: 15px;
    }
}