/* استایل‌های اختصاصی صفحه مدیریت وبلاگ */

/* تب‌ها */
.tabs-container {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 2px solid #e9ecef;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    color: #6c757d;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    color: #495057;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.action-buttons-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.bulk-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 10px 15px;
    border: 1px solid #e1e5ea;
    border-radius: 10px;
    background: #fff;
    flex-wrap: wrap;
}

.select-all-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: #495057;
}

.select-all-control input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.bulk-actions button {
    background-color: #dc3545;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 18px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.bulk-actions button:disabled {
    background-color: #f3b8be;
    cursor: not-allowed;
    opacity: 0.7;
}

.selection-summary {
    font-size: 0.9rem;
    color: #6c757d;
}

.add-post-btn, .add-category-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.add-post-btn:hover, .add-category-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.refresh-btn {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.refresh-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* فرم‌ها */
#post-form-container, #category-form-container {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 2px solid #e9ecef;
}

#post-form-container.hidden, #category-form-container.hidden {
    display: none;
}

#post-form-title, #category-form-title {
    margin-bottom: 20px;
    color: #495057;
    font-size: 1.5em;
}

.required {
    color: #dc3545;
}

.form-help {
    display: block;
    margin-top: 5px;
    color: #6c757d;
    font-size: 13px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #ced4da;
    border-radius: 6px;
    font-size: 15px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

/* لیست دسته‌بندی‌ها برای انتخاب در فرم نوشته */
.categories-checkbox-list {
    max-height: 200px;
    overflow-y: auto;
    border: 2px solid #ced4da;
    border-radius: 6px;
    padding: 15px;
    background: white;
}

.category-checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    margin-bottom: 5px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.category-checkbox-item:hover {
    background: #f8f9fa;
}

.category-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

.category-checkbox-item label {
    margin: 0;
    cursor: pointer;
    font-weight: normal;
    flex: 1;
}

/* لیست نوشته‌ها */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.post-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
    position: relative;
}

.post-selection-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.post-selection-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.post-selection-row span {
    font-size: 13px;
    color: #495057;
    font-weight: 600;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.post-title {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
    flex: 1;
    word-break: break-word;
}

.post-status-badge {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
    white-space: nowrap;
    margin-right: 10px;
}

.post-status-badge.publish {
    background: #d4edda;
    color: #155724;
}

.post-status-badge.draft {
    background: #fff3cd;
    color: #856404;
}

.post-status-badge.pending {
    background: #d1ecf1;
    color: #0c5460;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #6c757d;
}

.post-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.post-excerpt {
    color: #6c757d;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.post-category-tag {
    background: #e7f3ff;
    color: #17a2b8;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.post-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.action-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.action-btn.edit {
    background: #17a2b8;
    color: white;
}

.action-btn.edit:hover {
    background: #138496;
}

.action-btn.delete {
    background: #dc3545;
    color: white;
}

.action-btn.delete:hover {
    background: #c82333;
}

/* لیست دسته‌بندی‌ها */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.category-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
    position: relative;
}

.category-selection-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.category-selection-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.category-selection-row span {
    font-size: 13px;
    color: #495057;
    font-weight: 600;
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.category-name {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.category-slug {
    font-size: 12px;
    color: #6c757d;
    font-family: monospace;
    background: #f8f9fa;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 5px;
}

.category-description {
    color: #6c757d;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
    min-height: 40px;
}

.category-meta {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: #6c757d;
    margin-bottom: 15px;
}

.category-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.category-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.btn-primary, .btn-secondary {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: #28a745;
    color: white;
}

.btn-primary:hover {
    background: #218838;
}

.btn-primary:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    color: #adb5bd;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: #495057;
}

.loading-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.spinner-loader {
    width: 50px;
    height: 50px;
    border: 5px solid #e9ecef;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-state p {
    font-size: 16px;
    color: #6c757d;
    margin: 0;
}

/* Loader Overlay */
.ajax-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(3px);
}

.ajax-loader-overlay.hidden {
    display: none;
}

.ajax-loader-spinner {
    text-align: center;
    color: white;
}

.ajax-loader-spinner .spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.loader-text {
    color: white;
    font-size: 18px;
    font-weight: 500;
    margin-top: 15px;
}

/* استایل عکس شاخص */
.featured-image-upload-area {
    border: 2px dashed #ced4da;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
    position: relative;
}

.featured-image-upload-placeholder {
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.featured-image-upload-placeholder:hover {
    background: #e9ecef;
}

.featured-image-upload-placeholder i {
    font-size: 48px;
    color: #adb5bd;
    margin-bottom: 15px;
}

.featured-image-upload-placeholder p {
    color: #6c757d;
    margin: 0;
    font-size: 14px;
}

.featured-image-preview {
    position: relative;
    width: 100%;
    max-height: 300px;
    overflow: hidden;
}

.featured-image-preview img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 300px;
    object-fit: cover;
}

.remove-featured-image-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.remove-featured-image-btn:hover {
    background: rgba(220, 53, 69, 1);
    transform: scale(1.1);
}

#featured-image-progress {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

