.note-editor-page {
    min-height: calc(100vh - 76px);
    padding: 48px 20px 90px;
    background:
        radial-gradient(
            circle at 90% 0,
            rgba(79, 103, 224, 0.12),
            transparent 30%
        ),
        linear-gradient(180deg, #f8f9fd 0%, #f3f5fa 100%);
}

.note-editor-container {
    width: min(100%, 1180px);
    margin-inline: auto;
}

.note-editor-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.note-editor-badge {
    display: inline-flex;
    align-items: center;
    margin-bottom: 8px;
    padding: 5px 11px;
    color: #4666e5;
    background: #edf1ff;
    border-radius: 50px;
    font-size: 0.76rem;
    font-weight: 800;
}

.note-editor-header h1 {
    margin: 0 0 7px;
    color: #111c3a;
    font-size: clamp(1.75rem, 4vw, 2.45rem);
    line-height: 1.45;
}

.note-editor-header p {
    margin: 0;
    color: #737c92;
    font-size: 0.9rem;
    line-height: 1.9;
}

.back-link {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 8px 16px;
    color: #5d6579;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #dfe3ed;
    border-radius: 11px;
    font-size: 0.82rem;
    font-weight: 750;
    text-decoration: none;
    transition:
        color 0.2s,
        background 0.2s,
        border-color 0.2s;
}

.back-link:hover {
    color: #4666e5;
    background: #ffffff;
    border-color: #cbd4fa;
}

.note-editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: start;
    gap: 24px;
}

.editor-main-column,
.editor-sidebar {
    min-width: 0;
}

.editor-sidebar {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.editor-card,
.sidebar-card {
    background: #ffffff;
    border: 1px solid #e6e9f1;
    box-shadow: 0 13px 35px rgba(28, 41, 76, 0.06);
}

.editor-card {
    padding: 30px;
    border-radius: 20px;
}

.sidebar-card {
    padding: 22px;
    border-radius: 17px;
}

.card-heading {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid #edf0f5;
}

.card-heading-icon {
    display: grid;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    color: #ffffff;
    background: linear-gradient(135deg, #4666e5, #7755dc);
    border-radius: 12px;
    place-items: center;
    font-size: 1.1rem;
    font-weight: 800;
    box-shadow: 0 8px 18px rgba(70, 102, 229, 0.22);
}

.card-heading h2,
.sidebar-card-heading h2 {
    margin: 0 0 4px;
    color: #17213c;
    font-size: 0.98rem;
    font-weight: 850;
}

.card-heading p,
.sidebar-card-heading p {
    margin: 0;
    color: #8990a1;
    font-size: 0.76rem;
    line-height: 1.8;
}

.sidebar-card-heading {
    margin-bottom: 21px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #232d47;
    font-size: 0.84rem;
    font-weight: 800;
}

.required-mark {
    margin-right: 3px;
    color: #d83a54;
}

.form-control {
    box-sizing: border-box;
    width: 100%;
    padding: 12px 14px;
    color: #17213c;
    background: #fbfcfe;
    border: 1px solid #dfe3ed;
    border-radius: 11px;
    outline: none;
    font-family: inherit;
    font-size: 0.87rem;
    line-height: 1.8;
    transition:
        background 0.2s,
        border-color 0.2s,
        box-shadow 0.2s;
}

.form-control::placeholder {
    color: #a3aaba;
}

.form-control:hover {
    border-color: #cbd1de;
}

.form-control:focus {
    background: #ffffff;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(70, 102, 229, 0.1);
}

.form-select {
    min-height: 49px;
    cursor: pointer;
}

.field-details,
.description-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-top: 7px;
}

.form-help,
.title-counter,
.description-footer small {
    color: #858d9f;
    font-size: 0.72rem;
    line-height: 1.7;
}

.editor-placeholder-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 47px;
    padding: 7px 12px;
    background: #f7f8fc;
    border: 1px solid #dfe3ed;
    border-bottom: 0;
    border-radius: 11px 11px 0 0;
}

.toolbar-text {
    display: flex;
    align-items: center;
    gap: 14px;
    color: #60697e;
    font-size: 0.8rem;
}

.toolbar-separator {
    width: 1px;
    height: 20px;
    background: #d9deea;
}

.toolbar-status {
    color: #8b92a3;
    font-size: 0.68rem;
}

