/* فونت سیستمی با پشتیبانی فارسی */
body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    background-color: #0a0a0a;
    color: #e0e0e0;
    direction: rtl;
    line-height: 1.6;
    margin: 0;
    padding: 10px;
}

.container {
    display: grid;
    grid-template-columns: 260px 0.75fr;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* نوار کناری */
.sidebar-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 260px;
    padding-top: 15px;
}

.sidebar {
    background-color: #1a1a1a;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #333;
    height: fit-content;
}

.sidebar-content {
    background-color: #1a1a1a;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #333;
    height: fit-content;
}

.sidebar h1 {
    color: #0088cc;
    font-size: 1.3rem;
    margin-bottom: 1.2rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid #333;
}

.search-form {
    display: flex;
    margin-bottom: 1.5rem;
    width: 100%;
    box-sizing: border-box;
}

.search-form input {
    flex: 1;
    padding: 8px 10px;
    font-family: inherit;
    font-size: 0.9rem;
    border: 1px solid #333;
    border-right: none;
    border-radius: 0 5px 5px 0;
    background-color: #121212;
    color: #e0e0e0;
    box-sizing: border-box;
}

.search-form button {
    width: 36px;
    background-color: #0088cc;
    color: white;
    border: 1px solid #333;
    border-left: none;
    border-radius: 5px 0 0 5px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.search-form button:hover {
    background-color: #0077bb;
}

.master-form {
    margin-bottom: 1.5rem;
    width: 100%;
    box-sizing: border-box;
}

.master-form input {
    flex: 1;
    padding: 8px 10px;
    font-family: inherit;
    font-size: 0.9rem;
    border: 1px solid #333;
    border-right: none;
    border-radius: 0 5px 5px 0;
    background-color: #121212;
    color: #e0e0e0;
    box-sizing: border-box;
}

.master-form button {
    width: 36px;
    background-color: #0088cc;
    color: white;
    border: 1px solid #333;
    border-left: none;
    border-radius: 5px 0 0 5px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.master-form button:hover {
    background-color: #0077bb;
}

.archive {
    margin-top: 1.5rem;
}

.archive strong {
    display: block;
    margin-bottom: 0.8rem;
    color: #aaa;
}

.archive a {
    display: block;
    padding: 6px 0;
    color: #0088cc;
    text-decoration: none;
    transition: color 0.2s;
}

.archive a:hover {
    color: #00aaff;
}

/* محتوای اصلی */
.main {
    background-color: transparent;
    padding: 15px;
    border: none;
    border-radius: 0;
}

.post {
    margin-bottom: 1.5rem;
    padding: 10px;
    border: 1px solid #333;
    border-radius: 10px;
    background-color: #1a1a1a;
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.post:last-child {
    margin-bottom: 0;
}

.media-container {
    margin-bottom: 1.2rem;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    background-color: transparent;
    border: none;
}

.media-container img {
    width: auto;
    max-width: 100%;
    max-height: 640px;
    height: auto;
    display: block;
    margin: 0 auto;
    cursor: pointer;
}

.media-container video {
    width: 100%;
    max-width: 640px;
    display: block;
    margin: 0 auto;
}

.media-container audio {
    width: 100%;
    max-width: 640px;
    padding: 10px;
    margin: 0 auto;
    display: block;
}

.media-type {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 3px 8px;
    border-radius: 15px;
    font-size: 11px;
}

.document-file {
    display: flex;
    align-items: center;
    padding: 10px;
    background-color: #121212;
    border-radius: 6px;
    border: 1px solid #333;
}

.document-icon {
    font-size: 20px;
    color: #0088cc;
    margin-left: 10px;
}

.document-info {
    flex: 1;
}

.document-name {
    font-weight: bold;
    margin-bottom: 4px;
    color: #e0e0e0;
}

.document-size {
    font-size: 12px;
    color: #aaa;
}

.download-btn {
    color: #e0e0e0;
}

.download-btn:hover {
    color: #0088cc;
}

.post-text {
    font-size: 1rem;
    margin-bottom: 1.2rem;
    white-space: pre-wrap;
    line-height: 1.6;
    color: #e0e0e0;
}

.post-text br {
    display: block;
    content: "";
    margin: 3px 0;
}

/* استایل برای کلمات کلیدی */
.post-keywords {
    font-size: 0.7rem;
    color: #aaa;
    margin-top: 0.5rem;
    line-height: 1.2;
}

/* استایل برای نقل قول ریپلای */
.replied-quote {
    margin-bottom: 1rem;
    padding: 10px;
    background-color: #121212;
    border-right: 4px solid #0088cc;
    color: #e0e0e0;
    border-radius: 4px;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.replied-quote a {
    color: #0088cc;
    text-decoration: none;
}

.replied-quote a:hover {
    color: #00aaff;
}

.reply-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 5px;
    order: 1;
}

.reply-text {
    order: 2;
    margin-bottom: 8px;
}

/* استایل برای پست‌های مرتبط */
.related-posts {
    margin-top: 2rem;
}

.related-posts h3 {
    font-size: 1.2rem;
    color: #0088cc;
    margin-bottom: 1rem;
}

.related-post {
    margin-bottom: 1rem;
    padding: 10px;
    border: 1px solid #333;
    border-radius: 10px;
    background-color: #1a1a1a;
}

.related-post .post-text {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.related-post .web-link {
    color: #0088cc;
    text-decoration: none;
}

.related-post .web-link:hover {
    color: #00aaff;
}

.post-meta {
    display: flex;
    gap: 15px;
    font-size: 0.8rem; /* اصلاح اندازه فونت */
    color: #aaa;
    flex-wrap: wrap;
}

.post-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.post-meta a {
    color: #0088cc;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
}

.post-meta i {
    font-size: 0.8rem; /* اصلاح اندازه آیکون‌ها */
}

.post-meta a:hover {
    color: #00aaff;
}

.pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.pagination a {
    padding: 6px 12px;
    background-color: #1a1a1a;
    color: #e0e0e0;
    border: 1px solid #333;
    border-radius: 5px;
    text-decoration: none;
    transition: background 0.2s;
}

.pagination a:hover {
    background-color: #0088cc;
    color: #ffffff;
}

.pagination .active {
    background-color: #0088cc;
    color: #ffffff;
}

.pagination .ellipsis {
    padding: 6px 12px;
    color: #aaa;
}

.pagination .page-nav {
    display: flex;
    align-items: center;
    gap: 5px;
}

.footer {
    text-align: center;
    margin-top: 2rem;
    padding: 1rem;
    color: #aaa;
    font-size: 0.9rem;
    border-top: 1px solid #333;
}

.footer p {
    margin: 0.3rem 0;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 5px;
}

.modal .close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 24px;
    color: white;
    cursor: pointer;
}

.back-to-home {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #0088cc;
    text-decoration: none;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.back-to-home:hover {
    color: #00aaff;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-section {
    margin-bottom: 1.5rem;
}

.admin-section h3 {
    font-size: 1rem;
    color: #aaa;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: #e0e0e0;
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.2s;
}

.admin-nav a:hover,
.admin-nav a.active {
    background-color: #0088cc;
    color: #ffffff;
}

.logout-btn {
    background-color: #d32f2f;
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 5px;
    text-align: center;
}

.logout-btn:hover {
    background-color: #b71c1c;
}

.post-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.edit-btn, .delete-btn {
    padding: 6px 12px;
    border-radius: 5px;
    border: 1px solid #333;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s;
}

.edit-btn {
    background-color: #1976d2;
    color: #ffffff;
}

.edit-btn:hover {
    background-color: #1565c0;
}

.delete-btn {
    background-color: #d32f2f;
    color: #ffffff;
}

.delete-btn:hover {
    background-color: #b71c1c;
}

.edit-form {
    display: none;
    margin-top: 10px;
    padding: 10px;
    background-color: #121212;
    border: 1px solid #333;
    border-radius: 5px;
}

.edit-form textarea {
    width: 100%;
    min-height: 100px;
    padding: 8px;
    border: 1px solid #333;
    border-radius: 5px;
    background-color: #1a1a1a;
    color: #e0e0e0;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
}

.edit-form button {
    margin-top: 10px;
    padding: 6px 12px;
    border-radius: 5px;
    border: 1px solid #333;
    cursor: pointer;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.edit-form button[type="submit"] {
    background-color: #1976d2;
    color: #ffffff;
}

.edit-form button[type="submit"]:hover {
    background-color: #1565c0;
}

.edit-form button[type="button"] {
    background-color: #777;
    color: #ffffff;
}

.edit-form button[type="button"]:hover {
    background-color: #555;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 500px;
    margin-top: 1rem;
}

.settings-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-form label {
    font-size: 0.9rem;
    color: #aaa;
}

.settings-form input {
    padding: 8px;
    border: 1px solid #333;
    border-radius: 5px;
    background-color: #1a1a1a;
    color: #e0e0e0;
    font-family: inherit;
    font-size: 0.9rem;
}

.settings-form button {
    padding: 8px 12px;
    border-radius: 5px;
    border: 1px solid #333;
    background-color: #1976d2;
    color: #ffffff;
    cursor: pointer;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.settings-form button:hover {
    background-color: #1565c0;
}

.stats-container {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.stat-card {
    background-color: #1a1a1a;
    padding: 15px;
    border: 1px solid #333;
    border-radius: 10px;
    text-align: center;
    flex: 1;
    min-width: 150px;
}

.stat-icon {
    font-size: 1.5rem;
    color: #0088cc;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #e0e0e0;
}

.stat-label {
    font-size: 0.9rem;
    color: #aaa;
}

.chart-container {
    max-width: 500px;
    margin: 1rem auto;
}

.login-form {
    max-width: 400px;
    margin: 50px auto;
    padding: 20px;
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 10px;
    text-align: center;
}

.login-form h2 {
    color: #0088cc;
    margin-bottom: 1.5rem;
}

.login-form input {
    width: 100%;
    padding: 8px;
    margin-bottom: 1rem;
    border: 1px solid #333;
    border-radius: 5px;
    background-color: #121212;
    color: #e0e0e0;
    font-family: inherit;
    font-size: 0.9rem;
}

.login-form button {
    width: 100%;
    padding: 8px;
    background-color: #1976d2;
    color: #ffffff;
    border: 1px solid #333;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.login-form button:hover {
    background-color: #1565c0;
}

/* واکنشگرایی */
@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .sidebar-container {
        width: 100%;
        max-width: calc(100% - 20px);
        margin: 0 auto;
    }

    .sidebar {
        width: 100%;
        max-width: calc(100% - 20px);
        margin: 0 auto;
        padding: 10px;
    }

    .main {
        padding: 10px;
        width: 100%;
        max-width: calc(100% - 20px);
        margin: 0 auto;
    }

    .post {
        margin-bottom: 1rem;
        max-width: calc(100% - 20px);
        margin-right: auto;
        margin-left: auto;
    }

    .media-container img,
    .media-container video,
    .media-container audio {
        max-width: 100%;
    }

    .pagination a {
        padding: 5px 8px;
        font-size: 0.8rem;
    }

    .modal img {
        max-width: 95%;
        max-height: 80%;
    }

    .post-meta {
        flex-wrap: nowrap;
        justify-content: flex-start;
    }

    .replied-quote {
        border-right: 4px solid #0088cc;
        border-left: none;
        padding: 6px;
    }
}