/* ============================================== */
/* 0. متغيرات CSS (Themes & Fonts) */
/* ============================================== */
:root {
    /* الخط الأساسي */
    --main-font: 'Cairo', Tahoma, Geneva, Verdana, sans-serif;

    /* الوضع الافتراضي (الوضع الليلي/الأزرق - Dark Mode) */
    --main-bg-color-fallback: #161B22; /* لون احتياطي للخلفية */
    --accent-color: #e85c56; /* *** تعديل: لون أساسي جديد *** */
    --secondary-accent: #f27a24; /* *** تعديل: لون ثانوي جديد *** */
    --text-color: #C9D1D9;
    --text-muted: #8B949E;
    --bg-overlay: rgba(13, 17, 23, 0.75); 
    --container-bg: rgba(22, 27, 34, 0.8);
    --link-bg: rgba(33, 38, 45, 0.9);
    --link-text: var(--text-color);
    --link-hover-bg: rgba(var(--accent-rgb), 0.15);
    --link-hover-text: var(--accent-color);
    --contact-bg: rgba(33, 38, 45, 0.7);
    --contact-text: var(--text-color);
    --contact-hover-bg: rgba(var(--accent-rgb), 0.1);
    --contact-hover-text: var(--accent-color);
    --footer-text: var(--text-muted);
    --control-bg: var(--accent-color);
    --control-text: #ffffff; /* *** تعديل: صار أبيض لتباين أفضل *** */
    --border-color: rgba(255, 255, 255, 0.15);
    --shadow-color: rgba(0, 0, 0, 0.5);

    /* --- المسار الافتراضي لخلفية الجسم --- */
    /* *** ضع رابط صورتك هنا *** */
    --body-bg-url: url('assets/images/bg.jpg');

    /* متغيرات RGB */
    --accent-rgb: 232, 92, 86; /* *** تعديل: RGB للون e85c56 *** */
    --text-color-rgb: 201, 209, 217;
}

body.light-mode {
    /* الوضع النهاري (Light Mode) */
    --main-bg-color-fallback: #f4f7f6;
    --accent-color: #df1279; /* *** تعديل: لون أساسي فاتح جديد *** */
    --secondary-accent: #f27a24; /* *** تعديل: لون ثانوي فاتح جديد *** */
    --text-color: #24292F;
    --text-muted: #57606A;
    --bg-overlay: rgba(255, 255, 255, 0.7); 
    --container-bg: rgba(255, 255, 255, 0.9);
    --link-bg: #f0f2f5;
    --link-text: var(--text-color);
    --link-hover-bg: rgba(var(--accent-rgb), 0.1);
    --link-hover-text: var(--accent-color);
    --contact-bg: #e9ecef;
    --contact-text: var(--text-color);
    --contact-hover-bg: rgba(var(--accent-rgb), 0.08);
    --contact-hover-text: var(--accent-color);
    --footer-text: var(--text-muted);
    --control-bg: var(--accent-color);
    --control-text: #ffffff;
    --border-color: rgba(0, 0, 0, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.15);

    /* --- (تحديث اختياري) خلفية مختلفة للوضع الفاتح --- */
    /* --body-bg-url: url('../assets/images/light-background.jpg'); */

    /* متغيرات RGB للوضع الفاتح */
    --accent-rgb: 223, 18, 121; /* *** تعديل: RGB للون df1279 *** */
    --text-color-rgb: 36, 41, 47;
}

/* ============================================== */
/* 1. إعدادات عامة (Global) & Preloader */
/* ============================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--main-font);
    background-image: var(--body-bg-url);
    background-color: var(--main-bg-color-fallback); /* لون احتياطي */
    background-repeat: no-repeat;
    background-position: center center;
    background-attachment: fixed;
    background-size: cover;
    color: var(--text-color);
    direction: rtl;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative; /* ضروري لـ ::before */
    transition: background-color 0.4s ease, color 0.4s ease;
}