.content-form-group textarea.form-control {
    display: block;
    min-height: 405px;
    padding: 17px;
    background: #ffffff;
    border-radius: 0 0 11px 11px;
    resize: vertical;
}

.content-form-group textarea.form-control:focus {
    position: relative;
    border-color: #667eea;
}

.form-error {
    margin: 7px 0 0;
    color: #c82f47;
    font-size: 0.75rem;
    font-weight: 750;
    line-height: 1.7;
}

.form-alert {
    margin-bottom: 22px;
    padding: 13px 16px;
    border-radius: 11px;
    font-size: 0.82rem;
}

.form-alert p {
    margin: 0;
}

.form-alert-error {
    color: #a8233a;
    background: #fff0f3;
    border: 1px solid #ffd3dc;
}

.photo-form-group {
    margin-bottom: 0;
}

.upload-area {
    display: flex !important;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    min-height: 145px;
    margin: 0 !important;
    padding: 18px;
    color: #6f778b !important;
    background: #fafbfe;
    border: 1.5px dashed #ccd3e2;
    border-radius: 13px;
    text-align: center;
    cursor: pointer;
    transition:
        background 0.2s,
        border-color 0.2s,
        transform 0.2s;
}

.upload-area:hover {
    background: #f5f7ff;
    border-color: #768be7;
    transform: translateY(-1px);
}

.upload-icon {
    display: grid;
    width: 37px;
    height: 37px;
    margin-bottom: 9px;
    color: #4666e5;
    background: #eaf0ff;
    border-radius: 10px;
    place-items: center;
    font-size: 1.1rem;
}

.upload-area strong {
    margin-bottom: 4px;
    color: #3d4a68;
    font-size: 0.81rem;
}

.upload-area > span:last-child {
    color: #969dad;
    font-size: 0.68rem;
    font-weight: 500;
    line-height: 1.7;
}

.native-file-input {
    margin-top: 11px;
}

.native-file-input .form-control {
    padding: 7px;
    font-size: 0.72rem;
}

.native-file-input .form-file::file-selector-button {
    margin-left: 9px;
    padding: 7px 11px;
    color: #4666e5;
    background: #edf1ff;
    border: 0;
    border-radius: 7px;
    font-family: inherit;
    font-weight: 750;
    cursor: pointer;
}

.action-card {
    display: grid;
    gap: 10px;
}

.button-primary,
.button-secondary {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 46px;
    padding: 10px 18px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.83rem;
    font-weight: 800;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition:
        transform 0.2s,
        background 0.2s,
        border-color 0.2s,
        box-shadow 0.2s;
}

.button-primary {
    color: #ffffff;
    background: linear-gradient(135deg, #4666e5, #7455dc);
    border: 0;
    box-shadow: 0 9px 20px rgba(70, 102, 229, 0.23);
}

.button-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(70, 102, 229, 0.3);
}

.button-secondary {
    color: #60687c;
    background: #ffffff;
    border: 1px solid #dfe3ed;
}

.button-secondary:hover {
    color: #4666e5;
    background: #f6f8ff;
    border-color: #cbd4fa;
}

@media (max-width: 920px) {
    .note-editor-layout {
        grid-template-columns: 1fr;
    }

    .editor-sidebar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .action-card {
        grid-column: 1 / -1;
    }
}

