

/* Chat Feature */
.modal-body.chat-modal-body { padding: 0; overflow: hidden; }
.chat-container { display: flex; height: 75vh; min-height: 500px; }
.chat-sidebar { flex: 0 0 280px; border-left: 1px solid var(--border-color); background: var(--light); display: flex; flex-direction: column; }
html[dir="rtl"] .chat-sidebar { border-left: none; border-right: 1px solid var(--border-color); }
.chat-list-container { overflow-y: auto; flex-grow: 1; }
.chat-contact { display: flex; align-items: center; padding: 15px; cursor: pointer; border-bottom: 1px solid var(--border-color); }
.chat-contact:hover { background: #e9ecef; }
.chat-contact.active { background: var(--secondary); color: white; }
.chat-avatar { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; margin-left: 15px; position: relative; }
html[dir="rtl"] .chat-avatar { margin-left: 0; margin-right: 15px; }
.chat-contact-info { flex: 1; }
.chat-contact-name { font-weight: 600; }
.chat-contact-msg { font-size: 0.9rem; opacity: 0.7; }
.chat-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.chat-header { padding: 15px 20px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.chat-header-user { font-weight: 700; font-size: 1.2rem; flex-grow: 1; }
.chat-header-actions { display: flex; align-items: center; gap: 15px; }
.chat-header-actions i { font-size: 1.3rem; cursor: pointer; color: white; padding: 8px; border-radius: 50%; transition: all 0.2s; }
.chat-header-actions i:hover { background-color: rgba(255,255,255,0.2); }
.chat-body { overflow-y: auto; padding: 20px; padding-bottom: 80px; background: #eaf2f8; display: flex; flex-direction: column; min-height: 0; flex: 1; }
.message { display: flex; margin-bottom: 15px; max-width: 70%; align-items: flex-end; }
.message-bubble { padding: 10px 15px; border-radius: 20px; line-height: 1.5; position: relative; }
.message.received { align-self: auto; margin-left: auto; margin-right: 0; }
.message.received .message-bubble { background: var(--bubble-recv-bg, #fff); border: 1px solid var(--bubble-border, #e9ecef); border-top-right-radius: 5px; color: var(--bubble-text-recv, #333); backdrop-filter: var(--bubble-blur, none); -webkit-backdrop-filter: var(--bubble-blur, none); }
html[dir="rtl"] .message.received { margin-right: auto; margin-left: 0; }
html[dir="rtl"] .message.received .message-bubble { border-top-right-radius: 20px; border-top-left-radius: 5px; }
.message.sent { align-self: auto; margin-right: auto; margin-left: 0; }
.message.sent .message-bubble { background: var(--bubble-sent-bg, var(--secondary)); color: var(--bubble-text-sent, white); border-bottom-left-radius: 5px; border: 1px solid var(--bubble-border, transparent); backdrop-filter: var(--bubble-blur, none); -webkit-backdrop-filter: var(--bubble-blur, none); }
html[dir="rtl"] .message.sent { margin-left: auto; margin-right: 0; }
html[dir="rtl"] .message.sent .message-bubble { border-bottom-left-radius: 20px; border-bottom-right-radius: 5px; }
.chat-input-area { padding: 15px; display: flex; align-items: center; gap: 15px; background: #fff; }
.chat-input { flex: 1; min-width: 0; padding: 12px 20px; border-radius: 50px; border: 1px solid #ddd; outline: none; }
.chat-input-btn { font-size: 1.5rem; cursor: pointer; color: var(--primary); }
.presence-dot { position: absolute; bottom: 2px; right: 2px; width: 12px; height: 12px; background-color: #6c757d; border-radius: 50%; border: 2px solid white; }
.presence-dot.online { background-color: #28a745; }
.message-actions { position: absolute; top: -12px; left: 10px; background: #fff; border-radius: 20px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); opacity: 0.7; transition: opacity 0.2s ease-in-out; padding: 2px 4px; display: flex; gap: 5px; z-index: 10; pointer-events: auto; }
.message-bubble:hover .message-actions, .message-bubble:active .message-actions, .message-actions:hover, .message-actions:focus-within { opacity: 1; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2); }
html[dir="rtl"] .message-actions { left: auto; right: 10px; }
.message-action-btn { border: none; background: none; cursor: pointer; font-size: 1rem; color: #555; padding: 5px; }

.message-options-menu { display: none; position: absolute; bottom: -5px; top: auto; background: white; border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.15); flex-direction: column; min-width: 120px; overflow: hidden; z-index: 1000; border: 1px solid #eee; }
.message.sent .message-options-menu { left: 100%; right: auto; margin-left: 5px; margin-right: 0; }
.message.received .message-options-menu { right: 100%; left: auto; margin-right: 5px; margin-left: 0; }
html[dir="rtl"] .message.sent .message-options-menu { right: 100%; left: auto; margin-right: 5px; margin-left: 0; }
html[dir="rtl"] .message.received .message-options-menu { left: 100%; right: auto; margin-left: 5px; margin-right: 0; }
.message-options-menu.show { display: flex; }
.message-options-menu button { padding: 10px 15px; background: none; border: none; text-align: left; cursor: pointer; font-size: 0.9rem; color: #333; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #f9f9f9; }
html[dir="rtl"] .message-options-menu button { text-align: right; }
.message-options-menu button:hover { background: #f5f5f5; color: var(--primary); }
.message-options-menu button i { width: 16px; text-align: center; color: #666; }

.reply-to-bar { padding: 10px 15px; background: #e9ecef; display: none; justify-content: space-between; align-items: center; border-bottom: 1px solid #ddd; }
.chat-header-more, .chat-header-mute { position: relative; }
.more-options-menu, .mute-options-menu { display: none; position: absolute; top: 40px; right: 0; background: white; border: 1px solid #ddd; border-radius: 8px; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); z-index: 100; min-width: 230px; white-space: nowrap; overflow: hidden; }
html[dir="rtl"] .more-options-menu, html[dir="rtl"] .mute-options-menu { right: auto !important; left: 0 !important; }
.more-options-menu.show, .mute-options-menu.show { display: block; }
.more-options-menu button, .mute-options-menu button { display: block; width: 100%; padding: 10px 15px; background: none; border: none; text-align: right; cursor: pointer; color: #333; font-size: 14px; font-weight: 600; font-family: inherit; }
html[dir="ltr"] .more-options-menu button, html[dir="ltr"] .mute-options-menu button { text-align: left; }
.more-options-menu button:hover, .mute-options-menu button:hover { background: #f5f5f5; }

/* Forum Feature (Feed-First Redesign) */
.modal-body.forum-modal-body { padding: 15px; }

/* 3-Column Layout */
.forum-feed-layout { display: flex; gap: 20px; align-items: flex-start; }
.forum-sidebar-right { flex: 0 0 260px; position: sticky; top: 20px; display: flex; flex-direction: column; gap: 15px; }
.forum-sidebar-left { flex: 0 0 260px; position: sticky; top: 20px; display: flex; flex-direction: column; gap: 15px; }
.forum-feed-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 20px; }

/* Responsive Layout */
@media (max-width: 1100px) {
    .forum-sidebar-left { display: none; }
}
@media (max-width: 768px) {
    .forum-feed-layout { flex-direction: column; }
    .forum-sidebar-right { position: relative; top: 0; width: 100%; flex: auto; }
}

/* Sidebar Cards */
.forum-sidebar-card { background: var(--card-background, #fff); border-radius: 16px; box-shadow: 0 2px 10px rgba(0,0,0,0.04); padding: 15px; border: 1px solid #eaeaea; }
.forum-sidebar-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 15px; display: flex; align-items: center; gap: 8px; color: var(--text-color); }
.forum-sidebar-title i { color: var(--primary); }

/* Quick Post Box */
.forum-quick-post-box { background: var(--card-background, #fff); border-radius: 16px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); padding: 15px; border: 1px solid #eaeaea; }
.quick-post-input-area { display: flex; align-items: center; gap: 15px; margin-bottom: 15px; cursor: pointer; }
.user-avatar-small { width: 45px; height: 45px; border-radius: 50%; object-fit: cover; border: 2px solid #eee; }
.quick-post-placeholder { flex: 1; background: #f0f2f5; padding: 12px 20px; border-radius: 30px; color: #65676b; font-size: 0.95rem; transition: background 0.2s; }
.quick-post-input-area:hover .quick-post-placeholder { background: #e4e6eb; }
.quick-post-actions { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid #f0f2f5; padding-top: 10px; }
.qp-action-btn { flex: 1; display: flex; justify-content: center; align-items: center; gap: 8px; background: transparent; border: none; padding: 10px; border-radius: 8px; color: #65676b; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.qp-action-btn:hover { background: #f0f2f5; }

/* Tabs */
.forum-feed-tabs { display: flex; background: var(--card-background, #fff); border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); overflow: hidden; border: 1px solid #eaeaea; }
.feed-tab { flex: 1; padding: 15px 10px; border: none; background: transparent; font-weight: 600; color: #65676b; cursor: pointer; border-bottom: 3px solid transparent; transition: all 0.2s; display: flex; justify-content: center; align-items: center; gap: 8px; }
.feed-tab:hover { background: #f8f9fa; color: var(--primary); }
.feed-tab.active { border-bottom-color: var(--primary); color: var(--primary); background: rgba(var(--primary-rgb), 0.05); }

/* Topic Card Redesign */
.topic-card { background-color: var(--card-background, #fff); border-radius: 16px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); margin-bottom: 20px; overflow: hidden; border: 1px solid #eaeaea; }
.topic-actions-menu { display: none; position: absolute; top: 35px; background: #fff; border: 1px solid #ddd; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); z-index: 100; min-width: 150px; overflow: hidden; }
.topic-actions-menu.show { display: block; }
.topic-actions-menu button { display: block; width: 100%; text-align: right; padding: 10px 15px; background: transparent; border: none; border-bottom: 1px solid #eee; cursor: pointer; transition: 0.2s; color: #333; }
.topic-actions-menu button:last-child { border-bottom: none; }
.topic-actions-menu button:hover { background: #f8f9fa; color: var(--primary); }
.topic-card-header { padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; }
.topic-card-body { padding: 0 20px 15px; }
.topic-card-body h4 { font-size: 1.15rem; margin-bottom: 10px; line-height: 1.4; }
.topic-card-body p { color: #333; line-height: 1.6; margin-bottom: 15px; }
.topic-image, .topic-video { width: 100%; border-radius: 12px; margin-top: 10px; max-height: 400px; object-fit: cover; }
.topic-file-attachment { background: #f8f9fa; padding: 15px; border-radius: 10px; border: 1px solid #ddd; display: flex; align-items: center; gap: 15px; cursor: pointer; transition: 0.2s; }
.topic-file-attachment:hover { background: #e9ecef; border-color: var(--primary); }
.topic-file-attachment i { font-size: 2rem; color: #ff9800; }
.topic-file-attachment span { font-weight: 600; color: #333; }

/* Footer Actions */
.topic-card-footer { padding: 10px 20px; border-top: 1px solid #f0f2f5; display: flex; align-items: center; gap: 10px; }
.footer-action { flex: 1; display: flex; justify-content: center; align-items: center; gap: 8px; padding: 8px; border-radius: 8px; cursor: pointer; color: #65676b; font-weight: 600; transition: background 0.2s; }
.footer-action:hover { background: #f0f2f5; }
.footer-action.liked { color: #e41e3f; }
.footer-action.liked i { animation: heartBeat 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.like-count { font-size: 0.9rem; color: #65676b; display: flex; align-items: center; margin-right: auto; padding-right: 15px; }

/* Inline Replies */
.inline-replies-container { background: #f8f9fa; padding: 15px 20px; border-top: 1px solid #eee; display: none; }
.inline-reply-input { display: flex; gap: 10px; margin-bottom: 15px; }
.inline-reply-input img { width: 35px; height: 35px; border-radius: 50%; }
.inline-reply-input input { flex: 1; padding: 10px 15px; border-radius: 20px; border: 1px solid #ddd; outline: none; background: #fff; }
.inline-reply-input button { background: transparent; border: none; color: var(--primary); cursor: pointer; padding: 0 10px; font-size: 1.2rem; }
.reply-card { background: #fff; border: 1px solid #e9ecef; border-radius: 12px; padding: 12px 15px; margin-bottom: 10px; }

/* Animations */
@keyframes heartBeat {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Category Sidebar Items */
.forum-category-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 8px; cursor: pointer; transition: 0.2s; color: #333; font-weight: 500; }
.forum-category-item:hover { background: #f0f2f5; }
.forum-category-item.active { background: rgba(var(--primary-rgb), 0.1); color: var(--primary); }
.forum-category-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; justify-content: center; align-items: center; background: #e4e6eb; color: #4b4f56; font-size: 0.9rem; }
.forum-category-item.active .forum-category-icon { background: var(--primary); color: #fff; }

/* Calendar Feature */
.calendar-container { padding: 10px; }
.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.calendar-header h4 { margin: 0; font-size: 1.2rem; color: var(--primary); }
.calendar-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-weight: bold; color: #6c757d; padding-bottom: 10px; border-bottom: 1px solid #eee; margin-bottom: 5px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.calendar-day { border: 1px solid #f0f2f5; border-radius: 8px; min-height: 100px; padding: 5px; transition: background-color 0.2s; cursor: pointer; }
.calendar-day:hover { background-color: #f8f9fa; }
.calendar-day.empty { background: none; border: none; cursor: default; }
.day-number { font-weight: bold; margin-bottom: 5px; }
.calendar-event { background-color: var(--secondary); color: white; padding: 3px 6px; border-radius: 4px; font-size: 0.8em; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Live Session Feature */
#live-session-modal { display: none; background: #f4f7f9; border-radius: 15px; width: 95%; max-width: 1200px; max-height: 90vh; flex-direction: column; animation: fadeIn .4s; }
.live-session-header { background: var(--dark); color: white; padding: 15px 20px; border-top-left-radius: 15px; border-top-right-radius: 15px; display: flex; justify-content: space-between; align-items: center; }
.live-session-container { display: flex; flex: 1; min-height: 0; }

/* Camera Overlay UI */
.camera-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: #000; z-index: 1600; display: none; flex-direction: column; justify-content: center; align-items: center; }
#camera-view, #camera-preview { width: 100%; max-width: 100%; height: 100%; object-fit: contain; }
.camera-controls { position: absolute; bottom: 30px; width: 100%; display: flex; justify-content: center; align-items: center; gap: 30px; }
#preview-controls { display: none; }
.camera-control-btn, #capture-btn { background-color: rgba(0, 0, 0, 0.4); border: 2px solid rgba(255, 255, 255, 0.8); color: white; cursor: pointer; display: flex; justify-content: center; align-items: center; transition: background-color 0.2s, transform 0.2s; }
.camera-control-btn:hover, #capture-btn:hover { background-color: rgba(0, 0, 0, 0.6); }
.camera-control-btn:active, #capture-btn:active { transform: scale(0.95); }

/* **START: New Button Styles** */
#close-camera-btn { position: absolute; top: 20px; left: 20px; width: 50px; height: 50px; font-size: 2rem; background-color: var(--primary) !important; border: none; border-radius: 50%; }
html[dir="rtl"] #close-camera-btn { left: auto; right: 20px; }
#capture-btn { width: 70px; height: 70px; background-color: var(--primary) !important; border-radius: 15px; font-size: 2.2rem; }
.camera-control-btn { width: 60px; height: 60px; font-size: 1.8rem; border-radius: 50%; }

/* Subscription Plans */
.subscription-plans-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.plan-card {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.plan-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    border-color: var(--primary);
}

.plan-card.popular {
    border-color: var(--primary);
}

/* Typing Indicator Animation (Pen Writing) */
@keyframes penWriteAnim {
    0% { transform: translateX(0) translateY(0) rotate(0deg); }
    25% { transform: translateX(-5px) translateY(-2px) rotate(-15deg); }
    50% { transform: translateX(-10px) translateY(0) rotate(-5deg); }
    75% { transform: translateX(-5px) translateY(-2px) rotate(-15deg); }
    100% { transform: translateX(0) translateY(0) rotate(0deg); }
}
.writing-pen-anim {
    animation: penWriteAnim 1.2s infinite ease-in-out;
}
@keyframes drawLineAnim {
    0% { opacity: 0; transform: scaleX(0); transform-origin: right; }
    30% { opacity: 1; transform: scaleX(1); transform-origin: right; }
    80% { opacity: 1; transform: scaleX(1); transform-origin: right; }
    100% { opacity: 0; transform: scaleX(1); transform-origin: right; }
}
.writing-lines-anim .line {
    animation: drawLineAnim 1.5s infinite ease-out;
}
.writing-lines-anim .line:nth-child(1) { animation-delay: 0s; }
.writing-lines-anim .line:nth-child(2) { animation-delay: 0.3s; }
.writing-lines-anim .line:nth-child(3) { animation-delay: 0.6s; }

.plan-card.popular::before {
    content: 'الأكثر شيوعاً';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: white;
    padding: 3px 15px;
    font-size: 0.8rem;
    font-weight: bold;
    width: 100%;
}

html[dir="ltr"] .plan-card.popular::before {
    content: 'Most Popular';
}

.plan-duration {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 8px;
    margin-top: 10px; /* Add space for the popular banner */
}

.plan-price {
    font-weight: 500;
    font-size: 1rem;
    color: var(--primary);
}

.payment-methods-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 25px;
    filter: grayscale(1);
    opacity: 0.7;
}

.payment-methods-container img {
    height: 35px;
    max-width: 80px;
    object-fit: contain;
}

/* Curriculum Selection Feature */
.curriculum-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: var(--light);
    border-radius: 8px;
    margin-bottom: 15px;
}
.curriculum-item-container {
    display: flex;
    align-items: center;
    gap: 15px;
}
.curriculum-item-checkbox {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}
.curriculum-item-content {
    flex-grow: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* PDF Viewer */
.pdf-viewer-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}
#pdf-render-area {
    flex-grow: 1;
    overflow: auto;
    background-color: #525659;
    text-align: center;
    padding: 10px;
}
#pdf-render-area canvas {
    max-width: 100%;
    height: auto;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

.video-container {
    position: relative;
}
.fullscreen-btn {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background-color: rgba(0,0,0,0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}
.video-container:hover .fullscreen-btn {
    opacity: 1;
}

/* Global Unified Search Styles */
.search-container { position: relative; }

.search-results-overlay {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
    z-index: 1000;
    max-height: 450px;
    overflow-y: auto;
    display: none;
    padding: 10px 0;
    border: 1px solid #eee;
    margin-top: 5px;
}

.search-category {
    padding: 10px 15px;
}

.search-category h5 {
    color: var(--primary);
    margin: 0 0 10px 0;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #f0f2f5;
}

.search-item {
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 8px;
    margin: 2px 8px;
}

.search-item:hover {
    background: #f0f7ff;
    color: var(--primary);
}

.search-item span {
    font-size: 0.95rem;
}

.search-item small {
    display: inline-block;
    color: #888;
    font-size: 0.8rem;
    margin-right: 5px;
}

.mini-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #ddd;
}

.search-loading, .no-results {
    padding: 30px;
    text-align: center;
    color: #777;
    font-size: 0.95rem;
}

.search-error {
    padding: 15px;
    text-align: center;
    color: #dc3545;
    font-size: 0.9rem;
}

/* Advanced Search Stepper Styles */
.search-level {
    display: none;
    animation: fadeIn 0.3s ease;
}

.search-level.active {
    display: block;
}

.search-options-grid .search-option {
    padding: 15px;
    border: 2px solid #eee;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    background: #f9f9f9;
}

.search-options-grid .search-option:hover {
    border-color: var(--primary);
    background: #fff;
    transform: translateY(-2px);
}

.search-options-grid .search-option.selected {
    border-color: var(--primary);
    background: #eaf2f8;
    color: var(--primary);
    font-weight: bold;
}

.search-details-area {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #eee;
}

.search-nav-btn {
    padding: 10px 25px;
    border-radius: 8px;
    font-weight: 600;
    transition: 0.2s;
}

.search-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Athkar Toast Reminder */
.athkar-toast-container {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 10000;
    max-width: 350px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    border-right: 5px solid #28a745;
    animation: athkarSlideIn 0.5s ease forwards;
    padding: 15px;
    direction: rtl;
}

[data-theme="dark"] .athkar-toast-container {
    background: rgba(30, 30, 30, 0.9);
    border-right-color: #34d058;
    color: #eee;
}

.athkar-content {
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

.athkar-icon {
    font-size: 1.5rem;
    color: #28a745;
    flex-shrink: 0;
}

.athkar-text {
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.5;
    color: #333;
    padding-left: 15px;
}

[data-theme="dark"] .athkar-text {
    color: #eee;
}

.athkar-close {
    position: absolute;
    top: -5px;
    left: -5px;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #888;
}

@keyframes athkarSlideIn {
    from { opacity: 0; transform: translateX(-50px); }
    to { opacity: 1; transform: translateX(0); }
}

/* --- Zad AI Assistant & Smart FAQ --- */
.ai-help-container { display: flex; flex-direction: column; gap: 20px; text-align: right; }
.ai-search-box {
    background: var(--search-bg);
    padding: 15px;
    border-radius: 15px;
    border: 2px solid var(--primary);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.ai-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; color: var(--primary); font-weight: bold; }
.ai-input-group { display: flex; gap: 10px; }
.ai-input-group input {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--nav-bg);
    color: var(--text-color);
    font-family: inherit;
}
.ai-input-group button {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: 0.3s;
    font-weight: bold;
}
.ai-input-group button:hover { opacity: 0.9; transform: translateY(-2px); }

.ai-response-area {
    min-height: 50px;
    background: #ffffff;
    color: #212529;
    border-radius: 12px;
    padding: 15px;
    line-height: 1.7;
    border: 1px solid var(--border-color);
    border-right: 5px solid var(--primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    display: none;
    margin-top: 15px;
    font-size: 0.95rem;
}
.ai-response-area.active { display: block; animation: slideInUp 0.3s ease-out; }
.ai-response-area.thinking { opacity: 0.7; font-style: italic; color: #6c757d; }

.faq-list { margin-top: 15px; border-top: 1px solid var(--border-color); padding-top: 15px; }
.faq-title-static { font-size: 1.1rem; margin-bottom: 15px; color: var(--text-color); font-weight: bold; }
.faq-item {
    background: var(--card-background);
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: var(--card-shadow);
}
.faq-question {
    padding: 15px 20px;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: 0.2s;
}
.faq-question i { color: var(--primary); transition: 0.3s; }
.faq-question:hover { background: rgba(var(--primary-rgb), 0.05); }
.faq-answer {
    padding: 0 15px 15px 15px;
    color: var(--text-color);
    opacity: 0.9;
    font-size: 0.95rem;
    display: none;
    line-height: 1.6;
}
.faq-item.active .faq-answer { display: block; animation: fadeIn 0.3s; }
.faq-item.active .faq-question i { transform: rotate(180deg); }

.ai-mascot-container { display: flex; flex-direction: column; align-items: center; margin-bottom: 15px; }
.ai-mascot {
    width: 120px;
    height: auto;
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.1));
    animation: mascotBounce 3s infinite ease-in-out;
}
.ai-mascot-msg {
    background: white;
    padding: 12px 18px;
    border-radius: 15px;
    border: 1px solid var(--border-color);
    margin-top: -10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    font-weight: 500;
    color: var(--text-color);
    position: relative;
    max-width: 80%;
    text-align: center;
}
.ai-mascot-msg::after {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid white;
}

@keyframes mascotBounce {
    0%, 100% { transform: translateY(0) rotate(0); }
    50% { transform: translateY(-10px) rotate(2deg); }
}

@keyframes slideInUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* --- Floating AI Mascot Button --- */
.ai-floating-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 80px;
    height: 80px;
    z-index: 2000;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
    animation: floatingMascot 4s infinite ease-in-out;
}
/* --- CSS-Based AI Mascot (The Book) --- */
.ai-mascot-css {
    width: 65px;
    height: 75px;
    background: #4CAF50; /* Green book cover */
    border-radius: 5px 12px 12px 5px;
    position: relative;
    box-shadow: 
        inset -5px 0 10px rgba(0,0,0,0.1),
        0 8px 15px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid #388E3C;
}
.ai-mascot-css::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 2px;
    bottom: 2px;
    width: 6px;
    background: #f0f0f0; /* Pages edge */
    border-radius: 2px;
}
.mascot-eye {
    width: 10px;
    height: 10px;
    background: #000;
    border-radius: 50%;
    position: absolute;
    top: 25px;
}
.mascot-eye.left { left: 18px; }
.mascot-eye.right { right: 18px; }
.mascot-smile {
    width: 25px;
    height: 12px;
    border-bottom: 3px solid #000;
    border-radius: 50%;
    position: absolute;
    top: 40px;
}
.mascot-hand {
    width: 15px;
    height: 8px;
    background: #4CAF50;
    position: absolute;
    border-radius: 10px;
    border: 1px solid #388E3C;
}
.mascot-hand.left { transform: rotate(-30deg); left: -12px; top: 45px; animation: waveLeft 2s infinite ease-in-out; }
.mascot-hand.right { transform: rotate(30deg); right: -12px; top: 45px; animation: waveRight 2s infinite ease-in-out; }

@keyframes waveLeft { 0%, 100% { transform: rotate(-30deg); } 50% { transform: rotate(-50deg) translateX(-2px); } }
@keyframes waveRight { 0%, 100% { transform: rotate(30deg); } 50% { transform: rotate(50deg) translateX(2px); } }
.ai-floating-label {
    position: absolute;
    top: -30px;
    background: var(--primary);
    color: white;
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(10px);
    transition: 0.3s;
    pointer-events: none;
}
.ai-floating-btn:hover .ai-floating-label {
    opacity: 1;
    transform: translateY(0);
}
.ai-floating-btn:hover {
    transform: scale(1.1);
}

.ai-floating-btn.dragging {
    animation: none;
    transition: none !important;
    opacity: 0.8;
    z-index: 2001;
    transform: scale(1.05);
}

@keyframes floatingMascot {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

@keyframes spinMascot {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}

@keyframes shakeMascot {
    0%, 100% { transform: rotate(0deg); }
    10%, 30%, 50%, 70%, 90% { transform: rotate(-10deg); }
    20%, 40%, 60%, 80% { transform: rotate(10deg); }
}

@keyframes bounceMascot {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-25px); }
}

/* Customizer styles */
.mascot-color-swatch:hover {
    transform: scale(1.1);
}
.mascot-acc-btn:hover, .mascot-anim-btn:hover {
    background: #f0f0f0 !important;
}
.mascot-acc-btn, .mascot-anim-btn {
    user-select: none;
}

/* --- Dedicated AI Chat Window --- */
.ai-chat-window {
    position: fixed;
    bottom: 120px;
    right: 30px;
    width: 380px;
    height: 550px;
    max-height: 80vh;
    background: white;
    border-radius: 25px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.25);
    z-index: 2000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: chatSlideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    direction: rtl;
    border: 1px solid rgba(0,0,0,0.05);
}
.ai-chat-window.active { display: flex; }

.ai-chat-header {
    background: var(--primary);
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid rgba(255,255,255,0.1);
}
.ai-chat-header .title { display: flex; align-items: center; gap: 10px; font-weight: bold; font-size: 1.1rem; }
.ai-chat-header .title img { width: 30px; height: 30px; border-radius: 50%; background: white; padding: 2px; }
.ai-chat-header .close-chat { cursor: pointer; font-size: 1.4rem; opacity: 0.8; transition: 0.3s; }
.ai-chat-header .close-chat:hover { opacity: 1; transform: rotate(90deg); }

.ai-chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #fdfdfd;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.ai-chat-body::-webkit-scrollbar { width: 6px; }
.ai-chat-body::-webkit-scrollbar-thumb { background: #ddd; border-radius: 10px; }

.chat-msg {
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 85%;
    font-size: 0.95rem;
    line-height: 1.6;
    position: relative;
    box-shadow: 0 3px 10px rgba(0,0,0,0.03);
    animation: msgIn 0.3s ease-out;
}
.chat-msg.ai {
    background: white;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px; border: 1px solid #eee;
}
.chat-msg.user {
    background: var(--primary);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.ai-chat-footer {
    padding: 15px;
    background: white;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 10px;
    align-items: center;
}
.ai-chat-footer input {
    flex: 1;
    border: 1px solid #eee;
    background: #f8f9fa;
    border-radius: 25px;
    padding: 12px 20px;
    outline: none;
    font-size: 0.95rem;
    transition: 0.3s;
}
.ai-chat-footer input:focus { border-color: var(--primary); background: white; box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1); }
.ai-chat-footer button {
    background: var(--primary);
    color: white;
    border: none;
    width: 45px; height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: 0.3s; box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.ai-chat-footer button:hover { transform: scale(1.05); filter: brightness(1.1); }

@keyframes chatSlideUp {
    from { transform: translateY(30px) scale(0.95); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes msgIn {
    from { transform: translateY(10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