body::before {
    content: "";
    position: fixed;
    inset: 0; /* يغطي الشاشة كاملة */
    background-color: var(--bg-overlay); /* لون التراكب */
    backdrop-filter: blur(8px); /* البلور المطلوب */
    -webkit-backdrop-filter: blur(8px);
    z-index: 0; /* خلف الحاوية وفوق صورة body */
    transition: background-color 0.4s ease, backdrop-filter 0.4s ease;
}

/* --- شاشة التحميل --- */
#preloader {
    position: fixed;
    inset: 0;
    background-color: var(--main-bg-color-fallback); /* استخدام اللون الاحتياطي */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.6s ease-out 0.2s, visibility 0.6s ease-out 0.2s;
    opacity: 1;
    visibility: visible;
}
#preloader.hidden {
    opacity: 0;
    visibility: hidden;
}
.loader-logo img {
    width: 150px;
    height: auto;
    animation: pulse-loader 1.8s ease-in-out infinite alternate;
    margin-bottom: 25px;
    object-fit: contain; /* *** إضافة: لضمان ظهور اللوغو جيداً *** */
}

/* --- (*** تعديل: تم حذف الكود الخاص بقلب لون اللوغو ***) --- */

.loader-dots { display: flex; gap: 12px; }
.loader-dots .dot {
    width: 12px;
    height: 12px;
    background-color: var(--accent-color);
    border-radius: 50%;
    animation: bounce-loader 1.4s infinite ease-in-out both;
}
.loader-dots .dot:nth-child(1) { animation-delay: -0.32s; }
.loader-dots .dot:nth-child(2) { animation-delay: -0.16s; }
.loader-dots .dot:nth-child(3) { animation-delay: 0s; }

@keyframes pulse-loader {
    from { transform: scale(1); opacity: 0.7; }
    to { transform: scale(1.08); opacity: 1; }
}
@keyframes bounce-loader {
  0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
  40% { transform: scale(1.0); opacity: 1; }
}
/* --- نهاية شاشة التحميل --- */

/* ============================================== */
/* 2. الحاوية الرئيسية & العناصر الأساسية */
/* ============================================== */
.container {
    position: relative;
    z-index: 1; /* فوق ::before */
    max-width: 650px;
    width: 100%;
    background-color: var(--container-bg);
    padding: 35px 45px;
    border-radius: 25px;
    box-shadow: 0 10px 35px var(--shadow-color);
    text-align: center;
    transition: background-color 0.4s ease, box-shadow 0.4s ease;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px); 
    -webkit-backdrop-filter: blur(10px);
}

.profile-image {
    width: 160px;
    height: auto;
    border-radius: 0;
    margin: 0 auto 25px auto;
    object-fit: contain;
    border: none;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
    transition: transform 0.3s ease;
    
}
/* --- (*** تعديل: تم حذف الكود الخاص بقلب لون اللوغو ***) --- */

.profile-image:hover {
    transform: scale(1.05);
}


.title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-color);
    cursor: pointer;
    transition: color 0.3s ease, text-shadow 0.3s ease;
    margin-bottom: 30px;
    user-select: none;
    text-shadow: 0 2px 5px rgba(0,0,0,0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}
.title:hover {
    color: var(--secondary-accent);
    text-shadow: 0 0 10px var(--secondary-accent);
}

/* ============================================== */
/* 3. أزرار الروابط */
/* ============================================== */
.link-button {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    background-color: var(--link-bg);
    color: var(--link-text);
    text-decoration: none;
    padding: 15px 22px;
    margin: 12px 0;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s forwards ease-out;
}

[dir="ltr"] .link-button { justify-content: flex-start; }

.container > a.link-button:nth-of-type(1) { animation-delay: 0.1s; }
.container > a.link-button:nth-of-type(2) { animation-delay: 0.15s; }
.container > a.link-button:nth-of-type(3) { animation-delay: 0.2s; }
.container > a.link-button:nth-of-type(4) { animation-delay: 0.25s; }
.container > a.link-button:nth-of-type(5) { animation-delay: 0.3s; }
.container > a.link-button:nth-of-type(6) { animation-delay: 0.35s; }


.link-button i {
    margin-left: 15px;
    font-size: 1.5rem;
    color: var(--accent-color);
    min-width: 35px;
    text-align: center;
    transition: color 0.3s ease, transform 0.3s ease;
}
[dir="ltr"] .link-button i { margin-left: 0; margin-right: 15px; }