@media (max-width: 650px) {
    .note-editor-page {
        padding: 35px 13px 65px;
    }

    .note-editor-header {
        align-items: stretch;
        flex-direction: column;
        margin-bottom: 22px;
    }

    .back-link {
        align-self: flex-start;
    }

    .editor-card {
        padding: 22px 16px;
        border-radius: 16px;
    }

    .sidebar-card {
        padding: 19px 16px;
    }

    .editor-sidebar {
        display: flex;
    }

    .content-form-group textarea.form-control {
        min-height: 320px;
    }

    .toolbar-status {
        display: none;
    }

    .field-details,
    .description-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
    }
}
/* Notes list */
.note-list-page {
    --notes-primary: #4b5fe8;
    --notes-primary-dark: #3547c9;
    --notes-ink: #111b3a;
    --notes-muted: #707990;
    --notes-border: #e1e5ef;
    min-height: calc(100vh - 76px);
    color: var(--notes-ink);
    background:
        radial-gradient(circle at 12% 7%, rgba(85, 99, 232, 0.12), transparent 25rem),
        linear-gradient(180deg, #fbfcff 0%, #f6f8fc 100%);
}

.notes-container {
    width: min(1200px, calc(100% - 40px));
    margin-inline: auto;
}

.notes-intro {
    padding: 52px 0 34px;
}

.notes-intro__inner {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 30px;
}

.notes-intro__badge {
    display: inline-flex;
    padding: 4px 12px;
    color: #fff;
    background: linear-gradient(135deg, #6575ed, #6b4de0);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.notes-intro h1 {
    margin: 8px 0 3px;
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    line-height: 1.35;
    letter-spacing: -1.5px;
}

.notes-intro p {
    margin: 0;
    color: var(--notes-muted);
    font-size: 0.95rem;
}

.notes-create-button {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 9px 22px;
    color: #fff;
    background: linear-gradient(135deg, #5369ec, #3e50dc);
    border-radius: 11px;
    box-shadow: 0 10px 25px rgba(62, 80, 220, 0.22);
    font-size: 0.87rem;
    font-weight: 700;
    transition: transform 0.2s, box-shadow 0.2s;
}

.notes-create-button:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(62, 80, 220, 0.3); }
.notes-create-button:focus-visible,
.notes-toolbar input:focus-visible,
.notes-toolbar select:focus-visible,
.notes-filter-button:focus-visible,
.notes-results-summary a:focus-visible,
.notes-pagination a:focus-visible,
.notes-empty a:focus-visible { outline: 3px solid rgba(75, 95, 232, 0.3); outline-offset: 3px; }

.notes-section { padding: 0 0 80px; }

.notes-toolbar {
    display: grid;
    grid-template-columns: minmax(210px, 0.85fr) minmax(280px, 1.4fr) minmax(210px, 0.9fr) auto;
    align-items: center;
    gap: 18px;
    margin-bottom: 20px;
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--notes-border);
    border-radius: 10px;
    box-shadow: 0 7px 20px rgba(25, 36, 75, 0.07);
}

.notes-count { display: flex; align-items: center; gap: 7px; margin: 0; color: #485167; font-size: 0.82rem; }
.notes-count__icon { color: var(--notes-primary); font-size: 1.3rem; }
.notes-search-field,
.notes-filter-field { position: relative; }
.notes-search-field input,
.notes-filter-field select {
    width: 100%;
    height: 43px;
    padding: 8px 42px 8px 14px;
    color: #29334e;
    background: #fff;
    border: 1px solid #d9deea;
    border-radius: 8px;
    font: inherit;
    font-size: 0.8rem;
}
.notes-search-field input::placeholder { color: #9299ab; }
.notes-search-field > span { position: absolute; top: 8px; right: 14px; color: #65708a; font-size: 1.25rem; line-height: 1; }
.notes-filter-field select { padding-right: 14px; cursor: pointer; }
.notes-filter-button {
    min-height: 41px;
    padding: 7px 16px;
    color: #fff;
    background: var(--notes-primary);
    border: 0;
    border-radius: 8px;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}
.notes-filter-button:hover { background: var(--notes-primary-dark); }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.notes-results-summary { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 20px; padding: 10px 15px; color: #555f78; background: #eef1ff; border: 1px solid #dbe0ff; border-radius: 9px; font-size: 0.8rem; }
.notes-results-summary a { color: #3045cb; font-weight: 700; }

.notes-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.note-card { overflow: hidden; background: #fff; border: 1px solid var(--notes-border); border-radius: 11px; box-shadow: 0 5px 18px rgba(26, 37, 75, 0.06); transition: transform 0.22s, box-shadow 0.22s; }
.note-card:hover { transform: translateY(-4px); box-shadow: 0 13px 30px rgba(26, 37, 75, 0.12); }
.note-image { position: relative; aspect-ratio: 16 / 6.5; margin: 8px 8px 0; overflow: hidden; background: #edf0fb; border-radius: 8px; }
.note-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.note-image-placeholder { display: flex; height: 100%; align-items: center; justify-content: center; flex-direction: column; gap: 4px; color: #6370ba; background: radial-gradient(circle at 15% 85%, rgba(107, 88, 224, 0.14), transparent 25%), linear-gradient(135deg, #f4f5ff, #e8ebfc); font-size: 0.7rem; font-weight: 700; }
.placeholder-mark { display: grid; width: 45px; height: 45px; place-items: center; color: #fff; background: linear-gradient(145deg, #5369ec, #7655dd); border-radius: 15px 15px 15px 5px; font-size: 1.35rem; }
.note-category { position: absolute; right: 0; bottom: 0; padding: 3px 10px; color: #4053da; background: rgba(247, 248, 255, 0.95); border-radius: 8px 0 0 0; font-size: 0.68rem; font-weight: 700; }
.note-content { padding: 13px 16px 12px; }
.note-title { min-height: 54px; margin: 0 0 3px; color: var(--notes-ink); font-size: 0.99rem; line-height: 1.75; }
.note-description { min-height: 49px; margin: 0 0 12px; color: var(--notes-muted); font-size: 0.76rem; line-height: 1.85; }
.note-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; color: #7d8598; border-top: 1px solid #edf0f5; font-size: 0.68rem; }
.note-author { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-footer time { flex-shrink: 0; direction: ltr; }

.notes-empty { grid-column: 1 / -1; padding: 65px 20px; text-align: center; background: #fff; border: 1px dashed #cdd3e3; border-radius: 14px; }
.notes-empty__icon { display: grid; width: 65px; height: 65px; margin: 0 auto 14px; place-items: center; color: #fff; background: linear-gradient(145deg, #6076ed, #7354dc); border-radius: 20px; font-size: 1.7rem; }
.notes-empty h2 { margin: 0 0 4px; font-size: 1.15rem; }
.notes-empty p { margin: 0 0 15px; color: var(--notes-muted); font-size: 0.85rem; }
.notes-empty a { display: inline-flex; padding: 6px 15px; color: var(--notes-primary-dark); border: 1px solid #ccd4ff; border-radius: 8px; font-size: 0.8rem; font-weight: 700; }

.notes-pagination { display: flex; width: fit-content; align-items: center; gap: 8px; margin: 26px auto 0; padding: 7px; background: #fff; border: 1px solid var(--notes-border); border-radius: 10px; box-shadow: 0 5px 15px rgba(26, 37, 75, 0.05); }
.notes-pagination a,
.notes-pagination .is-disabled,
.notes-pagination .is-current { display: inline-grid; min-width: 36px; height: 36px; padding-inline: 9px; place-items: center; border-radius: 7px; font-size: 0.76rem; }
.notes-pagination a { color: #404a62; }
.notes-pagination a:hover { color: var(--notes-primary-dark); background: #f0f2ff; }
.notes-pagination .is-current { color: #fff; background: var(--notes-primary); font-weight: 700; }
.notes-pagination .is-disabled { color: #a7adbb; cursor: not-allowed; }
.notes-pagination__pages { display: flex; align-items: center; gap: 4px; padding-inline: 5px; border-inline: 1px solid #eaecf2; }

@media (max-width: 940px) {
    .notes-toolbar { grid-template-columns: 1fr 1fr; }
    .notes-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .notes-container { width: min(100% - 28px, 1200px); }
    .notes-intro { padding: 38px 0 26px; }
    .notes-intro__inner { align-items: flex-start; flex-direction: column; gap: 19px; }
    .notes-intro p { font-size: 0.85rem; }
    .notes-create-button { width: 100%; justify-content: center; }
    .notes-toolbar { grid-template-columns: 1fr; gap: 10px; padding: 13px; }
    .notes-count { justify-content: center; }
    .notes-results-summary { align-items: flex-start; flex-direction: column; }
    .notes-grid { grid-template-columns: 1fr; }
    .note-title, .note-description { min-height: 0; }
    .notes-pagination { max-width: 100%; }
    .notes-pagination__pages { overflow-x: auto; }
}
.note-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.note-title a:hover {
    color: #4c63e7;
}

.note-title a:focus-visible {
    outline: 3px solid rgba(76, 99, 231, 0.22);
    outline-offset: 4px;
    border-radius: 4px;
}
.note-category-tag {
    display: inline-flex;
    align-self: flex-start;
    margin-top: 14px;
    padding: 5px 10px;
    color: #5267df;
    background: #f0f2ff;
    border: 1px solid #dfe4ff;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    text-decoration: none;
    transition:
        color 0.2s ease,
        background 0.2s ease,
        border-color 0.2s ease;
}

.note-category-tag:hover {
    color: #ffffff;
    background: #5267df;
    border-color: #5267df;
}

.note-category-tag:focus-visible {
    outline: 3px solid rgba(82, 103, 223, 0.24);
    outline-offset: 3px;
}

.category-create-link {
    display: inline-flex;
    align-items: center;
    margin-top: 10px;
    color: #5264e5;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
}

.category-create-link:hover {
    color: #3546c5;
    text-decoration: underline;
}

.selected-attachments-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin-top: 13px;
}

.selected-attachments-list[hidden] {
    display: none;
}

.selected-attachment-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border: 1px solid #dfe4ef;
    border-radius: 11px;
    background-color: #f8f9fd;
}

.selected-attachment-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 9px;
    color: #5363e8;
    background-color: #e9ecff;
    font-size: 1rem;
    font-weight: 800;
}

.selected-attachment-information {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 3px;
}

.selected-attachment-information strong {
    overflow: hidden;
    color: #243150;
    font-size: 0.82rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selected-attachment-information small {
    color: #8a93a7;
    font-size: 0.72rem;
}

.selected-attachment-remove {
    flex-shrink: 0;
    padding: 6px 11px;
    border: 1px solid #efc5c5;
    border-radius: 8px;
    color: #b63838;
    background-color: #fff4f4;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition:
        border-color 0.2s ease,
        color 0.2s ease,
        background-color 0.2s ease;
}

.selected-attachment-remove:hover {
    border-color: #e49393;
    color: #942626;
    background-color: #ffe7e7;
}

.selected-attachment-remove:focus-visible {
    outline: 3px solid rgba(199, 59, 59, 0.18);
    outline-offset: 2px;
}

@media (max-width: 480px) {
    .selected-attachment-item {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .selected-attachment-information {
        width: calc(100% - 46px);
    }

    .selected-attachment-remove {
        width: 100%;
    }
}

.attachment-editor-card {
    margin-top: 24px;
}

.attachment-editor-card .attachment-form-group {
    margin-bottom: 0;
}

.attachment-input-wrapper {
    padding: 14px;
    border: 1px dashed #cbd3e4;
    border-radius: 12px;
    background-color: #f8f9fd;
}

.attachment-input-wrapper input[type="file"] {
    width: 100%;
    color: #59647b;
    font-family: inherit;
    font-size: 0.84rem;
}

.attachment-input-wrapper input[type="file"]::file-selector-button {
    margin-left: 12px;
    padding: 9px 15px;
    border: 0;
    border-radius: 9px;
    color: #ffffff;
    background-color: #5363e8;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
}

.attachment-input-wrapper input[type="file"]::file-selector-button:hover {
    background-color: #3e4dc8;
}

@media (max-width: 680px) {
    .attachment-editor-card {
        margin-top: 18px;
    }

    .attachment-input-wrapper {
        padding: 11px;
    }
}
/* =========================
   Note rich-text editor
========================= */

#note-description-input textarea {
    min-height: 320px;
}

#note-rich-editor {
    width: 100%;
}

#note-editor-toolbar.ql-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 10px 12px;
    border: 1px solid #dfe4ee;
    border-radius: 12px 12px 0 0;
    background: #f8f9fc;
    direction: rtl;
}

#note-editor-toolbar .ql-formats {
    display: inline-flex;
    align-items: center;
    margin: 0 0 0 8px;
}

#note-editor.ql-container {
    min-height: 360px;
    border: 1px solid #dfe4ee;
    border-top: 0;
    border-radius: 0 0 12px 12px;
    background: #ffffff;
    color: #17213d;
    font-family: inherit;
    font-size: 15px;
}

#note-editor .ql-editor {
    min-height: 360px;
    padding: 20px;
    direction: rtl;
    text-align: right;
    line-height: 2;
}

#note-editor .ql-editor.ql-blank::before {
    right: 20px;
    left: auto;
    color: #9aa3b6;
    font-style: normal;
}

#note-editor .ql-editor h2,
#note-editor .ql-editor h3 {
    color: #15203f;
    line-height: 1.7;
}

#note-editor .ql-editor p {
    margin-bottom: 14px;
}

#note-editor .ql-editor img,
#note-editor .ql-editor video,
#note-editor .note-editor-video {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 520px;
    margin: 22px auto;
    border-radius: 12px;
    background: #101526;
    object-fit: contain;
}

#note-editor .ql-editor img {
    height: auto;
}

#note-editor .ql-editor video,
#note-editor .note-editor-video {
    width: min(100%, 760px);
}

#note-editor-toolbar .note-editor-image-button,
#note-editor-toolbar .note-editor-video-button {
    display: inline-flex;
    width: auto;
    min-width: 62px;
    height: 30px;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid #d7dcff;
    border-radius: 7px;
    color: #5361ee;
    background: #f4f5ff;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

#note-editor-toolbar .note-editor-image-button:hover,
#note-editor-toolbar .note-editor-video-button:hover {
    color: #ffffff;
    background: #5361ee;
}

.note-editor-upload-status {
    margin: 10px 0 0;
    padding: 10px 12px;
    border: 1px solid #cdd5ff;
    border-radius: 8px;
    color: #3445bc;
    background: #f2f4ff;
    font-size: 13px;
    line-height: 1.8;
}

.note-editor-upload-status.is-error {
    border-color: #ffc8cf;
    color: #b4233b;
    background: #fff3f5;
}

@media (max-width: 600px) {
    #note-editor-toolbar.ql-toolbar {
        padding: 8px;
    }

    #note-editor-toolbar .ql-formats {
        margin-left: 4px;
    }

    #note-editor.ql-container,
    #note-editor .ql-editor {
        min-height: 300px;
    }

    #note-editor .ql-editor {
        padding: 15px;
    }
}
/* =========================
   Editor alignment controls
========================= */

#note-editor-toolbar .note-editor-align {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

#note-editor-toolbar .note-align-button {
    display: inline-flex !important;
    width: 32px !important;
    height: 32px !important;
    align-items: center;
    justify-content: center;
    padding: 5px !important;
    border: 0;
    border-radius: 6px;
    color: #4b5565;
    background: transparent;
    cursor: pointer;
}

#note-editor-toolbar .note-align-button svg {
    display: block;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

#note-editor-toolbar .note-align-button:hover {
    color: #5361ee;
    background: #eef0ff;
}

#note-editor-toolbar .note-align-button.is-active {
    color: #5361ee;
    background: #e8ebff;
}

