@font-face {
    font-family: 'iran';
    src: url('IRANYekanWebMedium.woff');
}
* {
    box-sizing: border-box;
    font-family: 'iran';
}

body {
    margin: 0;
    background: #f5f7fb;
    color: #20252d;
    font-family: Tahoma, Arial, sans-serif;
    line-height: 1.9
}

.container {
    width: min(1150px, 92%);
    margin: auto
}

.site-header {
    background: #111827;
    color: #fff;
    box-shadow: 0 2px 12px #0001
}

.nav {
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between
}

.logo {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    text-decoration: none
}

.nav nav {
    display: flex;
    gap: 8px
}

.nav nav a {
    color: #dbe3ef;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 8px
}

.nav nav a:hover,
.nav nav a.active {
    background: #263246;
    color: #fff
}

.page {
    padding: 35px 0
}

.content-card,
.admin-card {
    background: #fff;
    border: 1px solid #e5e9f0;
    border-radius: 14px;
    padding: 28px;
    box-shadow: 0 8px 30px #1d29390a
}

.content-card h1,
.admin-card h1 {
    margin-top: 0
}

.rich-content img {
    max-width: 100%;
    height: auto;
    border-radius: 10px
}

.rich-content a {
    color: #2563eb
}

.category-layout {
    display: grid;
    grid-template-columns: 270px 1fr;
    gap: 22px
}

.sidebar {
    height: max-content
}

.category-link {
    display: block;
    text-decoration: none;
    color: #374151;
    padding: 10px 12px;
    border-radius: 8px;
    margin: 5px 0
}

.category-link:hover,
.category-link.selected {
    background: #eef2ff;
    color: #4338ca
}

.category-section {
    padding: 10px 0 25px;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee
}

.category-section:last-child {
    border-bottom: 0
}

.muted {
    color: #6b7280
}

.admin-page {
    padding: 30px 0 70px
}

.admin-card {
    margin-bottom: 25px
}

.admin-card h2 {
    margin-top: 0
}

.admin-card label {
    display: block;
    margin: 12px 0 5px;
    font-weight: 700
}

.input {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid #d6dce5;
    border-radius: 8px;
    font: inherit;
    background: #fff
}

.input.small {
    width: 110px
}

.btn {
    border: 0;
    border-radius: 8px;
    padding: 10px 15px;
    font: inherit;
    cursor: pointer;
    background: #e8edf5;
    color: #1f2937;
    text-decoration: none;
    display: inline-block
}

.btn.primary {
    background: #2563eb;
    color: white
}

.btn.secondary {
    background: #eef2ff;
    color: #3730a3
}

.btn.danger {
    background: #fee2e2;
    color: #b91c1c
}

.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 12px 0
}

.inline-form.grow {
    flex: 1
}

.category-row {
    display: flex;
    gap: 8px;
    align-items: center;
    border-top: 1px solid #eee;
    padding: 12px 0
}

.category-row:first-child {
    border-top: 0
}

.category-admin-list {
    margin-top: 15px
}

.editor {
    border: 1px solid #d6dce5;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    margin-bottom: 15px
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 8px;
    background: #f1f4f8;
    border-bottom: 1px solid #dfe4eb
}

.toolbar button,
.upload-btn {
    border: 1px solid #d1d7e0;
    background: #fff;
    border-radius: 6px;
    padding: 6px 9px;
    cursor: pointer;
    font: inherit
}

.toolbar button:hover,
.upload-btn:hover {
    background: #eef2ff
}

.upload-btn input {
    display: none
}

.editor-body {
    min-height: 220px;
    padding: 16px;
    outline: none;
    font-size: 15px;
    line-height: 1.9;
    color: #1f2937;
    text-align: right;
    direction: rtl;
}

.editor-body:focus {
    box-shadow: inset 0 0 0 2px #93c5fd
}

.editor-body p,
.editor-body ul,
.editor-body ol,
.editor-body h2,
.editor-body h3,
.editor-body blockquote,
.editor-body pre {
    margin: 0 0 16px;
    line-height: 1.9;
}

.editor-body h2,
.editor-body h3 {
    color: #111827;
    font-weight: 700;
}

.editor-body ul,
.editor-body ol {
    padding-right: 24px;
}

.editor-body a {
    color: #2563eb;
    text-decoration: underline;
}

.editor-body img {
    display: block;
    max-width: min(100%, 680px);
    width: 100%;
    height: auto;
    margin: 18px auto;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .08)
}

.alert {
    padding: 12px 15px;
    border-radius: 9px;
    margin-bottom: 18px
}

.alert.success {
    background: #dcfce7;
    color: #166534
}

.alert.error {
    background: #fee2e2;
    color: #991b1b
}

.section-editor {
    border: 1px solid #e5e7eb;
    padding: 18px;
    border-radius: 12px;
    margin-bottom: 18px
}

.section-head {
    display: flex;
    gap: 8px;
    margin-bottom: 10px
}

.section-actions {
    display: flex;
    gap: 8px
}

.section-editor hr,
hr {
    border: 0;
    border-top: 1px solid #eee;
    margin: 25px 0
}

@media(max-width:760px) {
    .category-layout {
        grid-template-columns: 1fr
    }

    .nav {
        height: auto;
        padding: 12px 0;
        align-items: flex-start;
        gap: 8px;
        flex-direction: column
    }

    .nav nav {
        width: 100%;
        overflow: auto
    }

    .inline-form,
    .category-row,
    .section-head {
        flex-wrap: wrap
    }

    .input.small {
        width: 100%
    }

    .content-card,
    .admin-card {
        padding: 18px
    }

    .toolbar {
        gap: 3px
    }

    .toolbar button,
    .upload-btn {
        padding: 5px 7px;
        font-size: 12px
    }
}