/* 
 * User Guide RTL CSS - Complete Independent RTL Design
 * For Right-to-Left languages (Arabic)
 * Includes both main user guide page and article page styles
 */

/* ========== RESET & BASE RTL STYLES ========== */
* {
    box-sizing: border-box;
}

html[dir="rtl"] .user-guide-container {
    direction: rtl;
    text-align: right;
    font-family: 'Cairo', 'Tajawal', 'Amiri', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #333;
    line-height: 1.6;
}

html[dir="rtl"] .user-guide-container *:not(.fa):not(.fas):not(.far):not(.fab) {
    direction: rtl;
    text-align: center;
}

/* ========== USER GUIDE HEADER SECTION ========== */
.user-guide-header {
    background: linear-gradient(135deg, #4b1e1e 0%, #6b2c2c 50%, #4b1e1e 100%);
    color: white;
    padding: 60px 0;
    position: relative;
    overflow: hidden;
}

/* ========== COMPACT SEARCH BAR FOR ARTICLE PAGE ========== */
html[dir="rtl"] .article-search-bar .search-input-wrapper {
    position: relative;
    background: white;
    border-radius: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

html[dir="rtl"] .article-search-bar .fas.fa-search {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
}

html[dir="rtl"] .article-search-bar .form-control {
    padding: 12px 45px 12px 15px;
    border: none;
    border-radius: 25px;
    text-align: right;
    direction: rtl;
}

html[dir="rtl"] .article-search-bar .search-loading {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
}

html[dir="rtl"] .article-search-bar .search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    margin-top: 10px;
    z-index: 99999;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
}

/* Main search results (for main page) */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    margin-top: 10px;
    z-index: 99999;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
}

.user-guide-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="20" cy="20" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="80" cy="40" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="40" cy="80" r="1" fill="%23ffffff" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
    z-index: 1;
}

.user-guide-header .container {
    position: relative;
    z-index: 2;
}

.user-guide-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 15px;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.user-guide-subtitle {
    font-size: 1.2rem;
    margin-bottom: 40px;
    text-align: center;
    opacity: 0.9;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ========== SEARCH SECTION ========== */
.user-guide-search {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.search-input-wrapper {
    position: relative;
    background: white;
    border-radius: 50px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    overflow: hidden;
}

.search-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
    font-size: 18px;
    z-index: 3;
}

.search-input {
    width: 100%;
    padding: 18px 60px 18px 20px;
    border: none;
    font-size: 16px;
    background: transparent;
    text-align: right;
    direction: rtl;
}

.search-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(75, 30, 30, 0.2);
}

.search-loading {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #4b1e1e;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    margin-top: 10px;
    z-index: 99999;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
}

/* ========== SEARCH RESULTS STYLING ========== */
.search-result-item {
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s ease;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item.highlighted {
    background-color: #f8f9fa;
}

.search-result-link {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    flex-direction: row-reverse;
}

html[dir="rtl"] .search-result-link {
    flex-direction: row;
    text-align: right;
}

html[dir="rtl"] .search-result-icon {
    order: 1;
}

html[dir="rtl"] .search-result-content {
    order: 2;
    text-align: right;
}

.search-result-link:hover {
    background-color: #f8f9fa;
    text-decoration: none;
    color: #4b1e1e;
}

.search-result-icon {
    margin-top: 2px;
    color: #e39823;
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.search-result-content {
    flex: 1;
}

.search-result-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.3;
    color: #4b1e1e;
}

html[dir="rtl"] .search-result-title {
    text-align: right;
    direction: rtl;
}

.search-result-category {
    font-size: 0.8rem;
    color: #e39823;
    margin-bottom: 4px;
    font-weight: 500;
}

html[dir="rtl"] .search-result-category {
    text-align: right;
    direction: rtl;
}

.search-result-description {
    font-size: 0.85rem;
    color: #6c757d;
    line-height: 1.4;
    margin: 0;
}

html[dir="rtl"] .search-result-description {
    text-align: right;
    direction: rtl;
}

.search-no-results {
    padding: 30px;
    text-align: center;
    color: #6c757d;
}

.search-no-results i {
    font-size: 2rem;
    margin-bottom: 10px;
    opacity: 0.5;
    color: #e39823;
}

/* ========== MAIN CONTENT LAYOUT ========== */
.user-guide-content {
    padding: 60px 0;
    min-height: 500px;
}

.user-guide-content .row {
    display: flex;
    flex-wrap: wrap;
    direction: rtl;
}

/* RTL Column Layout - Categories on RIGHT, Popular on LEFT */
.user-guide-content .col-lg-3:first-child {
    order: 1; /* Categories sidebar - RIGHT side */
    flex: 0 0 25%;
    max-width: 25%;
}

.user-guide-content .col-lg-7 {
    order: 2; /* Main content - CENTER */
    flex: 0 0 58.333333%;
    max-width: 58.333333%;
    padding: 0 30px;
}

.user-guide-content .col-lg-2:last-child {
    order: 3; /* Popular articles - LEFT side */
    flex: 0 0 16.666667%;
    max-width: 16.666667%;
}

/* ========== CATEGORIES CONTAINER (RIGHT) ========== */
.categories-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.category-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: all 0.3s ease;
}