/* تراز واقعی خطوط داخل ویرایشگر */

#note-editor .ql-editor .ql-align-right {
    text-align: right !important;
}

#note-editor .ql-editor .ql-align-center {
    text-align: center !important;
}

#note-editor .ql-editor .ql-align-left {
    text-align: left !important;
}

#note-editor .ql-editor .ql-align-justify {
    text-align: justify !important;
}

/* نمایش صحیح فهرست‌ها در متن فارسی */

#note-editor .ql-editor ol,
#note-editor .ql-editor ul {
    padding-right: 1.8em;
    padding-left: 0;
}

#note-editor .ql-editor li {
    padding-right: 0.4em;
    padding-left: 0;
}

#note-editor .ql-editor li > .ql-ui::before {
    margin-right: -1.8em;
    margin-left: 0.4em;
    text-align: right;
}
/* =========================
   Resizable editor media
========================= */

#note-rich-editor {
    position: relative;
}

#note-editor .ql-editor img.note-editor-media,
#note-editor .ql-editor video.note-editor-media {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 18px auto;
    box-sizing: border-box;
}

#note-editor .ql-editor img.note-editor-media {
    cursor: pointer;
}

#note-editor .ql-editor video.note-editor-media {
    cursor: pointer;
}

#note-editor .ql-editor .is-selected-media {
    outline: 2px solid transparent;
}


