/* Custom Styles for Ad Server Dashboard - Self-Contained Professional Design (Flat/Modern) */

/* استيراد خط Cairo للمظهر العربي الاحترافي */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap');

/* ========================================================= */
/* 1. Reset & Base Styles */
/* ========================================================= */
body {
    font-family: 'Cairo', sans-serif;
    margin: 0;
    direction: rtl;
    text-align: right;
    background-color: #f0f3f5; /* خلفية ناعمة */
    color: #34495e;
    font-size: 15px;
    min-height: 100vh;
}
/* إعادة تعريف صندوق النموذج ليتناسب مع أنماط Bootstrap */
.form-select, .form-control {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    border: 1px solid #dcdfe6;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}
.form-control:focus, .form-select:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 0.25rem rgba(52, 152, 219, 0.25);
}
label {
    display: block;
    margin-top: 10px;
    font-weight: 600;
    color: #2c3e50;
}
a {
    color: #3498db;
    text-decoration: none;
}
a:hover {
    color: #2980b9;
    text-decoration: underline;
}

/* ========================================================= */
/* 2. Layout Structure */
/* ========================================================= */

/* الرأس (Top Navbar - بديل لـ header.navbar) */
.main-header {
    background: #2c3e50 !important; /* أزرق داكن */
    color: #ecf0f1;
    padding: 15px 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 99;
}
.main-header .brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ecf0f1;
}

/* التذييل (Footer) */
.main-footer {
    background: #34495e;
    color: #ecf0f1;
    padding: 10px 20px;
    text-align: center;
    margin-top: auto;
    font-size: 0.85rem;
}

/* هيكل الصفحة الرئيسية (بديل لـ .container-fluid و .row) */
.main-layout {
    display: flex;
    min-height: calc(100vh - 70px); /* يضبط للارتفاع الكامل */
}

/* شريط التنقل الجانبي (بديل لـ #sidebar) */
.sidebar {
    width: 250px;
    background: #34495e !important;
    color: #ecf0f1;
    padding: 1rem 0;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}
.sidebar-heading {
    font-size: 1.3rem;
    color: #f39c12; /* لون برتقالي مميز */
    padding: 1rem 1.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}
.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar-nav a {
    color: #ecf0f1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    border-right: 4px solid transparent;
    transition: background-color 0.2s, border-right-color 0.2s;
}
.sidebar-nav a:hover {
    background: #4a637c;
    text-decoration: none;
}
.sidebar-nav a.active {
    background: #4a637c;
    border-right-color: #f39c12;
    font-weight: 600;
}
.sidebar-stats {
    font-size: 0.85rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 15px;
}
.sidebar-logout {
    padding: 1rem;
}

/* منطقة المحتوى الرئيسية (بديل لـ main) */
.main-content {
    flex-grow: 1;
    padding: 25px;
}

/* ========================================================= */
/* 3. Components & Utility */
/* ========================================================= */

/* البطاقة (بديل لـ .card) */
.app-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    padding: 20px;
    margin-bottom: 20px;
}
.app-card-header {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f3f5;
}

/* الأزرار (بديل لـ .btn-*) */
.btn {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.2s, transform 0.1s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none !important;
    color: #fff;
}
.btn-primary { background-color: #3498db; }
.btn-primary:hover { background-color: #2980b9; transform: translateY(-1px); }
.btn-success { background-color: #2ecc71; }
.btn-success:hover { background-color: #27ae60; transform: translateY(-1px); }
.btn-danger { background-color: #e74c3c; }
.btn-danger:hover { background-color: #c0392b; transform: translateY(-1px); }
.btn-secondary { background-color: #95a5a6; }
.btn-secondary:hover { background-color: #7f8c8d; transform: translateY(-1px); }
.btn-outline-secondary {
    background: transparent;
    border: 1px solid #95a5a6;
    color: #95a5a6;
}
.btn-outline-secondary:hover {
    background-color: #95a5a6;
    color: #fff;
}
.w-100 { width: 100% !important; }

/* رسائل التنبيهات (بديل لـ .alert) */
.app-alert {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-weight: 600;
    border: 1px solid transparent;
}
.app-alert.success {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}
.app-alert.error {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}
.app-alert p { margin: 0; }

/* الجداول (بديل لـ .table-*) */
.app-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    margin-top: 15px;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.app-table th, .app-table td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #ecf0f1;
}
.app-table th {
    background: #f8f9fa;
    font-weight: 700;
    color: #34495e;
}
.app-table tbody tr:hover {
    background: #fcfcfc;
}
.app-table-responsive {
    overflow-x: auto;
}

/* كود التضمين */
.embed-box {
    background: #e9ecef;
    border: 1px dashed #ced4da;
    padding: 10px;
    margin-top: 10px;
    direction: ltr;
    word-break: break-all;
    font-size: 0.8rem;
    border-radius: 0.3rem;
}

/* ========================================================= */
/* 4. Utility Classes (Mimicking Bootstrap) */
/* ========================================================= */

.d-flex { display: flex; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }
.mb-3 { margin-bottom: 1rem !important; }
.mt-3 { margin-top: 1rem !important; }
.p-4 { padding: 1.5rem !important; }
.text-center { text-align: center !important; }

/* الأيقونات - يجب أن تُضاف في ملفات HTML (مثل <i class="fas fa-ad"></i>) */
.fas { font-family: "Font Awesome 6 Free"; font-weight: 900; }
.far { font-family: "Font Awesome 6 Free"; font-weight: 400; }
.fa-fw { text-align: center; width: 1.25em; }

/* ========================================================= */
/* 5. Responsive Design */
/* ========================================================= */

@media (max-width: 900px) {
    .main-layout {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        box-shadow: none;
        padding: 0;
    }
    .sidebar-nav ul {
        display: flex;
        flex-wrap: wrap;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
    .sidebar-nav li {
        flex-grow: 1;
        flex-basis: auto;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    .sidebar-nav a {
        justify-content: center;
        text-align: center;
        padding: 10px 5px;
        border-right: none;
        border-bottom: 4px solid transparent;
    }
    .sidebar-nav a.active {
        border-right: none;
        border-bottom-color: #f39c12;
    }
    .sidebar-stats, .sidebar-logout {
        display: none; /* إخفاء الإحصائيات في وضع الهاتف */
    }
    .main-content {
        padding: 15px;
    }
    .app-table-responsive {
        /* ضروري لضمان تمرير الجدول أفقيًا في الهاتف */
        overflow-x: auto;
    }
}