.link-button:hover {
    background-color: var(--link-hover-bg);
    color: var(--link-hover-text);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 18px rgba(0,0,0,0.3);
}
.link-button:hover i {
    color: var(--secondary-accent);
    transform: scale(1.1) rotate(-5deg);
}

@keyframes fadeInUp {
    to { opacity: 1; transform: translateY(0); }
}

/* أنيميشن النقر */
@keyframes click-feedback {
    0% { transform: scale(1); }
    50% { transform: scale(0.96); filter: brightness(0.9); }
    100% { transform: scale(1); filter: brightness(1); }
}
.animate-click {
    animation: click-feedback 0.3s ease-out;
}

/* ============================================== */
/* 4. قسم الاتصال والموقع */
/* ============================================== */
.contact, .location {
    margin-top: 40px;
    text-align: right;
}
[dir="ltr"] .contact, [dir="ltr"] .location { text-align: left; }

.contact h3, .location h3 {
    font-size: 1.8rem;
    color: var(--accent-color);
    margin-bottom: 20px;
    font-weight: 700;
    transition: color 0.3s ease;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
    display: inline-block;
}

/* --- (*** إضافة: كلاسات جديدة للفروع ***) --- */
.contact .branch {
    margin-bottom: 25px; /* Add space between branches */
}

.contact h4 {
    font-size: 1.3rem;
    color: var(--secondary-accent); /* Use the new secondary color */
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border-color);
    text-align: right; /* Match parent */
}
[dir="ltr"] .contact h4 { text-align: left; }
/* --- (*** نهاية الإضافة ***) --- */


.contact a {
    display: block;
    background-color: var(--contact-bg);
    padding: 14px 18px;
    border-radius: 12px;
    margin: 8px 0;
    font-size: 1.1rem;
    color: var(--contact-text);
    text-decoration: none;
    font-weight: 700;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
    direction: ltr;
    text-align: center;
}

.contact a i {
    margin-right: 10px;
    color: var(--accent-color);
    transition: color 0.3s ease;
}

.contact a:hover {
    background-color: var(--contact-hover-bg);
    color: var(--contact-hover-text);
    transform: scale(1.03);
}
.contact a:hover i {
    color: var(--secondary-accent);
}

.location iframe {
    width: 100%;
    height: 300px;
    border: 0;
    border-radius: 18px;
    box-shadow: 0 6px 20px var(--shadow-color);
    margin-bottom: 20px;
}

/* --- (*** إضافة: كلاس لوصف الموقع ***) --- */
.location p.location-description {
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 10px;
    text-align: right;
}
[dir="ltr"] .location p.location-description {
    text-align: left;
}
/* --- (*** نهاية الإضافة ***) --- */


.location .map-link {
    background-color: var(--secondary-accent);
    color: #000;
    font-weight: 700;
    justify-content: center;
    margin-top: 10px;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s forwards ease-out;
    animation-delay: 0.4s;
}
body.light-mode .location .map-link {
    color: #fff;
}

.location .map-link:hover {
    background-color: var(--accent-color);
    color: var(--control-text);
}
.location .map-link i {
    color: inherit;
}


/* ============================================== */
/* 5. التذييل ورصيد LINKEY */
/* ============================================== */
.footer {
    margin-top: 50px;
    font-size: 0.9rem;
    color: var(--footer-text);
    font-weight: 600;
    user-select: none;
    transition: color 0.3s ease;
}

.footer .copyright {
    margin-bottom: 15px;
}

