@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&family=Cairo:wght@400;700&display=swap');

:root {
    --primary: #07a081;
    --primary-hover: #05856d;
    --bg-body: #ffffff;
    --bg-surface: #f8f9fa;
    --text-main: #1a1a1a;
    --text-muted: #666;
    --border-color: #eee;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

[data-theme="dark"] {
    --bg-body: #121212;
    --bg-surface: #1e1e1e;
    --text-main: #ffffff;
    --text-muted: #a0a0a0;
    --border-color: #333;
}

body {
    font-family: 'Inter', 'Cairo', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    transition: background-color 0.5s ease, color 0.5s ease;
    overflow-x: hidden;
}

/* =========================================
   تحديثات الانيميشن (النسخة المنقحة)
   ========================================= */

/* 1. القواعد العامة للحركة الانسيابية */
.btn, .nav-link, .dropdown-item, .theme-toggle, a.fw-bold {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    position: relative;
}

/* 2. الأزرار الأساسية (Upload, Explore) */
.btn-primary {
    background-color: var(--primary);
    border: none;
    box-shadow: 0 4px 6px rgba(7, 160, 129, 0.2);
    transform: translateY(0);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px); /* ارتفاع بسيط ومقبول */
    box-shadow: 0 6px 15px rgba(7, 160, 129, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

/* 3. زر Join (الأبيض) وزر Login */
/* زر Join */
a[href="register.php"].btn {
    box-shadow: 0 4px 10px rgba(0,0,0,0.1); 
}
a[href="register.php"].btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15); /* ظل ناعم */
    background-color: #fff; /* ضمان بقاء الخلفية بيضاء */
}

/* رابط Login */
a[href="login.php"] {
    display: inline-block; /* ضروري لعمل التحويل */
}
a[href="login.php"]:hover {
    transform: translateY(-2px);
    opacity: 0.8; /* تغيير بسيط في الشفافية بدلاً من التوهج */
}

/* 4. زر تحويل الوضع (القمر/الشمس) */
#themeToggle {
    display: inline-block;
}
#themeToggle:hover {
    transform: rotate(20deg) scale(1.1); /* دوران بسيط مع تكبير طفيف */
    color: var(--primary); /* تلوين الأيقونة عند الوقوف عليها */
}

/* 5. روابط النافبار (Home, Explore...) */
.navbar-nav .nav-link {
    font-weight: 500;
}

/* الخط المتحرك أسفل الرابط */
.navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background-color: var(--primary);
    transition: width 0.3s ease;
    box-shadow: none; /* إزالة التوهج */
}

.navbar-nav .nav-link:hover::after {
    width: 80%;
}

.navbar-nav .nav-link:hover {
    transform: translateY(-2px);
    text-shadow: none; /* تم إزالة التوهج نهائياً لحل مشكلة اختفاء النص */
}

/* 6. زر البحث (العدسة) - تعديل لتصغير الحركة */
.search-box-large button {
    transition: transform 0.3s ease !important;
}
.search-box-large button:hover {
    transform: scale(1.08); /* تكبير بسيط جداً بدلاً من 1.15 */
    /* تم إلغاء الدوران */
}

/* --- Hero Section --- */
.hero-section {
    position: relative;
    height: 85vh;
    min-height: 550px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-top: -80px;
}

.hero-slideshow {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0;
}

.hero-slide {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 1.5s ease-in-out, transform 6s ease;
}

.hero-slide.active { opacity: 1; transform: scale(1.05); }

.hero-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(180deg, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.6) 100%);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 900px;
    padding: 20px;
    text-align: center;
    padding-top: 120px; 
}

.hero-title {
    font-size: clamp(1.8rem, 5vw, 3rem);
    font-weight: 800;
    margin-bottom: 1.5rem;
    text-shadow: 0 4px 20px rgba(0,0,0,0.4);
    color: #fff;
}

/* --- Search Box --- */
.search-box-large {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    padding: 6px 10px 6px 25px;
    display: flex;
    align-items: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    max-width: 750px;
    margin: 0 auto;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.search-box-large:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    border: 1px solid rgba(7, 160, 129, 0.3);
}

.search-box-large input {
    border: none;
    padding: 12px 0;
    font-size: 1.1rem;
    background: transparent;
    flex: 1;
    outline: none;
}

/* أزرار التاجات تحت البحث */
.hero-content .btn-outline-light {
    border-width: 1px;
    backdrop-filter: blur(5px);
}
.hero-content .btn-outline-light:hover {
    transform: translateY(-2px);
    background-color: #fff;
    color: var(--primary);
    border-color: #fff;
}

/* --- Gallery & Image Cards --- */
.masonry-grid {
    column-count: 3;
    column-gap: 24px;
}

.image-card {
    position: relative;
    margin-bottom: 24px;
    border-radius: 12px;
    overflow: hidden;
    break-inside: avoid;
    transition: var(--transition);
}

.image-card img {
    width: 100%;
    display: block;
    transition: transform 0.5s;
}

.quick-actions {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 8px;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-card:hover .quick-actions {
    opacity: 1;
}

.btn-icon {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    cursor: pointer;
    text-decoration: none;
    transition: 0.2s;
}

.btn-icon:hover { 
    background: #fff; 
    color: var(--primary); 
    transform: scale(1.1);
}

.card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 4;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-card:hover .card-overlay {
    opacity: 1;
}

.image-card:hover img {
    transform: scale(1.05);
}

/* --- Utilities --- */
.text-white { color: #fff !important; }

@media (max-width: 992px) { .masonry-grid { column-count: 2; } }
@media (max-width: 576px) { .masonry-grid { column-count: 1; } }

/* 1. تصميم كبسولة البروفايل (Profile Chip) */
.profile-chip {
    background: var(--bg-surface);
    border: 1px solid var(--border-color) !important;
    padding: 4px 12px 4px 4px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    transition: var(--transition);
    color: var(--text-main);
}
.profile-chip:hover {
    background: var(--bg-body);
    border-color: var(--primary) !important;
    transform: translateY(-2px);
}
.profile-chip::after { display: none; } /* إخفاء سهم بوتستراب */

.avatar-img {
    width: 32px; height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--bg-body);
}

/* 2. انميشن وتنسيق القائمة المنسدلة */
.modern-dropdown {
    border-radius: 16px !important;
    padding: 10px !important;
    min-width: 220px;
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-color) !important;
    animation: dropIn 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

@keyframes dropIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modern-dropdown .dropdown-item {
    border-radius: 10px;
    padding: 10px 15px;
    color: var(--text-main) !important;
    font-weight: 500;
    transition: 0.2s;
}
.modern-dropdown .dropdown-item:hover {
    background-color: var(--primary) !important;
    color: white !important;
    transform: translateX(5px);
}

/* 3. إصلاح الهيدر للجوال (لضمان بقاء الأيقونات في سطر واحد) */
@media (max-width: 991px) {
    .navbar-collapse {
        background: var(--bg-surface);
        margin: 15px -20px -15px -20px;
        padding: 25px;
        border-top: 1px solid var(--border-color);
    }
}