/* =========================================================
   نظام إدارة الحملات التسويقية - ملف التنسيقات الرئيسي
   ========================================================= */

:root {
    --primary: #4361ee;
    --primary-dark: #2f3fb0;
    --secondary: #3a0ca3;
    --success: #2ec4b6;
    --danger: #e63946;
    --warning: #ff9f1c;
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --bg-soft: #f4f6fb;
}

* { box-sizing: border-box; }

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--bg-soft);
    color: #2b2d42;
}

a { text-decoration: none; }

/* ---------- تخطيط الصفحة العام ---------- */
.app-wrapper { min-height: 100vh; }

.app-content {
    min-width: 0;
}

/* ---------- القائمة الجانبية ---------- */
.app-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--secondary), var(--primary-dark));
    color: #fff;
    min-height: 100vh;
    position: sticky;
    top: 0;
    padding-bottom: 2rem;
    transition: margin-right .25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-weight: 800;
    font-size: 1.15rem;
    padding: 1.4rem 1.2rem;
    border-bottom: 1px solid rgba(255,255,255,.12);
}

.sidebar-brand i { font-size: 1.5rem; }

.sidebar-nav { padding: .8rem; }

.sidebar-nav .nav-section-title {
    display: block;
    font-size: .72rem;
    color: rgba(255,255,255,.55);
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: .6rem .9rem 0;
}

.sidebar-nav .nav-link {
    color: rgba(255,255,255,.85);
    border-radius: .6rem;
    padding: .65rem .9rem;
    margin-bottom: .2rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: .6rem;
    transition: background .15s ease, color .15s ease;
}

.sidebar-nav .nav-link i { font-size: 1.05rem; }

.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,.10);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: #fff;
    color: var(--primary-dark);
    font-weight: 700;
}

/* ---------- الشريط العلوي ---------- */
.app-topbar {
    background: #fff;
    height: var(--topbar-height);
    box-shadow: 0 2px 10px rgba(0,0,0,.04);
    position: sticky;
    top: 0;
    z-index: 900;
}

/* ---------- بطاقات الإحصائيات ---------- */
.stat-card {
    border: none;
    border-radius: 1rem;
    padding: 1.4rem;
    color: #fff;
    box-shadow: 0 8px 20px rgba(0,0,0,.08);
    position: relative;
    overflow: hidden;
}

.stat-card .stat-icon {
    font-size: 2.4rem;
    opacity: .35;
    position: absolute;
    left: 1rem;
    top: 1rem;
}

.stat-card .stat-value {
    font-size: 1.9rem;
    font-weight: 800;
}

.stat-card .stat-label {
    font-size: .88rem;
    opacity: .9;
}

.bg-grad-blue    { background: linear-gradient(135deg, #4361ee, #3a0ca3); }
.bg-grad-green   { background: linear-gradient(135deg, #2ec4b6, #0b9e91); }
.bg-grad-orange  { background: linear-gradient(135deg, #ff9f1c, #e07000); }
.bg-grad-pink    { background: linear-gradient(135deg, #f72585, #b5179e); }
.bg-grad-teal    { background: linear-gradient(135deg, #06d6a0, #048a68); }
.bg-grad-purple  { background: linear-gradient(135deg, #7209b7, #480ca8); }

/* ---------- بطاقات عامة ---------- */
.card {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 4px 16px rgba(0,0,0,.05);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #eef0f5;
    font-weight: 700;
    border-radius: 1rem 1rem 0 0 !important;
}

.table thead th {
    font-size: .82rem;
    text-transform: uppercase;
    color: #6c757d;
    border-bottom-width: 1px;
    background: #f8f9fc;
}

.badge-status-active { background-color: var(--success); }
.badge-status-paused  { background-color: #adb5bd; }

/* ---------- صفحة تسجيل الدخول ---------- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
}

.auth-card {
    width: 100%;
    max-width: 420px;
    border-radius: 1.2rem;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
}

/* ---------- QR Code ---------- */
.qr-box {
    background: #fff;
    border: 1px dashed #ccd3e0;
    border-radius: .8rem;
    padding: 1rem;
    display: inline-block;
}

/* ---------- الطباعة ---------- */
@media print {
    .app-sidebar, .app-topbar, .no-print, footer { display: none !important; }
    .app-content { width: 100% !important; }
    body { background: #fff !important; }
}

/* ---------- الاستجابة للشاشات الصغيرة ---------- */
@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        right: 0;
        top: 0;
        z-index: 1050;
        margin-right: calc(-1 * var(--sidebar-width));
        box-shadow: 0 0 30px rgba(0,0,0,.3);
    }
    .app-sidebar.show { margin-right: 0; }
}