.powered-by-linkey {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    transition: border-color 0.4s ease;
}
.powered-by-linkey a {
    font-family: var(--main-font);
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    opacity: 0.75;
    transition: opacity 0.3s ease, color 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.powered-by-linkey a:hover {
    opacity: 1;
    color: var(--accent-color);
}
.linkey-credit-logo {
    width: 65px;
    height: 65px;
    vertical-align: middle;
    transition: filter 0.3s ease;
}
body.light-mode .linkey-credit-logo {
     filter: invert(1);
}
/* body:not(.light-mode) .linkey-credit-logo { filter: invert(1) brightness(0.9); } */


/* ============================================== */
/* 6. أزرار التحكم (اللغة والثيم) */
/* ============================================== */
.controls-container {
    position: fixed;
    top: 25px;
    left: 25px;
    z-index: 10;
    display: flex;
    gap: 12px;
}
[dir="rtl"] .controls-container { left: auto; right: 25px; }

.control-button {
    background: var(--control-bg);
    color: var(--control-text);
    border: none;
    width: 55px;
    height: 55px;
    border-radius: 16px;
    cursor: pointer;
    font-weight: 700;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    user-select: none;
    font-size: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.control-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
    filter: brightness(1.1);
}
.control-button:active {
    transform: scale(0.95);
    filter: brightness(0.9);
}

#theme-toggle .fa-sun { display: none; }
body.light-mode #theme-toggle .fa-sun { display: block; }
body.light-mode #theme-toggle .fa-moon { display: none; }

/* --- كلاس علامة التوثيق --- */
.verified-badge {
    font-size: 1.9rem; /* حجم العلامة (أصغر من الاسم) */
    color: #1DA1F2 !important; /* لون أزرق التوثيق */

    /* تأثير ظل خفيف حتى تبرز */
    filter: none;

    /* نلغي أي تأثيرات هوفر من كلاس .title */
    transition: none; 
    text-shadow: none;
}
/* ============================================== */
/* 7. التجاوب (Responsive Design) */
/* ============================================== */

/* أ. شاشات الجوال (أصغر من 600px) */
@media (max-width: 599px) {
    body { padding: 15px; }

    .container { padding: 25px 20px; border-radius: 15px; }
    .profile-image { width: 120px; margin-bottom: 20px; }
    
    /* *** تعديل: إضافة gap وتقليل حجم الخط *** */
    .title { 
        font-size: 1.8rem; 
        margin-bottom: 20px; 
        gap: 8px; /* مسافة أقل بين الاسم والعلامة في الموبايل */
    }

    /* *** إضافة: تصغير العلامة الزرقاء في الموبايل *** */
    .verified-badge {
        font-size: 1.4rem;
    }

    .link-button { padding: 12px 15px; font-size: 1rem; border-radius: 10px; }
    .link-button i { font-size: 1.2rem; margin-left: 10px; min-width: 25px; }
    [dir="ltr"] .link-button i { margin-left: 0; margin-right: 10px; }
    .contact h3, .location h3 { font-size: 1.5rem; margin-bottom: 15px; }
    .contact h4 { font-size: 1.1rem; } /* *** إضافة: تجاوب للعناوين الفرعية *** */
    .contact a { padding: 10px 14px; font-size: 1rem; border-radius: 8px; }
    .location iframe { height: 200px; border-radius: 10px; }
    .location p.location-description { font-size: 1rem; } /* *** إضافة: تجاوب لوصف الموقع *** */
    .location .map-link { padding: 12px 15px; font-size: 1rem; }
    .footer { margin-top: 35px; font-size: 0.8rem; }
    .powered-by-linkey a { font-size: 0.75rem; }
    .linkey-credit-logo { width: 50px; height: 50px; }
    .controls-container { top: 15px; left: 15px; gap: 8px; }
    [dir="rtl"] .controls-container { left: auto; right: 15px; }
    .control-button { width: 45px; height: 45px; font-size: 0.9rem; border-radius: 10px; }
}

/* ب. شاشات التابلت (بين 600px و 900px) */
@media (min-width: 600px) and (max-width: 899px) {
    .container { max-width: 85vw; padding: 30px 35px; }
    .profile-image { width: 140px; }
    .title { font-size: 2.2rem; }

    /* *** إضافة: ضبط حجم العلامة للتابلت *** */
    .verified-badge {
        font-size: 1.7rem;
    }

    .contact h3, .location h3 { font-size: 1.6rem; }
    .contact h4 { font-size: 1.2rem; } /* *** إضافة: تجاوب للعناوين الفرعية *** */
    .location iframe { height: 250px; }
}