.category-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.categories-sidebar {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    position: sticky;
    top: 20px;
}

.sidebar-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #4b1e1e;
    text-align: center;
    border-bottom: 2px solid #e39823;
    padding-bottom: 10px;
}

.categories-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-dropdown,
.category-card {
    margin-bottom: 15px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.category-card {
    margin-bottom: 0;
    border-radius: 12px;
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* RTL Category Header Layout: Image → Name → Count → Arrow */
html[dir="rtl"] .category-header {
    justify-content: flex-start;
    gap: 12px;
}

html[dir="rtl"] .category-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-direction: row;
    flex: 1;
    order: 1;
}

html[dir="rtl"] .article-count {
    order: 2;
}

html[dir="rtl"] .dropdown-arrow {
    order: 3;
    margin-left: auto;
    margin-right: 0;
}


.category-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

html[dir="rtl"] .category-icon {
    order: 1;
}

html[dir="rtl"] .category-name {
    order: 2;
}

.category-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e39823;
    color: white;
    font-size: 18px;
    object-fit: cover;
}

.category-icon img {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    object-fit: cover;
}

.category-name {
    font-weight: 600;
    font-size: 16px;
    text-align: right;
    direction: rtl;
}

.article-count {
    background: #e39823;
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
}

.dropdown-arrow {
    color: #888;
    transition: transform 0.3s ease;
}

.category-dropdown.open .dropdown-arrow,
.category-card.open .dropdown-arrow {
    transform: rotate(180deg);
}

.articles-list {
    background: #f8f9fa;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.category-dropdown.open .articles-list,
.category-card.open .articles-list {
    max-height: 300px;
}

.article-link {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: #666;
    text-decoration: none;
    border-bottom: 1px solid #e9ecef;
    transition: all 0.2s ease;
    gap: 10px;
    text-align: right;
    direction: rtl;
}

/* RTL Article Links in Dropdown: Icon → Article Name */
html[dir="rtl"] .article-link {
    justify-content: flex-start;
    flex-direction: row;
    text-align: right;
    direction: rtl;
}

html[dir="rtl"] .article-link i {
    order: 1;
    margin-left: 0;
    margin-right: 0;
}

html[dir="rtl"] .article-link span {
    order: 2;
    text-align: right;
}

.article-link:hover {
    background: white;
    color: #4b1e1e;
    padding-right: 20px;
}

.article-link:last-child {
    border-bottom: none;
}

.no-categories {
    text-align: center;
    padding: 40px 20px;
    color: #888;
}

.no-categories i {
    font-size: 48px;
    margin-bottom: 15px;
    color: #ddd;
}

/* ========== MAIN CONTENT AREA (CENTER) ========== */
.articles-content {
    direction: rtl;
    text-align: right;
}

/* Welcome Section */
.welcome-content {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    text-align: center;
}

.welcome-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #4b1e1e, #e39823);
    border-radius: 50%;
    margin: 0 auto 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 36px;
}

