*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

:root {
    --sidebar-width: 260px;
    --sidebar-bg: #075E54;
    --sidebar-hover: #128C7E;
    --submenu-bg: #054e46;
    --icon-box-bg: rgba(255,255,255,0.12);

    --icon-dashboard: #ffd166;
    --icon-devices: #74c0fc;
    --icon-contacts: #c77dff;
    --icon-chat: #51cf66;
    --icon-bulk: #ff922b;
    --icon-ai: #9775fa;
    --icon-orders: #f06595;
    --icon-templates: #4dabf7;
    --icon-shipping: #ff6b6b;
    --icon-subscriptions: #20c997;
    --icon-reports: #66d9e8;
    --icon-settings: #ced4da;
    --icon-notification: #f19035;
    --icon-admin: #ff6b6b;
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: #f0f2f5;
    margin: 0;
    overflow-x: hidden;
}
.text-brand-green {
    color: #128c7e;
}
.sidebar {
    background: linear-gradient(180deg, #075E54 0%, #064b43 100%);
    height: 100vh;
    color: white;
    position: fixed;
    inset-inline-start: 0;
    top: 0;
    width: var(--sidebar-width);
    z-index: 1050;
    transition: all 0.3s ease;
    box-shadow: 2px 0 10px rgba(0,0,0,0.10);
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 110px;
}

.sidebar-content {
    padding-bottom: 120px;
}

.main-wrapper {
    margin-inline-start: var(--sidebar-width);
    min-height: 80vh;
    padding: 20px;
    transition: all 0.3s ease;
    width: calc(100% - var(--sidebar-width));
    overflow-x: hidden;
    overflow: visible !important;
}

.nav-link {
    color: rgba(255,255,255,0.88);
    margin: 6px 15px;
    border-radius: 14px;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: 0.3s ease;
    width: calc(100% - 30px);
    font-size: 1rem;
    gap: 12px;
}

.nav-link:hover,
.nav-link.active {
    background: var(--sidebar-hover);
    color: white;
    transform: translateY(-1px);
}

.nav-icon-box {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 10px;
    background: var(--icon-box-bg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-link i {
    font-size: 1.1rem;
    margin: 0 !important;
}

.icon-dashboard { color: var(--icon-dashboard); }
.icon-devices { color: var(--icon-devices); }
.icon-contacts { color: var(--icon-contacts); }
.icon-chat { color: var(--icon-chat); }
.icon-bulk { color: var(--icon-bulk); }
.icon-ai { color: var(--icon-ai); }
.icon-orders { color: var(--icon-orders); }
.icon-templates { color: var(--icon-templates); }
.icon-shipping { color: var(--icon-shipping); }
.icon-subscriptions { color: var(--icon-subscriptions); }
.icon-reports { color: var(--icon-reports); }
.icon-settings { color: var(--icon-settings); }
.icon-admin { color: var(--icon-admin); }

.top-navbar {
    background: white;
    padding: 12px 14px;
    border-bottom: 1px solid #eee;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: visible !important;
    box-shadow: 0 8px 24px rgba(15,23,42,0.05);
    z-index: 20;
    gap: 10px;
}

.top-navbar-title {
    font-weight: 800;
    color: #1f2937;
    font-size: 0.95rem;
}

.top-navbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    position: relative;
}

.notification-btn,
.lang-btn,
.profile-btn {
    border: 1px solid #e5e7eb;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.25s ease;
}

.notification-btn {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    color: #075E54;
    flex: 0 0 auto;
}

.lang-btn {
    height: 42px;
    border-radius: 999px;
    padding: 0 12px;
    color: #075E54;
    font-weight: 700;
    gap: 6px;
    flex: 0 0 auto;
}

.profile-btn {
    height: 44px;
    padding: 4px 8px 4px 4px;
    border-radius: 999px;
    gap: 8px;
    flex: 0 0 auto;
}

.notification-btn:hover,
.lang-btn:hover,
.profile-btn:hover {
    background: #f8fafc;
    border-color: #d1d5db;
}

.notification-badge {
    position: absolute;
    top: -5px;
    inset-inline-start: -8px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: .72rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.dropdown-wrapper {
    position: relative;
}

.notification-dropdown,
.profile-dropdown,
.lang-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    min-width: 180px;
    border: none;
    border-radius: 18px;
    box-shadow: 0 15px 35px rgba(0,0,0,.12);
    padding: 0;
    z-index: 99999 !important;
    overflow: hidden;
    background: #fff;
    display: none;
}

.dropdown-wrapper.open .notification-dropdown,
.dropdown-wrapper.open .profile-dropdown,
.dropdown-wrapper.open .lang-dropdown {
    display: block;
}

.notification-dropdown {
    inset-inline-start: 0;
    width: 360px;
    max-width: min(360px, calc(100vw - 24px));
    max-height: 420px;
    overflow-y: auto;
}

.profile-dropdown {
    inset-inline-start: 0;
    width: 240px;
    max-width: calc(100vw - 24px);
}

.lang-dropdown {
    inset-inline-end: 0;
    width: 180px;
    max-width: calc(100vw - 24px);
}

.notification-header {
    padding: 15px 18px;
    border-bottom: 1px solid #eee;
    font-weight: 700;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 2;
}

.notification-item {
    display: block;
    padding: 14px 16px;
    text-decoration: none;
    color: #212529;
    border-bottom: 1px solid #f1f1f1;
    background: #fff;
}

.notification-item:hover {
    background: #f8fafc;
    color: #212529;
}

.notification-item.unread {
    background: #eefaf6;
}

.notification-title {
    font-weight: 700;
    margin-bottom: 4px;
    font-size: .95rem;
}

.notification-message {
    font-size: .85rem;
    color: #64748b;
    margin-bottom: 6px;
    line-height: 1.5;
}

.notification-time {
    font-size: .75rem;
    color: #94a3b8;
}

.notification-empty {
    padding: 25px 15px;
    text-align: center;
    color: #94a3b8;
    background: #fff;
}

.notification-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-inline-end: 8px;
}

.dot-info { background: #0ea5e9; }
.dot-success { background: #22c55e; }
.dot-warning { background: #f59e0b; }
.dot-danger { background: #ef4444; }

.profile-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #22c55e;
    background: #fff;
}

.profile-info {
    display: flex;
    flex-direction: column;
    text-align: start;
    line-height: 1.2;
}

.profile-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: #1f2937;
    max-width: 95px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-role {
    font-size: 0.70rem;
    color: #6b7280;
    font-weight: 600;
}

.dropdown-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    text-decoration: none;
    color: #1f2937;
    background: #fff;
    border-bottom: 1px solid #f3f4f6;
    transition: 0.2s;
}

.dropdown-link:hover {
    background: #f8fafc;
    color: #1f2937;
}

.dropdown-link.text-danger {
    color: #dc2626 !important;
}

.dropdown-link.text-danger:hover {
    background: #fff1f2;
}

.lang-option.active {
    background: #ecfdf5;
    color: #065f46;
    font-weight: 700;
}

.sidebar-divider-title {
    font-size: 0.7rem;
    opacity: 0.55;
    margin: 8px 22px 10px;
    display: block;
}

.overlay {
    display: none;
}
.sidebar-brand{
    padding-top: 1.5rem;
}
.sidebar-brand-logo {
    width: 170px;
    max-width: 85%;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    filter: drop-shadow(0 6px 14px rgba(0,0,0,.22));
}

.sidebar-brand-name {
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.2;
}

.guest-brand-logo {
    width: 80px;
    height: 50px;
    object-fit: contain;
    border-radius: 10px;
}

.legal-page {
    max-width: 1050px;
    margin: 0 auto;
    padding: 50px 18px;
}

.legal-card {
    background: #ffffff;
    border-radius: 26px;
    padding: 45px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
    border: 1px solid #e5e7eb;
}

.legal-header {
    text-align: center;
    margin-bottom: 35px;
    padding-bottom: 25px;
    border-bottom: 1px solid #e5e7eb;
}

.legal-header h1 {
    font-size: 34px;
    font-weight: 800;
    color: #064e3b;
    margin-bottom: 10px;
}

.legal-header p {
    font-size: 14px;
    color: #64748b;
}

html[dir="rtl"] .legal-content {
    direction: rtl;
    text-align: right;
}

html[dir="ltr"] .legal-content {
    direction: ltr;
    text-align: left;
}
.legal-text {
    font-size: 17px;
    line-height: 2.15;
    color: #1f2937;
    white-space: normal;
}

.legal-text br {
    display: block;
    content: "";
    margin-bottom: 8px;
}

.legal-text strong,
.legal-text b {
    color: #064e3b;
    font-weight: 800;
}

.legal-text {
    word-break: break-word;
}
/* العناوين الرئيسية */
.legal-content h2 {
    color: #0f172a;          /* داكن جداً */
    font-size: 20px;
    font-weight: 800;
    margin: 35px 0 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e5e7eb;
}

/* العناوين الفرعية */
.legal-content h3 {
    color: #1e293b;
    font-size: 20px;
    font-weight: 700;
    margin: 28px 0 15px;
}

/* الفقرات */
.legal-content p {
    color: black;
    line-height: 2.1;
    margin-bottom: 16px;
}
html[dir="rtl"] .legal-content p {
    text-align: right;
}

html[dir="ltr"] .legal-content p {
    text-align: left;
}
/* القوائم */
.legal-content ul,
.legal-content ol {
    margin: 18px 35px 25px 0;
}

.legal-content li {
    color: #1c1e22;
    margin-bottom: 10px;
    line-height: 2;
}

/* تمييز الكلمات المهمة */
.legal-content strong,
.legal-content b {
    color: #111827;
    font-weight: 800;
}

@media (max-width: 768px) {
    .legal-card {
        padding: 25px 18px;
        border-radius: 18px;
    }

    .legal-header h1 {
        font-size: 26px;
    }

    .legal-text {
        font-size: 15px;
        line-height: 2;
    }
}

@media (max-width: 992px) {
    .sidebar {
        inset-inline-start: calc(var(--sidebar-width) * -1);
    }

    .sidebar.show {
        inset-inline-start: 0;
    }

    .main-wrapper {
        margin-inline-start: 0;
        width: 100%;
        max-width: 100%;
        padding: 12px;
    }

    .overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1040;
    }

    .overlay.show {
        display: block;
    }

    .profile-info {
        display: none;
    }

    .profile-btn {
        padding: 6px;
    }

    .notification-dropdown {
        inset-inline-end: 0;
        inset-inline-start: auto;
        width: 320px;
        max-width: 90vw;
    }

    .profile-dropdown,
    .lang-dropdown {
        inset-inline-start: auto;
        inset-inline-end: 0;
        max-width: 90vw;
    }
}

@media (max-width: 768px) {
    .top-navbar {
        padding: 10px 12px;
        border-radius: 14px;
        gap: 8px;
    }

    .top-navbar-title {
        display: none !important;
    }

    .top-navbar-actions {
        gap: 8px;
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .top-navbar > div:first-child {
        display: flex !important;
        align-items: center;
        gap: 8px;
        flex: 0 0 auto;
    }

    .top-navbar > div:first-child .btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        padding: 0;
        border-radius: 12px;
    }

    .lang-btn {
        height: 40px;
        min-width: 40px;
        padding: 0 10px;
        font-size: 0.85rem;
    }

    .lang-btn span {
        display: none;
    }

    .profile-btn {
        height: 40px;
        width: 40px;
        min-width: 40px;
        padding: 0;
        border-radius: 50%;
        gap: 0;
        justify-content: center;
    }

    .profile-info,
    .profile-btn .bi-chevron-down {
        display: none !important;
    }

    .profile-avatar {
        width: 30px;
        height: 30px;
    }

    .notification-btn {
        width: 40px;
        height: 40px;
    }

    .notification-dropdown,
    .profile-dropdown,
    .lang-dropdown {
        top: calc(100% + 8px);
        inset-inline-end: 50%;
        inset-inline-start: auto;
        transform: translateX(50%);
        max-width: calc(100vw - 24px);
    }

    .notification-dropdown {
        width: min(300px, calc(100vw - 24px));
    }

    .profile-dropdown {
        width: min(220px, calc(100vw - 24px));
    }

    .lang-dropdown {
        width: min(160px, calc(100vw - 24px));
    }

    .dropdown-link {
        padding: 11px 12px;
        font-size: 0.92rem;
    }
}

@media (max-width: 480px) {
    .top-navbar-actions {
        gap: 6px;
    }

    .notification-dropdown {
        width: min(280px, calc(100vw - 20px));
    }

    .profile-dropdown {
        width: min(210px, calc(100vw - 20px));
    }

    .lang-dropdown {
        width: min(150px, calc(100vw - 20px));
    }

    .notification-header {
        padding: 12px 14px;
        font-size: 0.92rem;
    }

    .notification-item {
        padding: 12px 14px;
    }

    .notification-title {
        font-size: 0.88rem;
    }

    .notification-message {
        font-size: 0.80rem;
    }

    .notification-time {
        font-size: 0.72rem;
    }
}
.guest-layout {
    min-height: 100vh;
    background: #f0f2f5;
}

.guest-top-navbar {
    background: linear-gradient(180deg, #075E54 0%, #064b43 100%);
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
    padding: 14px 18px;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.guest-brand-icon {
    font-size: 1.2rem;
}

.guest-brand-text {
    font-weight: 800;
    color: #075E54;
    font-size: 1rem;
}

.guest-main-wrapper {
    min-height: calc(100vh - 73px);
    padding: 20px;
}

@media (max-width: 768px) {
    .guest-top-navbar {
        padding: 12px 14px;
    }

    .guest-brand-text {
        font-size: 0.92rem;
    }

    .guest-main-wrapper {
        padding: 14px;
    }
}
.main-wrapper.main-wrapper-error {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-wrapper.main-wrapper-error .error-page-shell {
    flex: 1;
}
.guest-main-wrapper {
    min-height: calc(100vh - 120px);
    display: flex;
    align-items: center;
    justify-content: center;
}
/* =========================================================
   TOP NAVBAR DROPDOWNS - FINAL FIX
========================================================= */

.top-navbar,
.top-navbar-actions,
.dropdown-wrapper {
    overflow: visible !important;
}

/* Desktop */
.top-navbar .dropdown-wrapper {
    position: relative;
}

.top-navbar .notification-dropdown,
.top-navbar .profile-dropdown,
.top-navbar .lang-dropdown {
    top: calc(100% + 10px);
    transform: none;
    margin: 0;
}

/*
|--------------------------------------------------------------------------
| RTL Desktop
|--------------------------------------------------------------------------
*/

html[dir="rtl"] .top-navbar .notification-dropdown,
html[dir="rtl"] .top-navbar .profile-dropdown,
html[dir="rtl"] .top-navbar .lang-dropdown {
    left: 0;
    right: auto;
}

/*
|--------------------------------------------------------------------------
| LTR Desktop
|--------------------------------------------------------------------------
*/

html[dir="ltr"] .top-navbar .notification-dropdown,
html[dir="ltr"] .top-navbar .profile-dropdown,
html[dir="ltr"] .top-navbar .lang-dropdown {
    right: 0;
    left: auto;
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 768px) {

    /*
    |--------------------------------------------------------------------------
    | النقطة المهمة
    |--------------------------------------------------------------------------
    |
    | على الهاتف لا نربط القائمة بعرض الزر.
    | position: fixed يجعل الحساب بالنسبة للشاشة نفسها.
    |
    */

    .top-navbar .notification-dropdown,
    .top-navbar .profile-dropdown,
    .top-navbar .lang-dropdown {
        position: fixed !important;

        top: 75px !important;

        left: 12px !important;
        right: 12px !important;

        inset-inline-start: auto !important;
        inset-inline-end: auto !important;

        transform: none !important;
        margin: 0 auto !important;

        max-width: none !important;

        z-index: 999999 !important;
    }


    /* =====================================================
       Notifications
    ===================================================== */

    .top-navbar .notification-dropdown {
        width: auto !important;

        max-height: calc(100vh - 120px) !important;

        overflow-x: hidden !important;
        overflow-y: auto !important;

        border-radius: 16px;
    }


    /* =====================================================
       Profile
    ===================================================== */

    .top-navbar .profile-dropdown {
        width: auto !important;

        overflow: hidden !important;

        border-radius: 16px;
    }


    /* =====================================================
       Language
    ===================================================== */

    .top-navbar .lang-dropdown {
        width: auto !important;

        overflow: hidden !important;

        border-radius: 16px;
    }
}

.problem-reports-sidebar-badge {
    min-width: 21px;
    height: 21px;
    padding: 0 6px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    margin-inline-start: auto;

    border-radius: 999px;

    background: #dc3545;
    color: #fff;

    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

/* =========================================================
   SMALL PHONES
========================================================= */

@media (max-width: 480px) {

    .top-navbar .notification-dropdown,
    .top-navbar .profile-dropdown,
    .top-navbar .lang-dropdown {
        left: 8px !important;
        right: 8px !important;
    }

}
