/* إعادة تعيين الأساسيات والخطوط */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #ffffff;
    --text-secondary: #e0e0e0;
    --accent-color: #2c3e50;
    --gold-color: #d4af37;
    --shadow-soft: 0 4px 15px rgba(0, 0, 0, 0.3);
    --shadow-medium: 0 8px 30px rgba(0, 0, 0, 0.4);
    --border-radius: 12px;
    --transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

body {
    font-family: 'Tajawal', sans-serif;
    line-height: 1.7;
    color: var(--primary-color);
    background-color: #1a1a1a;
    background-image: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), url('img.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

/* فئات مساعدة */
.hidden {
    display: none !important;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}


/* الحاويات الرئيسية */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* رأس الصفحة */
.site-header {
    padding: 2rem 0;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    transition: var(--transition);
}

.site-header.scrolled {
    padding: 20px 0;
    background: rgba(10, 10, 10, 0.5);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow-soft);
}
.header-container {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    transition: var(--transition);
}

/* عنوان الموقع */
.header-content {
    text-align: center;
    transition: var(--transition);
}
.site-header.scrolled .header-content {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    text-align: right;
}
.main-title {
    font-family: 'Amiri', serif;
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 700;
    color: var(--primary-color);
    text-shadow: 0 3px 8px rgba(0, 0, 0, 0.7);
    transition: var(--transition);
}
.site-header.scrolled .main-title {
    font-size: 1.25rem;
    text-shadow: none;
}
.subtitle {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    color: var(--gold-color);
    font-weight: 500;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.7);
    transition: opacity 0.3s, transform 0.3s;
    opacity: 1;
}
.site-header.scrolled .subtitle {
    opacity: 0;
    transform: translateY(-10px);
    height: 0;
    margin: 0;
    pointer-events: none;
}

/* أزرار الهيدر */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: absolute;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    transition: var(--transition);
}

.add-martyr-btn {
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    background: rgba(44, 62, 80, 0.7);
    color: white;
    text-decoration: none;
}
.add-martyr-btn:hover {
    background: var(--accent-color);
    transform: translateY(-2px);
}
.add-martyr-btn .icon {
    width: 16px;
    height: 16px;
}

.site-header.scrolled .add-martyr-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    border-radius: 15px;
}

/* المحتوى الرئيسي */
.main-content {
    padding-top: 350px;
    padding-bottom: 4rem;
    transition: padding-top 0.4s;
}
.site-header.scrolled ~ .main-content {
    padding-top: 160px;
}

/* قسم البحث */
.search-section {
    margin-bottom: 3.5rem;
}
.search-container {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(15px);
    border-radius: 50px;
    padding: 8px;
    box-shadow: var(--shadow-medium);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
}
.search-input {
    width: 100%;
    padding: 0.8rem 1.5rem;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: var(--primary-color);
    outline: none;
    direction: rtl;
    text-align: right;
    font-family: 'Tajawal', sans-serif;
    line-height: 1.5;
}
.search-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.8;
}
.search-buttons {
    display: flex;
    gap: 8px;
    padding-left: 8px;
}
.search-button, .clear-search-btn {
    background: var(--accent-color);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    color: white;
}
.search-button:hover, .clear-search-btn:hover {
    background: var(--gold-color);
    color: var(--accent-color);
}
.clear-search-btn {
    background: #6c757d;
}
.search-buttons .icon {
    width: 20px;
    height: 20px;
}

/* معرض الشهداء */
.gallery-section {
    position: relative;
}
.martyrs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2.5rem; 
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 2.5rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* بطاقة الشهيد */
.martyr-card {
    background: rgba(20, 20, 20, 0.4);
    backdrop-filter: blur(15px);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    cursor: pointer;
}
.martyr-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-medium);
}

.martyr-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    background-color: rgba(0,0,0,0.3);
}

.martyr-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.martyr-card:hover .martyr-image {
    transform: scale(1.05);
}

/* --- جديد: طبقة التفاصيل الإضافية --- */
.martyr-details-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(5px);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none; /* للسماح بالمرور فوقها */
}

/* --- جديد: إظهار الطبقة عند التمرير أو عند وجود الكلاس --- */
.martyr-card:hover .martyr-details-overlay,
.martyr-card.details-visible .martyr-details-overlay {
    opacity: 1;
    pointer-events: all; /* تفعيل الأحداث عند ظهورها */
}

.overlay-content {
    text-align: center;
}

.overlay-content h4 {
    font-family: 'Amiri', serif;
    font-size: 1.2rem;
    color: var(--gold-color);
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--gold-color);
    padding-bottom: 0.5rem;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.detail-item span:first-child {
    font-weight: 600;
    color: var(--text-secondary);
}

.martyr-content {
    padding: 1.25rem;
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.martyr-name {
    font-family: 'Amiri', serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}
.martyr-place {
    font-size: 0.95rem;
    color: var(--gold-color);
}

/* زر تحميل المزيد */
.load-more-container {
    text-align: center;
    margin-top: 3rem;
}
.load-more-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-soft);
}
.load-more-btn:hover {
    background: var(--gold-color);
    color: var(--accent-color);
    transform: translateY(-3px);
}

/* حالات خاصة (تحميل، فارغ، خطأ) */
.loading-container, .empty-state, .error-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--gold-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}
@keyframes spin { 100% { transform: rotate(360deg); } }
.empty-state h3, .error-state h3 {
    font-family: 'Amiri', serif;
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}
.retry-btn { /* Style for the retry button */
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 1rem;
}
.retry-btn:hover {
    background: var(--gold-color);
    color: var(--accent-color);
}

/* ذيل الصفحة */
.site-footer {
    background: rgba(10, 10, 10, 0.6);
    backdrop-filter: blur(15px);
    color: var(--text-secondary);
    text-align: center;
    padding: 2.5rem 0;
    margin-top: 4rem;
    border-top: 1px solid rgba(212, 175, 55, 0.3);
}
.footer-content h3 {
    font-family: 'Amiri', serif;
    font-size: 1.2rem;
    font-weight: normal;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    line-height: 1.8;
}
.footer-verse {
    font-size: 0.9rem;
    color: var(--gold-color);
}

/* رسائل الحالة */
.status-message {
    max-width: 600px;
    margin: -2rem auto 2.5rem;
    padding: 1rem;
    border-radius: var(--border-radius);
    text-align: center;
    font-weight: 500;
    font-size: 0.9rem;
    transition: opacity 0.3s, transform 0.3s;
}
.status-message.hidden { display: none; }
.status-message.success { background: rgba(39, 174, 96, 0.2); color: #2ecc71; border: 1px solid #27ae60; }
.status-message.error { background: rgba(231, 76, 60, 0.2); color: #e74c3c; border: 1px solid #c0392b; }

/* تصميم متجاوب */
@media (max-width: 768px) {
    .site-header.scrolled {
        padding: 15px 0;
    }
    .site-header.scrolled .header-content {
        position: static;
        transform: none;
        text-align: center;
        margin-bottom: 0.75rem;
    }
    .site-header.scrolled .header-actions {
        position: static;
        transform: none;
        justify-content: center;
        width: 100%;
    }
    .header-container {
        flex-direction: column;
    }
    .main-content {
        padding-top: 250px;
    }
    .site-header.scrolled ~ .main-content {
        padding-top: 180px;
    }
    .martyrs-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        padding: 1.5rem;
    }
}
@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    .main-content {
        padding-top: 230px;
    }
    .header-actions {
        gap: 0.5rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    .add-martyr-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
    }
    .martyrs-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1rem;
    }
}