.welcome-message h2 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: #4b1e1e;
}

.welcome-message p {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 30px;
    line-height: 1.8;
}

.welcome-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.feature-item {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
}

.feature-item i {
    font-size: 24px;
    color: #e39823;
    margin-bottom: 10px;
}

.feature-item h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #4b1e1e;
}

.feature-item span {
    font-size: 0.9rem;
    color: #666;
}

/* ========== ARTICLES GRID & CARDS (RTL) ========== */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    direction: rtl;
    margin-top: 20px;
}

.article-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    direction: rtl;
    text-align: right;
}


.article-card .article-header {
    margin-bottom: 15px;
}

.article-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    direction: rtl;
}

.article-type-badge.article-type-video {
    background: #e3f2fd;
    color: #1976d2;
}

.article-type-badge.article-type-image {
    background: #f3e5f5;
    color: #7b1fa2;
}

.article-type-badge.article-type-text {
    background: #e8f5e8;
    color: #388e3c;
}

.article-card .article-body {
    direction: rtl;
    text-align: right;
}

.article-card .article-title {
    margin-bottom: 12px;
}

.article-card .article-title a {
    color: #4b1e1e;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.4;
    transition: color 0.2s ease;
    direction: rtl;
    text-align: right;
}

.article-card .article-title a:hover {
    color: #e39823;
}

.article-description {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 15px;
    direction: rtl;
    text-align: right;
}

.article-card .article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #888;
    direction: rtl;
    flex-direction: row-reverse;
}

.article-card .views-count,
.article-card .updated-date {
    display: flex;
    align-items: center;
    gap: 5px;
    direction: rtl;
}

.article-card .views-count i,
.article-card .updated-date i {
    color: #e39823;
}

/* Category Header Display */
.category-header-display {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    direction: rtl;
    text-align: right;
}

.category-header-display .category-info {
    display: flex;
    align-items: center;
    gap: 20px;
    direction: rtl;
    flex-direction: row-reverse;
}

.category-header-display .category-image {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    object-fit: cover;
}

.category-header-display .category-details {
    flex: 1;
    direction: rtl;
    text-align: right;
}

.category-header-display .category-name {
    font-size: 2rem;
    font-weight: 700;
    color: #4b1e1e;
    margin-bottom: 10px;
    direction: rtl;
    text-align: right;
}

.category-header-display .category-description {
    color: #666;
    font-size: 1.1rem;
    line-height: 1.6;
    direction: rtl;
    text-align: right;
}

/* No Articles State */
.no-articles {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.no-articles i {
    font-size: 64px;
    color: #ddd;
    margin-bottom: 20px;
}

.no-articles h4 {
    font-size: 1.5rem;
    color: #4b1e1e;
    margin-bottom: 10px;
}

.no-articles p {
    color: #666;
    font-size: 1.1rem;
}

/* Article Content */
.article-header-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.article-breadcrumb {
    margin-bottom: 20px;
}

.breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: row-reverse;
    list-style: none;
}

.breadcrumb-item {
    color: #666;
    font-size: 14px;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "\\";
    float: right;
    padding-right: 0.5rem;
    padding-left: 0;
    color: #888;
}

.breadcrumb-item.active {
    color: #4b1e1e;
}

.article-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: #4b1e1e;
    line-height: 1.3;
}

.article-subtitle {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.6;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
    justify-content: flex-end;
    flex-direction: row-reverse;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #888;
    font-size: 14px;
    flex-direction: row-reverse;
}

.meta-item i {
    color: #e39823;
}

.article-main-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    margin-bottom: 25px;
}

.article-text-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #444;
}

.article-text-content h1,
.article-text-content h2,
.article-text-content h3,
.article-text-content h4,
.article-text-content h5,
.article-text-content h6 {
    color: #4b1e1e;
    margin: 25px 0 15px 0;
    font-weight: 600;
}

.article-text-content p {
    margin-bottom: 15px;
}

