/* ================================================================
   LAYER OWNERSHIP: RESET SYSTEM (BASE RESET LAYER)
   Root authority: tokens.css | Consumers: layout/master.php
   ================================================================ */

/* office-pro-reset.css — Mobile-first reset layer. Consumers: layout/master.php */

:root {
    --primary: var(--op-navy, #1B365D);
    --primary-dark: var(--op-navy-dark, #12243d);
    --gold: var(--op-gold, #C5A059);
    --bg-body: var(--op-bg-main, #F3F4F6);
    --text-main: var(--op-text-primary, #1F2937);
    --text-muted: var(--op-text-secondary, #64748b);
    --border: var(--op-border, #e2e8f0);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* ═══════════════════════════════════════════════════════════════
   FOUC SHIELD — Prevents content flash before module CSS loads
   ═══════════════════════════════════════════════════════════════ */
body:not(.css-ready) .content-area {
    opacity: 0;
}
body.css-ready .content-area {
    opacity: 1;
    transition: opacity 0.08s ease-out;
}

/* ═══════════════════════════════════════════════════════════════
   GLOBAL VISIBILITY UTILITIES
   ═══════════════════════════════════════════════════════════════ */
.d-none { display: none !important; }
.office-hidden { display: none !important; }

/* ═══════════════════════════════════════════════════════════════
   SVG SAFETY NET — Prevent giant icons before module CSS loads
   ═══════════════════════════════════════════════════════════════ */
svg:not([width]):not([class]) {
    width: 1em;
    height: 1em;
}

html {
    margin: 0;
    padding: 0;
    font-family: 'Cairo', 'Tajawal', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    direction: rtl;
}

/* =========================================
   2. هيكل التخطيط (صفحة كاملة أو تقسيم جانبي)
   ========================================= */
body {
    margin: 0;
    padding: 0;
    font-family: 'Cairo', 'Tajawal', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    direction: rtl;
    display: flex;
    /* Flex container for Sidebar + Main */
    flex-direction: row;
    /* Horizontal layout */
    overflow-x: hidden;
    /* Prevent horizontal scroll */
}

/* =========================================
   3. القائمة الجانبية (الافتراضي للجوال فقط)
   ========================================= */
@media (max-width: 991px) {
    .sidebar {
        position: fixed;
        top: 0;
        right: 0;
        height: 100vh;
        width: 280px;
        background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
        color: white;
        z-index: 1000;
        transform: translateX(100%);
        /* مخفية (RTL: 100% يعني لليمين) */
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.2);
        display: flex;
        flex-direction: column;
    }

    /* إظهار القائمة عند إضافة كلاس open */
    .sidebar.open {
        transform: translateX(0);
    }
}

/* طبقة التعتيم (Overlay) - إصلاح مشكلة التداخل */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 900;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* =========================================
   4. الشريط العلوي (Top Header)
   ========================================= */
.topbar {
    height: 70px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    position: sticky;
    top: 0;
    z-index: 100;
}

.toggle-sidebar-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-main);
    display: block;
    /* ظاهر فقط في الجوال */
}

/* البحث ومعلومات المستخدم (سطح المكتب مبدئياً) */
.user-info {
    display: none;
}

.search-bar {
    display: none;
    position: relative;
    width: 350px;
}

.search-input {
    width: 100%;
    padding: 10px 45px 10px 15px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    outline: none;
    font-family: inherit;
}

.search-input:focus {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(27, 54, 93, 0.1);
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
    width: 24px !important;
    height: 24px !important;
}


/* --- إصلاح حجم الأيقونات --- */
.search-bar svg,
.search-icon svg,
.user-area svg,
.notification-btn svg,
.toggle-sidebar-btn svg,
.close-sidebar-btn svg {
    width: 24px !important;
    height: 24px !important;
    max-width: 24px;
    max-height: 24px;
    display: block;
}

/* تم دمج حجم أيقونة البحث في المحدد الرئيسي أعلاه */

/* تأثير التحويم المميز لأيقونة المستخدم */
.avatar-icon {
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    /* لتأثير اللمعان */
}

.avatar-icon:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(27, 54, 93, 0.25);
    /* ظل أساسي */
    filter: brightness(1.05);
    /* إضاءة خفيفة */
}

/* حالة الضغط/التفعيل */
.avatar-icon:active {
    transform: scale(0.95);
    box-shadow: 0 0 0 4px rgba(27, 54, 93, 0.1);
    /* تأثير الحلقة */
}



/* زر إغلاق القائمة (الجوال فقط) */
.close-sidebar-btn {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #475569;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 22px;
    /* محاذاة مع وسط الشعار */
    left: 15px;
    border-radius: 50%;
    z-index: 1100;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.close-sidebar-btn:hover {
    background: #e2e8f0;
    transform: rotate(90deg);
    /* تأثير دوران احترافي */
    border-color: #cbd5e1;
    color: #1e293b;
}


.user-area {
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar-icon svg {
    width: 40px;
    height: 40px;
    display: block;
}

/* التوافقية مع الأجهزة المكتبية (> 900px) */
@media (min-width: 901px) {
    .content-area {
        padding-top: 0;
        margin-top: 20px;
    }
    .close-sidebar-btn,
    .toggle-sidebar-btn,
    .sidebar-overlay {
        display: none !important;
    }
    .search-bar {
        display: block;
    }
    .user-info {
        display: block;
    }
}