/* کادر آبی دور عکس یا ویدئوی انتخاب‌شده */

.note-media-selection {
    position: absolute;
    z-index: 30;

    border: 2px solid #5369f5;
    border-radius: 3px;

    box-sizing: border-box;
    pointer-events: none;
}

.note-media-selection[hidden] {
    display: none !important;
}


/* دستگیره‌های چهار گوشه */

.note-media-resize-handle {
    position: absolute;

    width: 13px;
    height: 13px;

    border: 2px solid #5369f5;
    border-radius: 3px;

    background: #ffffff;

    box-shadow:
        0 2px 6px
        rgba(32, 49, 120, 0.2);

    pointer-events: auto;
    touch-action: none;
}

.note-media-resize-handle--nw {
    top: 0;
    left: 0;

    transform: translate(-50%, -50%);
    cursor: nwse-resize;
}

.note-media-resize-handle--ne {
    top: 0;
    right: 0;

    transform: translate(50%, -50%);
    cursor: nesw-resize;
}

.note-media-resize-handle--sw {
    bottom: 0;
    left: 0;

    transform: translate(-50%, 50%);
    cursor: nesw-resize;
}

.note-media-resize-handle--se {
    right: 0;
    bottom: 0;

    transform: translate(50%, 50%);
    cursor: nwse-resize;
}


