/* Auto Posts Manager - تنسيقات واجهة الإدارة */

/* Shortlink Box Styles (Frontend) */
.masr-shortlink-box {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px 20px;
    margin: 30px 0;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    direction: rtl;
}

.masr-shortlink-label {
    font-weight: 600;
    color: #333;
    font-size: 16px;
    white-space: nowrap;
}

.masr-shortlink-field {
    flex: 1;
    min-width: 200px;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    font-family: monospace;
    background: #fff;
    color: #333;
    direction: ltr;
    text-align: left;
}

.masr-shortlink-field:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.masr-copy-btn {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.masr-copy-btn:hover {
    background: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.masr-copy-btn:active {
    transform: translateY(0);
}

.masr-copy-btn.copied {
    background: #28a745;
}

.masr-copy-btn.copied::after {
    content: " ✓ تم النسخ!";
}

@media (max-width: 768px) {
    .masr-shortlink-box {
        flex-direction: column;
        align-items: stretch;
    }
    
    .masr-shortlink-field {
        width: 100%;
    }
    
    .masr-copy-btn {
        width: 100%;
    }
}

/* التنسيقات العامة */
.masrtrends-dashboard { 
    margin: 20px 0; 
}

/* شريط الإحصاءات */
.masrtrends-stats-bar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.masrtrends-stats-grid {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    text-align: center;
}

.masrtrends-stat-item {
    margin: 10px;
    min-width: 150px;
}

.masrtrends-stat-number {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 5px;
}

.masrtrends-stat-label {
    font-size: 14px;
    opacity: 0.9;
}

/* شريط التحكم */
.masrtrends-control-bar {
    background: #f0f0f1;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.masrtrends-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* الأقسام */
.masrtrends-section {
    margin-bottom: 40px;
}

.masrtrends-section-header {
    color: white;
    padding: 15px 20px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.google-header {
    background: linear-gradient(135deg, #4285F4 0%, #34A853 100%);
}

.youtube-header {
    background: linear-gradient(135deg, #FF0000 0%, #FF3333 100%);
}

.x-header {
    background: linear-gradient(135deg, #000000 0%, #1DA1F2 100%);
}

.masrtrends-count,
.masrtrends-info {
    background: rgba(255, 255, 255, 0.2);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    margin: 2px;
}

/* الشبكة */
.masrtrends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* الكروت */
.masrtrends-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}

.masrtrends-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.masrtrends-card-header {
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.masrtrends-rank {
    background: #ff4500;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.masrtrends-category {
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: #666;
}

.masrtrends-checkbox {
    margin: 0;
}

/* صور الكروت */
.masrtrends-card-image {
    position: relative;
    height: 150px;
    overflow: hidden;
    background: #f8f9fa;
}

.masrtrends-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.masrtrends-card:hover .masrtrends-card-image img {
    transform: scale(1.05);
}

.masrtrends-image-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 150, 0, 0.8);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
}

.masrtrends-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 30px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    padding: 10px;
}

/* جسم الكرت */
.masrtrends-card-body {
    padding: 15px;
    flex: 1;
}

.masrtrends-card h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    line-height: 1.4;
    color: #333;
}

.masrtrends-channel {
    margin: 5px 0;
    font-size: 12px;
    color: #666;
}

.masrtrends-news-preview {
    padding: 10px 15px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

.masrtrends-news-title {
    margin: 0;
    font-size: 12px;
    font-weight: bold;
    color: #333;
    line-height: 1.4;
}

/* كروت إكس */
.masrtrends-x-card {
    text-align: center;
}

.masrtrends-x-header {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #000;
    color: white;
}

.masrtrends-x-logo {
    font-size: 30px;
    font-weight: bold;
}

.masrtrends-x-hashtag {
    padding: 20px;
    background: #f8f9fa;
}

.masrtrends-x-hashtag h2 {
    margin: 0;
    color: #1da1f2;
    font-size: 18px;
}

.masrtrends-x-body {
    padding: 15px;
}

/* الأزرار داخل الكروت */
.masrtrends-card button {
    width: 100%;
    margin: 0;
    border-radius: 0;
    border: none;
    border-top: 1px solid #eee;
    padding: 12px;
    background: #f8f9fa;
    cursor: pointer;
    transition: background 0.3s ease;
}

.masrtrends-card button:hover {
    background: #e9ecef;
}

/* إعدادات وجدولة */
.masrtrends-settings-section,
.masrtrends-schedule {
    background: white;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.masrtrends-schedule-actions {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.masrtrends-actions-grid {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* سجل الجدولة */
.masrtrends-schedule-log {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 30px;
}

.masrtrends-log-content {
    background: #f8f9fa;
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.masrtrends-no-logs {
    color: #666;
    text-align: center;
    padding: 20px;
}

/* معلومات الجدولة */
.masrtrends-schedule-info {
    margin-top: 30px;
    padding: 20px;
    background: #f0f7ff;
    border-radius: 8px;
}

.masrtrends-schedule-info ul {
    margin: 10px 0 0 20px;
    list-style-type: disc;
}

.masrtrends-schedule-info li {
    margin-bottom: 8px;
    color: #333;
}

/* معلومات الصور */
.masrtrends-image-info {
    background: #f0f7ff;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}

.masrtrends-image-info ul {
    margin: 10px 0 0 20px;
    list-style-type: disc;
}

.masrtrends-image-info li {
    margin-bottom: 8px;
    color: #333;
}

.masrtrends-image-note {
    margin-top: 10px;
    color: #666;
    font-size: 13px;
    line-height: 1.5;
}

/* المودال */
.masrtrends-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.masrtrends-modal-content {
    background: white;
    padding: 40px;
    border-radius: 10px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.masrtrends-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2271b1;
    border-radius: 50%;
    animation: masrtrends-spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes masrtrends-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* النتائج */
#masrtrends-results {
    margin-top: 20px;
    text-align: left;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.success-item {
    background: #d4edda;
    color: #155724;
    padding: 5px 10px;
    margin: 3px 0;
    border-radius: 4px;
    font-size: 12px;
    border: 1px solid #c3e6cb;
}

.error-item {
    background: #f8d7da;
    color: #721c24;
    padding: 5px 10px;
    margin: 3px 0;
    border-radius: 4px;
    font-size: 12px;
    border: 1px solid #f5c6cb;
}

/* تبويبات التنقل */
.nav-tab-wrapper {
    margin-bottom: 20px;
}

.nav-tab-active {
    background: #fff;
    border-bottom-color: #fff;
}

/* تصميم متجاوب */
@media (max-width: 768px) {
    .masrtrends-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .masrtrends-stats-grid {
        flex-direction: column;
        align-items: center;
    }
    
    .masrtrends-stat-item {
        min-width: 200px;
    }
    
    .masrtrends-controls {
        flex-direction: column;
    }
    
    .masrtrends-controls .button {
        width: 100%;
        text-align: center;
    }
    
    .masrtrends-filter-grid {
        flex-direction: column;
        align-items: stretch;
    }
    
    .masrtrends-filter-item input[type="text"],
    .masrtrends-filter-item select {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .masrtrends-grid {
        grid-template-columns: 1fr;
    }
    
    .masrtrends-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .masrtrends-actions-grid {
        flex-direction: column;
    }
}