#featured-image-progress .progress-bar-container {
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

#featured-image-progress .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
    border-radius: 3px;
}

#featured-image-progress .progress-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #6c757d;
}

/* استایل Editor.js */
.editorjs-container {
    background: white;
    min-height: 400px;
    border-radius: 6px;
    border: 2px solid #ced4da;
    padding: 20px;
}

.codex-editor {
    min-height: 400px;
    font-family: inherit;
    direction: rtl;
}

.codex-editor__redactor {
    padding-bottom: 50px !important;
}

/* استایل‌های پایه Editor.js */
.codex-editor .codex-editor__redactor {
    padding-bottom: 50px;
}

.codex-editor .ce-block {
    margin: 15px 0;
}

.codex-editor .ce-block__content {
    max-width: 100%;
    margin: 0 auto;
}

.codex-editor .ce-toolbar__content {
    max-width: 100%;
}

.codex-editor .ce-toolbar__plus,
.codex-editor .ce-toolbar__settings-btn {
    color: #667eea;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.codex-editor .ce-toolbar__plus:hover,
.codex-editor .ce-toolbar__settings-btn:hover {
    background: #f0f0f0;
}

.codex-editor .ce-inline-toolbar {
    background: white;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 6px;
    direction: rtl;
}

.codex-editor .ce-conversion-toolbar {
    background: white;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 6px;
    direction: rtl;
}

.codex-editor .ce-settings {
    background: white;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 6px;
    direction: rtl;
}

.codex-editor .ce-popover {
    background: white;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 6px;
    direction: rtl;
}

.codex-editor .ce-popover__item {
    color: #495057;
    padding: 10px 15px;
    transition: background 0.2s ease;
}

.codex-editor .ce-popover__item:hover {
    background: #f8f9fa;
}

.codex-editor .ce-popover__item-icon {
    color: #667eea;
}

.codex-editor .ce-header {
    font-weight: 600;
    line-height: 1.4;
    margin: 20px 0 10px 0;
}

.codex-editor .ce-paragraph {
    line-height: 1.8;
    color: #495057;
    margin: 10px 0;
}

.codex-editor .ce-list {
    line-height: 1.8;
    margin: 10px 0;
    padding-right: 20px;
}

.codex-editor .ce-quote {
    border-right: 4px solid #667eea;
    padding-right: 15px;
    font-style: italic;
    color: #6c757d;
    margin: 15px 0;
}

.codex-editor .ce-code {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    margin: 15px 0;
    direction: ltr;
    text-align: left;
}

.codex-editor .ce-delimiter {
    text-align: center;
    margin: 30px 0;
}

.codex-editor .ce-delimiter::before {
    content: '***';
    font-size: 30px;
    color: #adb5bd;
    letter-spacing: 5px;
}

.codex-editor .ce-link {
    color: #667eea;
    text-decoration: underline;
}

.codex-editor .ce-link:hover {
    color: #5568d3;
}

/* استایل‌های input و button در Editor.js */
.codex-editor .cdx-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    direction: rtl;
}

.codex-editor .cdx-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.codex-editor .cdx-button {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    font-family: inherit;
}

.codex-editor .cdx-button:hover {
    background: #5568d3;
}

.codex-editor .cdx-button:active {
    transform: scale(0.98);
}

/* استایل نوار پیشرفت آپلود */
.editor-upload-progress {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.editor-upload-progress .progress-bar-container {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.editor-upload-progress .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
    border-radius: 4px;
}

.editor-upload-progress .progress-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #6c757d;
}

.editor-upload-progress .progress-percent {
    font-weight: 600;
    color: #667eea;
}

/* استایل بلاک‌های سفارشی */
.custom-image-tool,
.custom-video-tool,
.custom-audio-tool {
    margin: 20px 0;
    padding: 15px;
    border: 2px dashed #ced4da;
    border-radius: 8px;
    background: #f8f9fa;
}

.custom-image-tool img,
.custom-video-tool video,
.custom-audio-tool audio {
    display: block;
    margin: 15px 0;
    border-radius: 6px;
}

.custom-image-tool .cdx-input,
.custom-video-tool .cdx-input,
.custom-audio-tool .cdx-input {
    width: 100%;
    margin-top: 10px;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

.custom-image-tool .cdx-button,
.custom-video-tool .cdx-button,
.custom-audio-tool .cdx-button {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.custom-image-tool .cdx-button:hover,
.custom-video-tool .cdx-button:hover,
.custom-audio-tool .cdx-button:hover {
    background: #5568d3;
}

/* Responsive */
@media (max-width: 768px) {
    .posts-grid, .categories-grid {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .category-actions, .post-actions {
        flex-direction: column;
    }

    .tabs-container {
        flex-direction: column;
    }

    .tab-btn {
        border-bottom: none;
        border-right: 3px solid transparent;
    }

    .tab-btn.active {
        border-bottom: none;
        border-right-color: #667eea;
    }

    /* استایل Editor.js برای موبایل */
    .editorjs-container {
        padding: 10px;
    }
    
    .codex-editor__redactor {
        padding-bottom: 30px !important;
    }
}

