/* ===== RESET ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Cairo", sans-serif;
}

/* =================================
   ✅ أساسيات الصفحة
================================= */
html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

body {
    background: #f7f7f7;
    color: #222;
    transition: 0.3s;
    min-height: 100svh;
}

/* ===== DARK MODE ===== */
body.dark {
    background: #0d0d0d;
    color: #eee;
}

/* =================================
   ✅ HEADER
================================= */
.header {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 18px 40px;
    display: flex;
    align-items: center;
    gap: 15px;
    backdrop-filter: blur(10px);
    z-index: 1000;
}

.header.scrolled {
    background: rgba(0,0,0,0.1);
}

.header .logo {
    width: 60px;
}

.title {
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(90deg, #b8844f, #8a5e3b);
    -webkit-background-clip: text;
    color: transparent;
}

/* =================================
   ✅ SIDEBAR
================================= */
.sidebar a {
    display: flex;
    align-items: center;
    justify-content: space-between;

    text-decoration: none;
    color: #333;

    padding: 14px 16px;

    height: 48px;          /* ✅ هذا اللي يوحّد الحجم */
    min-height: 48px;

    margin-bottom: 10px;

    background: #f0e6d8;
    border-radius: 10px;

    transition: 0.3s;
    font-size: 14px;
}

body.dark .sidebar {
    background: #111;
}

/* Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}
.sidebar::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #C58A5C, #8A5E3B);
    border-radius: 10px;
}

/* RTL / LTR */
body.rtl .sidebar { right: 0; left: unset; }
body.ltr .sidebar { left: 0; right: unset; }

/* =================================
   ✅ MAIN
================================= */
.main {
    padding: 140px 40px;
}

body.rtl .main {
    margin-right: 270px;
}
body.ltr .main {
    margin-left: 270px;
}

/* =================================
   ✅ SIDEBAR LINKS
================================= */
.sidebar h2 {
    margin-bottom: 20px;
    text-align: center;
    font-size: 20px;
    font-weight: 800;
    color: #C58A5C;
}

.sidebar a {
    display: block;
    text-decoration: none;
    color: #333;
    padding: 12px;
    margin-bottom: 10px;
    background: #f0e6d8;
    border-radius: 10px;
    transition: 0.3s;
}

.sidebar a:hover {
    background: #e3d4c0;
    transform: translateX(-5px);
}

body.dark .sidebar a {
    color: #fff;
    background: rgba(255,255,255,0.08);
}

/* Dark toggle */
.toggle {
    margin-top: 15px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    background: linear-gradient(90deg, #C58A5C, #8A5E3B);
    color: white;
    border-radius: 10px;
}

/* =================================
   ✅ CARDS
================================= */
.card {
    background: white;
    padding: 25px;
    border-radius: 16px;
    margin-bottom: 20px;
    border-left: 5px solid #C58A5C;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: .3s;
}

.card:hover {
    transform: translateY(-6px);
}

body.dark .card {
    background: #1a1a1a;
}

/* =================================
   ✅ FORMS
================================= */
input, textarea, select {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid #C58A5C;
    background: #fff;
    color: #222;
    margin-bottom: 12px;
}

body.dark input,
body.dark textarea,
body.dark select {
    background: #222;
    color: #fff;
}

button {
    padding: 12px;
    width: 100%;
    background: linear-gradient(135deg, #C58A5C, #8A5E3B);
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: bold;
    cursor: pointer;
}

/* =================================
   ✅ ADS
================================= */
.ad-card {
    background: #fff;
    border: 1px solid #C58A5C;
    border-radius: 18px;
    padding: 22px;
    margin-bottom: 22px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.12);
}

.ad-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.ad-title {
    font-size: 20px;
    font-weight: 800;
    color: #8A5E3B;
}

.ad-date,
.ad-author {
    font-size: 13px;
    color: #aaa;
}

.ad-content {
    margin-top: 15px;
    line-height: 1.8;
}

/* =================================
   ✅ LANG DROPDOWN
================================= */
.lang-dropdown {
    margin-top: 15px;
    position: relative;
}

.lang-btn {
    width: 100%;
    padding: 12px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(197,138,92,0.3);
    border-radius: 10px;
    color: white;
    font-weight: bold;
    cursor: pointer;
}

.lang-menu {
    display: none;
    background: #000;
    border-radius: 10px;
    position: absolute;
    top: 50px;
    width: 100%;
    z-index: 999;
}

.lang-menu div {
    padding: 10px;
    text-align: center;
    cursor: pointer;
    color: white;
}

.lang-dropdown.active .lang-menu {
    display: block;
}

/* =================================
   ✅ MOBILE FIX (IMPORTANT)
================================= */
@media (max-width: 768px) {

    .sidebar {
        height: auto;
        min-height: 100svh;
        padding-top: 140px;
    }

    .main {
        margin: 0;
        padding: 150px 16px;
    }
}
/* =================================
   ✅ إصلاح أزرار صفحة الإعلانات
================================= */

.ad-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.ad-actions button {
    width: auto !important;      /* ✅ يلغي 100% */
    min-width: 120px;
    padding: 8px 14px;
}

/* زر تعديل */
.ad-actions .edit-btn {
    background: linear-gradient(135deg, #C58A5C, #8A5E3B);
    color: #111;
}

/* زر حذف */
.ad-actions .delete-btn {
    background: linear-gradient(135deg, #dc3545, #a71d2a);
    color: white;
}
/* =================================
   ✅ SIDEBAR (نسخة محسنة ومرتبة)
================================= */

.sidebar {
    position: fixed;
    top: 0;
    width: 250px;
    height: 100vh;

    background: linear-gradient(180deg, #ffffff, #f8f3ed);
    border-left: 1px solid rgba(197,138,92,0.3);

    padding: 120px 20px 20px;

    box-shadow: -5px 0 25px rgba(0,0,0,0.1);

    overflow-y: auto;
}

body.dark .sidebar {
    background: linear-gradient(180deg, #111, #1a1a1a);
}

/* العنوان */
.sidebar h2 {
    margin-bottom: 20px;
    text-align: center;
    font-size: 20px;
    font-weight: 800;
    color: #C58A5C;
}

/* الروابط */
.sidebar a {
    display: block;
    text-decoration: none;
    color: #333;
    padding: 12px 14px;
    margin-bottom: 10px;
    background: #f0e6d8;
    border-radius: 10px;
    transition: 0.3s;

    position: relative;
    overflow: hidden;
    z-index: 1;
}

/* الوضع الليلي */
body.dark .sidebar a {
    color: #fff;
    background: rgba(255,255,255,0.08);
}

/* ✨ خط جانبي احترافي */
.sidebar a::before {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    width: 4px;
    height: 0%;
    background: linear-gradient(180deg, #C58A5C, #8A5E3B);
    transition: 0.3s;
    border-radius: 10px;
}

/* عند المرور */
.sidebar a:hover::before {
    height: 100%;
}

/* Hover ناعم */
.sidebar a:hover {
    background: rgba(197,138,92,0.15);
    transform: translateX(-6px);
    color: #8A5E3B;
}

/* Hover في الدارك */
body.dark .sidebar a:hover {
    background: rgba(197,138,92,0.2);
    color: #fff;
}

/* زر الوضع الليلي */
.toggle {
    margin-top: 15px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    background: linear-gradient(90deg, #C58A5C, #8A5E3B);
    color: white;
    border-radius: 10px;
}
/* ===== إصلاح الكروت في الوضع الليلي ===== */
body.dark .ad-card {
    background: linear-gradient(145deg, #1a1a1a, #111) !important;
    border: 1px solid rgba(197,138,92,0.25);
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
}

/* النص داخل الكرت */
body.dark .ad-content {
    color: #ddd;
}

body.dark .ad-date,
body.dark .ad-author {
    color: #888;
}
/* =================================
   ✅ SIDEBAR (نهائي احترافي)
================================= */
.sidebar {
    position: fixed;
    top: 0;
    width: 250px;
    height: 100vh;

    background: linear-gradient(180deg, #ffffff, #f8f3ed);
    border-left: 1px solid rgba(197,138,92,0.3);

    padding: 120px 20px 20px;
    box-shadow: -5px 0 25px rgba(0,0,0,0.1);

    overflow-y: auto;
}

body.dark .sidebar {
    background: linear-gradient(180deg, #0f0f0f, #1a1a1a);
}

/* روابط */
.sidebar a {
    display: block;
    text-decoration: none;
    color: #333;
    padding: 12px 14px;
    margin-bottom: 10px;
    background: #f0e6d8;
    border-radius: 10px;
    transition: 0.25s;
    position: relative;
}

/* دارك */
body.dark .sidebar a {
    color: #fff;
    background: rgba(255,255,255,0.06);
}

/* الخط الجانبي */
.sidebar a::before {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    width: 3px;
    height: 0%;
    background: linear-gradient(180deg, #C58A5C, #8A5E3B);
    transition: 0.25s;
}

/* Hover احترافي (بدون ما يصير كله لون) */
.sidebar a:hover {
    transform: translateX(-5px);
    background: rgba(197,138,92,0.15);
}

.sidebar a:hover::before {
    height: 100%;
}

/* =================================
   ✅ ADS (كروت فخمة)
================================= */
.ad-card {
    background: linear-gradient(145deg, #ffffff, #f9f6f2);
    border: 1px solid rgba(197,138,92,0.3);
    border-radius: 18px;
    padding: 22px;
    margin-bottom: 22px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: 0.3s;
}

/* Hover */
.ad-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 25px 60px rgba(197,138,92,0.25);
}

/* دارك مود */
body.dark .ad-card {
    background: linear-gradient(145deg, #1a1a1a, #111) !important;
    border: 1px solid rgba(197,138,92,0.2);
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
}

/* النص */
body.dark .ad-content {
    color: #ddd;
}

body.dark .ad-date,
body.dark .ad-author {
    color: #888;
}

/* =================================
   ✅ الملف المرفق (مسافة نظيفة)
================================= */
.ad-card img,
.ad-card a {
    margin-top: 15px;
    display: inline-block;
}

/* مسافة بين الملف والأزرار */
.ad-actions {
    margin-top: 18px;
    display: flex;
    gap: 10px;
}

/* أزرار */
.ad-actions button {
    width: auto !important;
    padding: 8px 14px;
    border-radius: 10px;
    cursor: pointer;
}

/* تعديل */
.edit-btn {
    background: linear-gradient(135deg, #C58A5C, #8A5E3B);
    color: #111;
}

/* حذف */
.delete-btn {
    background: linear-gradient(135deg, #dc3545, #a71d2a);
    color: #fff;
}
/* =================================
   ✨ زخرفة احترافية للكروت
================================= */

/* لمعة ذهبية خفيفة */
.ad-card::after {
    content: "";
    position: absolute;
    top: -30%;
    left: -30%;
    width: 160%;
    height: 160%;
    background: radial-gradient(circle, rgba(197,138,92,0.15), transparent 60%);
    transform: rotate(20deg);
    pointer-events: none;
}

/* خط زخرفي أعلى الكرت */
.ad-card::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #C58A5C, transparent);
    opacity: 0.7;
}

/* تحسين الحدود */
.ad-card {
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(6px);
}

/* ✨ عنوان فيه خط فخم */
.ad-title {
    position: relative;
    display: inline-block;
    padding-bottom: 5px;
}

/* خط صغير تحت العنوان */
.ad-title::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: 0;
    width: 40%;
    height: 2px;
    background: linear-gradient(90deg, #C58A5C, transparent);
}

/* =================================
   ✨ تأثير دخول ناعم للكروت
================================= */
.ad-card {
    animation: fadeUp 0.6s ease;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =================================
   ✨ تحسين الوضع الليلي (زخرفة خفيفة)
================================= */
body.dark .ad-card::after {
    background: radial-gradient(circle, rgba(197,138,92,0.08), transparent 60%);
}

body.dark .ad-card::before {
    opacity: 0.4;
}

/* =================================
   ✨ زرار فيها لمعة Hover
================================= */
.ad-actions button {
    position: relative;
    overflow: hidden;
}

/* لمعة تمر */
.ad-actions button::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: rgba(255,255,255,0.3);
    transform: skewX(-25deg);
    transition: 0.4s;
}

.ad-actions button:hover::after {
    left: 130%;
}
/* =================================
   ✅ Welcome Modal
================================= */
.welcome-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.welcome-box {
    background: rgba(20,20,20,0.9);
    backdrop-filter: blur(14px);
    border-radius: 22px;
    padding: 45px 40px;
    text-align: center;
    width: 420px;
    max-width: 90%;
    border: 1px solid rgba(197,138,92,0.5);
    box-shadow: 0 40px 80px rgba(0,0,0,0.8);
    animation: welcomePop .8s ease forwards;
}

.welcome-box img {
    width: 90px;
    margin-bottom: 20px;
}

.welcome-box h2 {
    color: #d5a56f;
    font-weight: 800;
    margin-bottom: 10px;
}

.welcome-box p {
    color: #ccc;
    margin-bottom: 25px;
    font-size: 15px;
}

.welcome-box button {
    width: auto;
    padding: 12px 30px;
    border-radius: 16px;
    background: linear-gradient(135deg, #c58a5c, #8a5e3b);
}

@keyframes welcomePop {
    from { opacity: 0; transform: scale(.9) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
#userName {
    white-space: nowrap;
}
/* =================================
   ✅ تصحيح وضوح زر اللغة – الوضع النهاري
================================= */

/* زر اللغة في الوضع النهاري */
body:not(.dark) .lang-btn {
    background: #f9f5ee;          /* نفس روح البوابة */
    color: #3b2a1a;               /* بني غامق واضح */
    border: 1px solid #c58a5c;
}

/* قائمة اللغة – الوضع النهاري */
body:not(.dark) .lang-menu {
    background: #ffffff;
    border: 1px solid #c58a5c;
}

/* عناصر القائمة */
body:not(.dark) .lang-menu div {
    color: #3b2a1a;               /* خط واضح */
}

/* Hover */
body:not(.dark) .lang-menu div:hover {
    background: #f0e6d8;
}
/* =================================
   ✅ إصلاح النص داخل الحقول بالدارك مود
================================= */

body.dark input,
body.dark textarea,
body.dark select {
    background: #1b1b1b !important;
    color: #fff !important;
    border: 1px solid #C58A5C;
}

/* لون النص الوهمي Placeholder */
body.dark input::placeholder,
body.dark textarea::placeholder {
    color: #b8b8b8 !important;
    opacity: 1;
}

/* إصلاح رفع الملفات */
body.dark input[type="file"] {
    color: #ddd !important;
}

/* إذا فيه autofill من المتصفح */
body.dark input:-webkit-autofill {
    -webkit-text-fill-color: #fff !important;
    transition: background-color 9999s ease-in-out 0s;
}
