* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #853939 0%, #6d0202 100%);
    min-height: 100vh;
    direction: rtl;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.logo {
    font-size: 28px;
    font-weight: bold;
    background: linear-gradient(135deg, #853939 0%, #6d0202 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    cursor: pointer;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: #f0f0f0;
    border-radius: 25px;
}

.status-badge {
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
}

.status-pending { background: #fff3cd; color: #856404; }
.status-approved { background: #d4edda; color: #155724; }
.status-denied { background: #f8d7da; color: #721c24; }
.status-owner { background: #d1ecf1; color: #0c5460; }

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #853939 0%, #6d0202 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(234, 102, 102, 0.4);
}

.btn-secondary {
    background: white;
    color: #853939;
    border: 2px solid #853939;
}

.btn-secondary:hover {
    background: #853939;
    color: white;
}

.btn-success { background: #28a745; color: white; }
.btn-danger { background: #ff4757; color: white; }
.btn-warning { background: #ffc107; color: #333; }
.btn-small { padding: 8px 15px; font-size: 14px; }

.auth-container {
    max-width: 500px;
    margin: 50px auto;
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 24px;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #eee;
}

.auth-tab {
    flex: 1;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.auth-tab.active {
    color: #853939;
    border-bottom-color: #853939;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #853939;
}

.error-message {
    color: #721c24;
    background: #f8d7da;
    padding: 12px;
    border-radius: 8px;
    margin-top: 10px;
    border: 1px solid #f5c6cb;
}

.success-message {
    color: #155724;
    background: #d4edda;
    padding: 12px;
    border-radius: 8px;
    margin-top: 10px;
    border: 1px solid #c3e6cb;
}

.info-message {
    background: #d1ecf1;
    color: #0c5460;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    border-left: 4px solid #17a2b8;
}

.search-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 16px;
    font-family: inherit;
}

.search-input:focus {
    outline: none;
    border-color: #853939;
}

.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

select {
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 16px;
    font-family: inherit;
    cursor: pointer;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.content-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    cursor: pointer;
}

.content-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15);
}

.content-type-badge {
    display: inline-block;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
}

.badge-article { background: #e3f2fd; color: #1976d2; }
.badge-book { background: #f3e5f5; color: #7b1fa2; }
.badge-lecture_notes { background: #fff3e0; color: #f57c00; }
.badge-summary { background: #e8f5e9; color: #388e3c; }
.badge-paper { background: #fce4ec; color: #c2185b; }
.badge-condensed_summary { background: #f1f8e9; color: #689f38; }

.content-card h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 20px;
}

.content-meta {
    display: flex;
    justify-content: space-between;
    color: #666;
    font-size: 14px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.approval-dashboard {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.pending-user-card {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    border-right: 4px solid #ffc107;
}

.pending-user-card h4 {
    color: #333;
    margin-bottom: 10px;
}

.user-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
}

.user-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Full Page Editor */
.editor-page {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.editor-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.latex_area {
    resize: none;
    height: 500px;
    width: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px;
    background: #f9f9f9;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    padding: 20px;
    line-height: 1.8;
}

.latex_area:focus {
    outline: none;
    border-color: #853939;
}
.live-preview {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    margin-top: 15px;
    min-height: 100px;
    line-height: 1.8;
}

.content-view-page {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    max-width: 900px;
    margin: 0 auto 30px;
}

.back-button {
    margin-bottom: 20px;
}

.content-view-page h1 {
    color: #333;
    margin-bottom: 20px;
    font-size: 32px;
}

.content-view-page .meta-info {
    display: flex;
    justify-content: space-between;
    padding: 20px 0;
    border-bottom: 2px solid #eee;
    margin-bottom: 30px;
    color: #666;
    flex-wrap: wrap;
    gap: 15px;
}

.content-body {
    font-size: 18px;
    color: #333;
    line-height: 1.8;
}

.content-body p {
    margin-bottom: 15px;
}

/* Theorem and Definition Boxes */
.theorem-box,
.definition-box {
    padding: 20px;
    margin: 20px 0;
    border-radius: 10px;
    border-left: 4px solid;
}

.theorem-box {
    background: #e3f2fd;
    border-color: #1976d2;
}

.definition-box {
    background: #f3e5f5;
    border-color: #7b1fa2;
}

.theorem-box strong,
.definition-box strong {
    display: block;
    margin-bottom: 10px;
    font-size: 22px;
    border-bottom: solid #0c5460 2px;
    padding-bottom: 10px;
    width: max-content;
    padding-left: 120px;

}

/* Edit History */
.edit-history {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
    margin-top: 30px;
    border-top: 2px solid #eee;
}

.edit-history h3 {
    margin-bottom: 15px;
    color: #333;
}

.history-entry {
    padding: 10px;
    background: white;
    margin-bottom: 10px;
    border-radius: 5px;
    border-left: 3px solid #853939;
}

.loading {
    text-align: center;
    padding: 40px;
    color: white;
    font-size: 18px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 15px;
    color: #666;
}

.empty-state h2 {
    color: #333;
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    .content-grid {
        grid-template-columns: 1fr;
    }

    .search-bar {
        flex-direction: column;
    }

    .search-input {
        min-width: 100%;
    }

    .user-details {
        grid-template-columns: 1fr;
    }
    
    .editor-toolbar {
        flex-direction: column;
    }
}

.katex {
    font-size: 1.1em;
}
.form-group p{
    direction: ltr;
}
/* Modal preview for معاينة */
.kottab-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 9998;
}
.kottab-modal {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(1100px, 96%);
    max-height: 90vh;
    overflow: auto;
    background: white;
    border-radius: 12px;
    z-index: 9999;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 20px;
}
.kottab-modal-header {
    display:flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.kottab-modal-body {
    padding: 10px 0;
    line-height: 1.8;
    direction: rtl;
    text-align: right;
}
code, pre {
    direction: ltr;
    unicode-bidi: embed;
    text-align: left;
    font-family: 'Fira Code', 'Source Code Pro', 'Courier New', monospace;
    font-size: 0.95em; /* optional, adjust size */
    background-color: #f5f5f5; /* optional, subtle background */
    padding: 2px 4px; /* optional, small padding */
    border-radius: 4px; /* optional, rounded corners */
}