/* منتقي الايموجي */
.emoji-picker {
    position: fixed;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 5px 30px rgba(0,0,0,0.2);
    width: 320px;
    max-height: 350px;
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.emoji-picker.show {
    display: flex;
}

.emoji-picker-header {
    background: #f5f5f5;
    border-bottom: 1px solid #eee;
    padding: 8px;
}

.emoji-tabs {
    display: flex;
    gap: 5px;
    overflow-x: auto;
}

.emoji-tab {
    background: none;
    border: none;
    padding: 8px;
    font-size: 18px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.emoji-tab:hover {
    background: #e0e0e0;
}

.emoji-tab.active {
    background: #1a237e;
}

.emoji-picker-body {
    padding: 10px;
    overflow-y: auto;
    flex: 1;
}

.emoji-category {
    display: none;
    flex-wrap: wrap;
    gap: 5px;
}

.emoji-category.active {
    display: flex;
}

.emoji-item {
    font-size: 22px;
    padding: 5px;
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.2s, transform 0.1s;
}

.emoji-item:hover {
    background: #f0f0f0;
    transform: scale(1.2);
}

/* ازرار الادوات */
.input-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f9f9f9;
    border-top: 1px solid #eee;
}

.tool-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: #e0e0e0;
    color: #1a237e;
}

/* معاينة الملفات */
.file-preview {
    padding: 10px;
    background: #f9f9f9;
    border-top: 1px solid #eee;
}

.file-preview-item {
    position: relative;
    display: inline-block;
    max-width: 200px;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.file-preview-item img,
.file-preview-item video {
    max-width: 100%;
    max-height: 150px;
    display: block;
}

.file-preview-item .file-icon {
    padding: 20px;
    text-align: center;
}

.file-preview-item .file-icon i {
    font-size: 40px;
    color: #1a237e;
    display: block;
    margin-bottom: 10px;
}

.file-preview-item .file-icon span {
    font-size: 12px;
    color: #666;
    word-break: break-all;
}

.file-preview-item .file-size {
    display: block;
    text-align: center;
    font-size: 11px;
    color: #999;
    padding: 5px;
    background: #f5f5f5;
}

.file-preview-item .file-remove {
    position: absolute;
    top: 5px;
    left: 5px;
    background: rgba(220, 53, 69, 0.9);
    color: #fff;
    border: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
}

/* مرفقات الرسائل */
.attachment-preview {
    margin-top: 10px;
    border-radius: 10px;
    overflow: hidden;
    max-width: 300px;
}

.attachment-image img {
    max-width: 100%;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s;
}

.attachment-image img:hover {
    transform: scale(1.02);
}

.attachment-video video {
    max-width: 100%;
    border-radius: 10px;
}

.attachment-audio audio {
    width: 100%;
}

.attachment-file {
    background: #f5f5f5;
    border-radius: 10px;
}

.attachment-file .file-download {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    color: #333;
    text-decoration: none;
    transition: background 0.2s;
}

.attachment-file .file-download:hover {
    background: #e0e0e0;
}

.attachment-file .file-download i {
    font-size: 32px;
    color: #1a237e;
}

.attachment-file .file-download span {
    flex: 1;
    font-weight: 500;
    word-break: break-all;
}

.attachment-file .file-download small {
    color: #999;
}

/* مؤشر انتهاء الصلاحية */
.attachment-expires {
    font-size: 11px;
    color: #ff9800;
    margin-top: 5px;
}

.attachment-expires i {
    margin-left: 5px;
}

/* خيارات الحذف التلقائي */
.delete-options {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 10px;
    background: #fff3e0;
    border-radius: 8px;
    font-size: 13px;
}

.delete-options select {
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: inherit;
}

/* حاوية ادوات الادخال */
.input-container {
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    overflow: hidden;
}

.input-container textarea,
.input-container input[type="text"] {
    width: 100%;
    border: none;
    padding: 15px;
    font-family: inherit;
    font-size: 15px;
    resize: none;
}

.input-container textarea:focus,
.input-container input[type="text"]:focus {
    outline: none;
}

.input-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: #f9f9f9;
    border-top: 1px solid #eee;
}

.input-actions-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* تحميل الملف */
.file-input-wrapper {
    position: relative;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* رسائل الدردشة مع المرفقات */
.message.has-attachment .message-content {
    max-width: 350px;
}

/* المنتدى مع المرفقات */
.topic-attachments,
.reply-attachments {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.attachments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.attachments-grid .attachment-preview {
    margin: 0;
}

/* متجاوب */
@media (max-width: 480px) {
    .emoji-picker {
        width: calc(100vw - 20px);
        left: 10px !important;
        right: 10px !important;
    }
    
    .attachment-preview {
        max-width: 100%;
    }
}
