/* إعدادات أساسية وضبط الخط العربي */
body {
    font-family: 'IBM Plex Sans Arabic', system-ui, -apple-system, Segoe UI, Arial, sans-serif;
    direction: rtl;
    margin: 0;
    background-color: #f4f7f6;
    color: #333;
}

header {
    background-color: #004a99;
    color: white;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

header h1 {
    margin: 0 0 8px;
    font-weight: 600;
}

/* شريط التحكم */
.controls {
    max-width: 900px;
    margin: 16px auto 0;
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    align-items: end;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.control-group label {
    font-size: 13px;
    color: #334155;
}

.controls input[type="search"],
.controls input[type="date"],
.controls select {
    height: 36px;
    min-width: 180px;
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #0f172a;
    outline: none;
}

.controls input[type="search"]:focus,
.controls input[type="date"]:focus,
.controls select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.clear-btn {
    height: 36px;
    padding: 0 12px;
    border: 1px solid #ef4444;
    color: #ef4444;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
}

.clear-btn:hover { background: #fee2e2; }

.results { margin-inline-start: auto; color: #475569; font-size: 14px; }

.timeline-container {
    position: relative;
    max-width: 900px;
    margin: 16px auto 40px;
    padding: 20px;
}

/* الخط العمودي للجدول الزمني */
.timeline-container::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: #007bff;
    right: 30px;
    z-index: 1;
}

.timeline-item {
    position: relative;
    margin-bottom: 30px;
    padding-right: 70px;
}

/* النقطة الدائرية على الخط */
.timeline-item::before {
    content: '';
    position: absolute;
    top: 5px;
    right: 20px;
    width: 20px;
    height: 20px;
    background-color: white;
    border: 4px solid #007bff;
    border-radius: 50%;
    z-index: 2;
}

.timeline-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease-in-out;
}

.timeline-content:hover { transform: translateY(-5px); }

.timeline-content h3 {
    color: #004a99;
    margin-top: 0;
    margin-bottom: 6px;
    font-weight: 600;
}

.date-location {
    display: block;
    font-size: 0.9em;
    font-weight: 600;
    color: #555;
    margin-bottom: 10px;
}

.timeline-content p { line-height: 1.7; margin-bottom: 12px; }

.source {
    font-size: 0.85em;
    color: #777;
    font-style: italic;
}

.source .sep { margin: 0 6px; color: #94a3b8; }
.source a { color: #0ea5e9; text-decoration: none; }
.source a:hover { text-decoration: underline; }

/* سحابة الكلمات المفتاحية */
.keyword-cloud {
    max-width: 900px;
    margin: 12px auto 0;
    padding: 12px 16px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
}

.keyword-cloud .tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #dbeafe;
    background: #eff6ff;
    color: #0c4a6e;
    cursor: pointer;
    user-select: none;
    transition: transform 0.1s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.keyword-cloud .tag:hover { transform: translateY(-1px); background: #dbeafe; }
.keyword-cloud .tag.active { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }
.keyword-cloud .tag .count { opacity: 0.7; font-size: 12px; }

/* حجم ديناميكي حسب التكرار */
.keyword-cloud .size-1 { font-size: 12px; font-weight: 400; }
.keyword-cloud .size-2 { font-size: 13px; font-weight: 500; }
.keyword-cloud .size-3 { font-size: 14px; font-weight: 600; }
.keyword-cloud .size-4 { font-size: 16px; font-weight: 700; }
.keyword-cloud .size-5 { font-size: 18px; font-weight: 700; }