.article-text-content ul,
.article-text-content ol {
    padding-right: 25px;
    padding-left: 0;
    margin-bottom: 15px;
}

.article-text-content blockquote {
    border-right: 4px solid #e39823;
    border-left: none;
    padding: 15px 20px;
    background: #f8f9fa;
    margin: 20px 0;
    font-style: italic;
}

/* ========== POPULAR SIDEBAR (LEFT) ========== */
.popular-sidebar {
    direction: rtl;
}

.sidebar-widget {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.widget-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: #4b1e1e;
    text-align: center;
    border-bottom: 2px solid #e39823;
    padding-bottom: 8px;
}

.popular-articles-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.popular-article-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    color: #666;
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
    flex-direction: row-reverse;
}

.popular-article-link:hover {
    color: #4b1e1e;
    padding-right: 10px;
}

.popular-article-link:last-child {
    border-bottom: none;
}

.article-type-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e39823;
    color: white;
    font-size: 12px;
    flex-shrink: 0;
}

.popular-article-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    flex: 1;
    text-align: right;
    direction: rtl;
}

html[dir="rtl"] .popular-article-link {
    text-align: right;
    justify-content: flex-start;
    flex-direction: row;
}

html[dir="rtl"] .popular-article-link .article-type-icon {
    order: 1;
}

html[dir="rtl"] .popular-article-link .popular-article-title {
    order: 2;
    text-align: right;
}

html[dir="rtl"] .popular-article-link:hover {
    padding-right: 20px;
    padding-left: 0;
}

.quick-links-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.quick-link-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    color: #666;
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
}

/* RTL Quick Links - Icon First */
html[dir="rtl"] .quick-link-item {
    flex-direction: row;
    text-align: right;
    justify-content: flex-start;
}

html[dir="rtl"] .quick-link-item i {
    order: 1;
}

html[dir="rtl"] .quick-link-item span {
    order: 2;
    text-align: right;
}

.quick-link-item:hover {
    color: #4b1e1e;
    padding-right: 10px;
}

.quick-link-item:last-child {
    border-bottom: none;
}

.quick-link-item i {
    color: #e39823;
    font-size: 16px;
}

.no-articles-text {
    text-align: center;
    color: #888;
    font-style: italic;
    padding: 20px 0;
}

/* ========== RESPONSIVE DESIGN ========== */

/* Tablet */
@media (max-width: 991.98px) {
    .user-guide-content .row {
        flex-direction: column;
    }
    
    .user-guide-content .col-lg-3:first-child,
    .user-guide-content .col-lg-7,
    .user-guide-content .col-lg-2:last-child {
        order: unset;
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 30px;
    }
    
    .user-guide-title {
        font-size: 2.5rem;
    }
    
    .articles-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 20px;
    }
    
    .categories-sidebar {
        position: sticky;
        top: 20px;
    }
}

/* Mobile */
@media (max-width: 767.98px) {
    .user-guide-header {
        padding: 40px 0;
    }
    
    .user-guide-title {
        font-size: 2rem;
    }
    
    .user-guide-subtitle {
        font-size: 1rem;
    }
    
    .user-guide-content {
        padding: 40px 0;
    }
    
    .user-guide-content .col-lg-7 {
        padding: 0 15px;
    }
    
    .welcome-content,
    .article-header-section,
    .article-main-content {
        padding: 25px 20px;
    }
    
    .welcome-features {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .article-title {
        font-size: 2rem;
    }
    
    .article-meta {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .search-input {
        padding: 16px 50px 16px 15px;
        font-size: 14px;
    }
}

/* Small Mobile */
@media (max-width: 575.98px) {
    .user-guide-title {
        font-size: 1.8rem;
    }
    
    .article-title {
        font-size: 1.5rem;
    }
    
    .categories-sidebar,
    .sidebar-widget {
        padding: 15px;
    }
    
    .category-header {
        padding: 12px;
    }
    
    .welcome-content {
        padding: 20px 15px;
    }
    
    .welcome-message h2 {
        font-size: 1.8rem;
    }
}