/* دکمه حذف رسانه */

.note-media-delete {
    position: absolute;

    top: -40px;
    right: 0;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 34px;
    height: 34px;

    padding: 0;

    border: 1px solid #f4a8b2;
    border-radius: 8px;

    color: #ffffff;
    background: #e5485d;

    box-shadow:
        0 5px 14px
        rgba(201, 52, 73, 0.25);

    font-family: inherit;
    font-size: 23px;
    line-height: 1;

    cursor: pointer;
    pointer-events: auto;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.note-media-delete:hover {
    background: #c93449;
    transform: translateY(-1px);
}

.note-media-delete:focus-visible {
    outline: 3px solid rgba(83, 105, 245, 0.3);
    outline-offset: 2px;
}


/* جلوگیری از انتخاب متن هنگام تغییر اندازه */

body.is-resizing-note-media {
    cursor: nwse-resize;
    user-select: none;
}

body.is-resizing-note-media * {
    user-select: none;
}


@media (max-width: 600px) {
    .note-media-resize-handle {
        width: 17px;
        height: 17px;
    }

    .note-media-delete {
        top: -44px;

        width: 38px;
        height: 38px;
    }
}
/* =========================
   Note editor gallery
========================= */

#note-editor-toolbar .note-editor-gallery-button {
    display: inline-flex;
    width: auto;
    min-width: 62px;
    height: 32px;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid #cdd5ff;
    border-radius: 7px;
    color: #4655c7;
    background: #f5f6ff;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition:
        color 0.2s ease,
        background 0.2s ease,
        border-color 0.2s ease;
}

