/* ==========================================
   LAMAR PRO — Admin Panel | Light Mode
   ========================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

body {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background: #f0f4f8;
    color: #1a2332;
    min-height: 100vh;
    direction: rtl;
}

/* ==========================================
   صفحة تسجيل الدخول
   ========================================== */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 30% 50%, rgba(10,110,189,0.08) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 20%, rgba(0,180,216,0.06) 0%, transparent 50%),
                #eef2f7;
}

.login-card {
    background: #ffffff;
    border: 1px solid #dde3ed;
    border-radius: 20px;
    padding: 44px 40px;
    width: 360px;
    text-align: center;
    box-shadow: 0 8px 40px rgba(0,0,0,0.08);
}

.login-logo img { height: 48px; margin-bottom: 20px; filter: invert(1) sepia(1) saturate(3) hue-rotate(190deg) brightness(0.5); }
.login-card h2 { font-size: 20px; font-weight: 700; color: #1a2332; margin-bottom: 6px; }
.login-sub { font-size: 13px; color: #8a96a8; margin-bottom: 28px; }

.input-wrap { position: relative; margin-bottom: 14px; }
.input-wrap > i:first-child {
    position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
    color: #aab3c0; font-size: 14px;
}
.input-wrap input {
    width: 100%; padding: 12px 40px;
    background: #f5f7fa; border: 1px solid #dde3ed; border-radius: 10px;
    color: #1a2332; font-size: 14px; direction: ltr; text-align: center;
    outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.input-wrap input:focus { border-color: #0a6ebd; box-shadow: 0 0 0 3px rgba(10,110,189,0.1); }

#toggle-pass {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: #aab3c0; cursor: pointer; font-size: 14px; padding: 4px;
}

.login-error {
    background: #fff5f5; border: 1px solid #fecaca; color: #dc2626;
    font-size: 13px; padding: 8px 12px; border-radius: 8px; margin-bottom: 12px;
}

.login-submit-btn {
    width: 100%; padding: 13px;
    background: linear-gradient(90deg, #0a6ebd, #00b4d8);
    border: none; border-radius: 10px; color: #fff; font-size: 15px; font-weight: 700;
    cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: opacity 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 14px rgba(10,110,189,0.25);
}
.login-submit-btn:hover { opacity: 0.92; }
.login-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ==========================================
   هيكل اللوحة
   ========================================== */
.admin-panel { display: flex; min-height: 100vh; }

/* ==========================================
   الشريط الجانبي
   ========================================== */
.admin-sidebar {
    width: 230px; min-height: 100vh;
    background: #ffffff; border-left: 1px solid #dde3ed;
    display: flex; flex-direction: column; padding: 24px 16px;
    flex-shrink: 0; box-shadow: 2px 0 12px rgba(0,0,0,0.04);
}

.sidebar-logo {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding-bottom: 24px; border-bottom: 1px solid #eef1f6; margin-bottom: 20px;
}
.sidebar-logo img { height: 38px; filter: invert(1) sepia(1) saturate(3) hue-rotate(190deg) brightness(0.5); }
.sidebar-logo span { font-size: 11px; color: #aab3c0; letter-spacing: 1px; text-transform: uppercase; font-weight: 600; }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.nav-item {
    display: flex; align-items: center; gap: 10px; padding: 11px 14px;
    border-radius: 10px; color: #6b7a8d; text-decoration: none;
    font-size: 14px; font-weight: 500; transition: all 0.2s;
}
.nav-item:hover { background: #f0f4f8; color: #1a2332; }
.nav-item.active {
    background: #eff6ff; color: #0a6ebd;
    border: 1px solid #bfdbfe; font-weight: 600;
}
.nav-item i { width: 18px; text-align: center; }

.logout-btn {
    display: flex; align-items: center; gap: 8px; padding: 10px 14px;
    background: #fff5f5; border: 1px solid #fecaca; border-radius: 10px;
    color: #dc2626; font-size: 13px; font-weight: 500; cursor: pointer;
    transition: background 0.2s; width: 100%;
}
.logout-btn:hover { background: #fee2e2; }

/* ==========================================
   المنطقة الرئيسية
   ========================================== */
.admin-main { flex: 1; padding: 32px 36px; overflow-y: auto; max-width: 960px; }

.admin-view { display: none; }
.admin-view.active { display: block; }

.view-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.view-header h1 { font-size: 22px; font-weight: 700; color: #1a2332; display: flex; align-items: center; gap: 10px; }
.view-header h1 i { color: #0a6ebd; }
.view-header h2 { font-size: 17px; font-weight: 600; color: #6b7a8d; }

/* ==========================================
   الإحصائيات
   ========================================== */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 12px; }

.stat-card {
    background: #ffffff; border: 1px solid #dde3ed; border-radius: 14px;
    padding: 20px; display: flex; align-items: center; gap: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.stat-card h3 { font-size: 28px; font-weight: 800; color: #1a2332; }
.stat-card p  { font-size: 12px; color: #8a96a8; margin-top: 2px; }
.stat-icon { font-size: 26px; }
.news-icon   { color: #3b82f6; }
.events-icon { color: #8b5cf6; }
.videos-icon { color: #10b981; }
.total-icon  { color: #f59e0b; }

/* ==========================================
   فلتر التبويبات
   ========================================== */
.filter-tabs { display: flex; gap: 6px; }
.filter-tab {
    padding: 7px 16px; border-radius: 8px;
    background: #ffffff; border: 1px solid #dde3ed;
    color: #6b7a8d; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s;
}
.filter-tab.active, .filter-tab:hover { background: #eff6ff; color: #0a6ebd; border-color: #bfdbfe; }

/* ==========================================
   شبكة البطاقات
   ========================================== */
.items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }

.empty-state { grid-column: 1/-1; text-align: center; padding: 60px 20px; color: #c0c8d4; }
.empty-state i { font-size: 48px; margin-bottom: 14px; display: block; }
.empty-state p { font-size: 14px; }

.item-card {
    background: #ffffff; border: 1px solid #dde3ed; border-radius: 14px;
    overflow: hidden; transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.item-card:hover { border-color: #93c5fd; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(10,110,189,0.1); }

.item-thumb {
    position: relative; height: 220px;
    display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.news-thumb   { background: linear-gradient(135deg, #dbeafe, #eff6ff); }
.events-thumb { background: linear-gradient(135deg, #ede9fe, #f5f3ff); }
.videos-thumb { background: linear-gradient(135deg, #d1fae5, #ecfdf5); }

.thumb-media,
.item-thumb video,
.item-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    max-height: 220px;
}
.thumb-icon  { font-size: 40px; opacity: 0.3; color: #94a3b8; }

.item-badge {
    position: absolute; top: 10px; right: 10px;
    padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 700;
}
.badge-news   { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-events { background: #ede9fe; color: #6d28d9; border: 1px solid #ddd6fe; }
.badge-videos { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }

.item-body { padding: 14px 16px 10px; }
.item-date { font-size: 11px; color: #aab3c0; margin-bottom: 6px; }
.item-body h4 {
    font-size: 14px; font-weight: 700; color: #1a2332; margin-bottom: 6px;
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.item-summary {
    font-size: 12px; color: #6b7a8d;
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* كارد الأخبار — بورتريت (الطول أكبر من العرض) */
.item-card[data-type="news"] {
    max-width: 280px;
}
.item-card[data-type="news"] .item-thumb {
    height: 290px;
}
.item-card[data-type="news"] .thumb-media {
    object-fit: contain;
    background: #f8fafc;
}

.item-actions { display: flex; gap: 8px; padding: 10px 16px 14px; }
.btn-edit, .btn-delete {
    flex: 1; padding: 8px; border-radius: 8px; font-size: 12px; font-weight: 600;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    gap: 5px; transition: all 0.2s;
}
.btn-edit   { background: #eff6ff; color: #0a6ebd; border: 1px solid #bfdbfe; }
.btn-delete { background: #fff5f5; color: #dc2626; border: 1px solid #fecaca; }
.btn-edit:hover   { background: #dbeafe; }
.btn-delete:hover { background: #fee2e2; }

/* ==========================================
   نموذج الإضافة
   ========================================== */
.media-form {
    background: #ffffff; border: 1px solid #dde3ed; border-radius: 18px;
    padding: 32px; max-width: 680px; box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}

.form-section { margin-bottom: 24px; }
.section-label {
    display: block; font-size: 12px; font-weight: 700; color: #aab3c0;
    text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 12px;
}

.type-selector { display: flex; gap: 10px; }
.type-opt { flex: 1; cursor: pointer; }
.type-opt input { display: none; }
.type-opt span {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    padding: 12px; border-radius: 10px; background: #f5f7fa;
    border: 2px solid #e2e8f0; color: #8a96a8; font-size: 14px; font-weight: 600; transition: all 0.2s;
}
.type-opt.selected span, .type-opt:hover span {
    background: #eff6ff; border-color: #0a6ebd; color: #0a6ebd;
}

.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: #3d4f63; margin-bottom: 8px; }
.req { color: #dc2626; }

.form-group input,
.form-group textarea {
    width: 100%; padding: 12px 14px; background: #f5f7fa;
    border: 1px solid #dde3ed; border-radius: 10px; color: #1a2332;
    font-size: 14px; outline: none; transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit; resize: vertical;
}
.form-group input:focus,
.form-group textarea:focus { border-color: #0a6ebd; box-shadow: 0 0 0 3px rgba(10,110,189,0.08); background: #fff; }
.form-group input[type="month"] { color-scheme: light; }

/* شبكة معاينة الصور المرفوعة */
.multi-preview-grid {
    display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px;
}
.preview-thumb {
    position: relative; width: 90px; height: 90px;
    border-radius: 10px; overflow: hidden;
    border: 1px solid #dde3ed; background: #f5f7fa;
    flex-shrink: 0;
}
.preview-thumb-media {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.preview-remove-btn {
    position: absolute; top: 4px; right: 4px;
    width: 22px; height: 22px; border-radius: 50%;
    background: rgba(220,50,50,0.85); border: none; color: #fff;
    font-size: 11px; cursor: pointer; display: flex;
    align-items: center; justify-content: center;
    transition: background 0.2s;
}
.preview-remove-btn:hover { background: #dc2626; }
.preview-play-icon {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
    color: rgba(255,255,255,0.9); font-size: 22px; pointer-events: none;
}

/* منطقة الرفع */
.upload-zone {
    border: 2px dashed #c8d3e0; border-radius: 12px; padding: 36px 20px;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    cursor: pointer; transition: all 0.2s; text-align: center; background: #f8fafc;
}
.upload-zone:hover, .upload-zone.drag-over { border-color: #0a6ebd; background: #eff6ff; }
.upload-zone i { font-size: 36px; color: #93c5fd; }
.upload-zone p { font-size: 14px; color: #6b7a8d; }
.upload-zone small { font-size: 11px; color: #aab3c0; }
.upload-browse { color: #0a6ebd; text-decoration: underline; cursor: pointer; }

.upload-preview {
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    padding: 16px; background: #f8fafc; border: 1px solid #dde3ed; border-radius: 12px;
}
#preview-img   { max-height: 200px; max-width: 100%; border-radius: 8px; object-fit: contain; }
#preview-video { max-height: 200px; max-width: 100%; border-radius: 8px; }
#remove-file-btn {
    background: #fff5f5; border: 1px solid #fecaca; color: #dc2626;
    padding: 7px 16px; border-radius: 8px; font-size: 12px; font-weight: 500;
    cursor: pointer; display: flex; align-items: center; gap: 6px;
}
#remove-file-btn:hover { background: #fee2e2; }

.upload-progress { margin-top: 10px; }
.progress-bar { height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; margin-bottom: 6px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #0a6ebd, #00b4d8); border-radius: 3px; transition: width 0.2s; }
#progress-text { font-size: 12px; color: #8a96a8; }

/* أزرار النموذج */
.form-actions { display: flex; gap: 12px; margin-top: 28px; }

.btn-save {
    padding: 13px 28px; background: linear-gradient(90deg, #0a6ebd, #00b4d8);
    border: none; border-radius: 10px; color: #fff; font-size: 14px; font-weight: 700;
    cursor: pointer; display: flex; align-items: center; gap: 8px;
    transition: opacity 0.2s; box-shadow: 0 4px 14px rgba(10,110,189,0.25);
}
.btn-save:hover { opacity: 0.92; }
.btn-save:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-cancel {
    padding: 13px 20px; background: #f5f7fa; border: 1px solid #dde3ed;
    border-radius: 10px; color: #6b7a8d; font-size: 14px; font-weight: 500;
    cursor: pointer; display: flex; align-items: center; gap: 8px; transition: all 0.2s;
}
.btn-cancel:hover { background: #eef2f7; color: #1a2332; }

.form-msg { margin-top: 14px; padding: 10px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.form-msg.success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.form-msg.error   { background: #fff5f5; color: #dc2626; border: 1px solid #fecaca; }

/* ==========================================
   رسائل التواصل
   ========================================== */
.messages-list { display: flex; flex-direction: column; gap: 16px; }

.msg-card {
    background: #fff; border: 1px solid #dde3ed; border-radius: 14px;
    padding: 20px 24px; transition: box-shadow 0.2s;
}
.msg-card.unread {
    border-right: 4px solid #0a6ebd; background: #f5f9ff;
}
.msg-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.07); }

.msg-card-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 10px; gap: 12px; flex-wrap: wrap;
}
.msg-sender { display: flex; flex-direction: column; gap: 3px; }
.msg-name { font-size: 15px; font-weight: 700; color: #1a2332; }
.msg-email { font-size: 12px; color: #8a96a8; }
.msg-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.msg-date { font-size: 12px; color: #aab3c0; }
.unread-dot {
    background: #0a6ebd; color: #fff; font-size: 10px;
    padding: 2px 9px; border-radius: 10px; font-weight: 700;
}
.msg-subject { font-size: 14px; font-weight: 700; color: #0a6ebd; margin-bottom: 8px; }
.msg-body {
    font-size: 13px; color: #4a5568; line-height: 1.65;
    padding: 12px 14px; background: #f5f7fa; border-radius: 8px; margin-bottom: 14px;
    white-space: pre-wrap; word-break: break-word;
}
.msg-actions { display: flex; gap: 10px; justify-content: flex-end; }

.btn-mark-read {
    background: #e8f4ff; color: #0a6ebd; border: 1px solid #bee3f8;
    border-radius: 8px; padding: 6px 14px; font-size: 12px; cursor: pointer;
    font-weight: 600; transition: background 0.2s;
}
.btn-mark-read:hover { background: #cce8ff; }

/* شارة عدد الرسائل في الشريط الجانبي */
.msg-nav-badge {
    background: #dc2626; color: #fff; font-size: 10px; padding: 2px 7px;
    border-radius: 10px; font-weight: 700; margin-right: 6px;
}

/* أيقونة الرسائل */
.stat-card .messages-icon { color: #7c3aed; }