#note-editor-toolbar .note-editor-gallery-button:hover {
    border-color: #5361ee;
    color: #ffffff;
    background: #5361ee;
}


/* گالری داخل ویرایشگر و صفحه نمایش یادداشت */

.note-media-gallery {
    display: flex;
    width: 100%;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
    margin: 18px 0;
    padding: 8px;
    border: 1px dashed #cdd5e7;
    border-radius: 12px;
    background: #fafbff;
    box-sizing: border-box;
}


/* تصاویر داخل گالری */

.note-media-gallery .note-gallery-image,
.note-media-gallery > img {
    display: block;
    flex: 0 0 auto;
    max-width: 100%;
    height: auto;
    margin: 0 !important;
    border-radius: 9px;
    object-fit: cover;
    cursor: pointer;
    box-sizing: border-box;
    transition:
        opacity 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}


/* حالت قرار گرفتن موس روی تصویر */

.note-media-gallery .note-gallery-image:hover,
.note-media-gallery > img:hover {
    box-shadow:
        0 7px 20px
        rgba(31, 45, 90, 0.16);
}


/* تصویر انتخاب‌شده */

.note-media-gallery .is-selected-media {
    outline: 2px solid #5361ee;
    outline-offset: 2px;
}


/* زمان جابه‌جایی تصویر */

.note-media-gallery .note-gallery-image.is-dragging {
    opacity: 0.45;
    transform: scale(0.97);
}


/* نشان دادن امکان جابه‌جایی */

#note-editor .note-media-gallery .note-gallery-image {
    cursor: grab;
}

#note-editor .note-media-gallery .note-gallery-image:active {
    cursor: grabbing;
}


/* حالت موبایل */

@media (max-width: 600px) {
    .note-media-gallery {
        gap: 7px;
        padding: 7px;
    }

    .note-media-gallery .note-gallery-image,
    .note-media-gallery > img {
        width: 100% !important;
        max-width: 100%;
    }

    #note-editor-toolbar .note-editor-gallery-button {
        min-width: 58px;
        padding: 0 8px;
    }
}