:root {
    --rahmah-primary: #16a6a0;
    --rahmah-primary-dark: #0d7f7a;
    --rahmah-primary-soft: #e7f8f7;
    --rahmah-primary-soft-strong: #d6f1ee;
    --rahmah-ink: #123432;
    --rahmah-text: #264543;
    --rahmah-white: #ffffff;
    --rahmah-border: rgba(22, 166, 160, 0.18);
    --rahmah-shadow: 0 18px 36px rgba(13, 127, 122, 0.14);
    --rahmah-mobile-sidebar-top: 126px;
}

html,
body {
    min-height: 100%;
    width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    margin: 0;
    padding: 0;
    font-family: 'Cairo', sans-serif;
    background:
        radial-gradient(circle at top right, rgba(22, 166, 160, 0.14), transparent 24%),
        linear-gradient(180deg, #fbfefd 0%, #f1f8f7 100%);
    color: var(--rahmah-ink);
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(22, 166, 160, 0.08);
}

::-webkit-scrollbar-thumb {
    background: rgba(13, 127, 122, 0.45);
    border-radius: 999px;
}

@keyframes mobile-sidebar-toggle-pulse {
    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 12px 26px rgba(103, 42, 18, 0.24);
    }

    50% {
        transform: scale(1.06);
        box-shadow: 0 16px 32px rgba(103, 42, 18, 0.34);
    }
}

.sidebar {
    flex: 0 0 clamp(220px, 21vw, 280px);
    width: clamp(220px, 21vw, 280px);
    min-width: 210px;
    max-width: 100%;
    position: fixed;
    top: 0;
    right: 0;
    height: 100dvh;
    max-height: 100dvh;
    padding: clamp(16px, 2vw, 24px) clamp(12px, 1.8vw, 16px);
    display: flex;
    flex-direction: column;
    z-index: 2;
    box-sizing: border-box;
    border-left: 1px solid var(--rahmah-border);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(14px);
    box-shadow:
        -18px 0 34px rgba(13, 127, 122, 0.12),
        -6px 0 14px rgba(13, 127, 122, 0.08),
        var(--rahmah-shadow);
    overflow-y: auto;
    isolation: isolate;
}

.sidebar::before {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: 28px;
    border: 1px solid rgba(22, 166, 160, 0.14);
    background:
        radial-gradient(circle at top center, rgba(255, 255, 255, 0.55), transparent 28%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(236, 247, 246, 0.35));
    pointer-events: none;
    z-index: -1;
}

.sidebar::after {
    content: "";
    position: absolute;
    inset: 18px 16px auto;
    height: 180px;
    border-radius: 28px;
    background:
        radial-gradient(circle at 50% 0%, rgba(22, 166, 160, 0.14), transparent 56%),
        radial-gradient(circle at 20% 30%, rgba(110, 168, 217, 0.1), transparent 26%),
        radial-gradient(circle at 80% 24%, rgba(22, 166, 160, 0.08), transparent 24%);
    pointer-events: none;
    z-index: -1;
}

.logo-container {
    margin: 0 0 18px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    /* تقليل الارتفاع الأدنى من 180px إلى 120px أو حسب ما تراه مناسباً */
    min-height: clamp(108px, 15vw, 132px);
    flex-shrink: 0;
    /* تقليل الحشو (التنفس الداخلي) */
    padding: 14px;
    background:
        radial-gradient(circle at top center, rgba(255, 255, 255, 0.92), transparent 34%),
        linear-gradient(180deg, #ffffff 0%, #eef9f8 100%);
    border: 1px solid rgba(22, 166, 160, 0.16);
    border-radius: 30px;
    box-shadow:
        0 16px 30px rgba(13, 127, 121, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.logo-container::before {
    content: "";
    position: absolute;
    inset: 14px;
    border: 1px dashed rgba(22, 166, 160, 0.26);
    border-radius: 24px;
}

.logo-img {
    max-width: min(188px, 100%);
    width: 100%;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 10px 18px rgba(13, 127, 122, 0.16));
}

.nav-scroll-wrapper {
    position: relative;
    display: flex;
    flex: 1;
    min-height: 0;
}

.nav-scroll-hint {
    display: none;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex: 1;
    min-height: 0;
    padding: 12px;
    border-radius: 28px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(234, 247, 245, 0.72));
    border: 1px solid rgba(22, 166, 160, 0.12);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.92),
        0 14px 28px rgba(13, 127, 122, 0.06);
}

.nav-link {
    position: relative;
    display: flex;
    flex-direction: row-reverse;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding: 14px 18px;
    margin-bottom: 10px;
    text-decoration: none;
    color: var(--rahmah-ink);
    border-radius: 20px;
    border: 1px solid rgba(13, 127, 122, 0.16);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(240, 249, 248, 0.94));
    box-shadow:
        0 8px 18px rgba(13, 127, 122, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.92);
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease, color 0.25s ease;
    outline: none;
}

.nav-link::before {
    content: "";
    position: absolute;
    top: 10px;
    bottom: 10px;
    right: 10px;
    width: 4px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(22, 166, 160, 0.1), rgba(22, 166, 160, 0));
    transition: opacity 0.25s ease, transform 0.25s ease, background 0.25s ease;
    opacity: 0.7;
}

.nav-link span {
    flex: 1;
    line-height: 1.25;
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: right;
    font-size: clamp(0.95rem, 0.4vw + 0.88rem, 1rem);
    font-weight: 700;
    color: #0b6662;
}

.nav-link i,
.nav-link svg {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    color: #0d7f7a;
}

.nav-link:hover,
.nav-link:focus {
    transform: translateX(-4px);
    border-color: rgba(13, 127, 122, 0.32);
    background: linear-gradient(135deg, rgba(224, 246, 243, 1), rgba(255, 255, 255, 1));
    box-shadow:
        0 14px 28px rgba(13, 127, 122, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.nav-link:hover span,
.nav-link:focus span,
.nav-link:hover i,
.nav-link:focus i,
.nav-link:hover svg,
.nav-link:focus svg {
    color: #084f4c;
}

.nav-link:hover::before,
.nav-link:focus::before {
    background: linear-gradient(180deg, rgba(22, 166, 160, 0.58), rgba(22, 166, 160, 0.1));
    opacity: 1;
    transform: scaleY(1.04);
}

.nav-link.active {
    transform: translateX(-6px);
    border-color: rgba(9, 92, 87, 0.9);
    background: linear-gradient(135deg, #0f8f89 0%, #0c7470 48%, #095b57 100%);
    box-shadow: 0 16px 34px rgba(9, 92, 87, 0.28);
}

.nav-link.active::before {
    top: 10px;
    bottom: 10px;
    right: 10px;
    width: 5px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 0 14px rgba(255, 255, 255, 0.32);
    opacity: 1;
}

.nav-link.active span,
.nav-link.active i,
.nav-link.active svg {
    color: #ffffff;
}

.nav-link:active {
    transform: translateX(-2px) scale(0.99);
}

.sidebar-footer {
    display: grid;
    gap: 12px;
    margin-top: auto;
    padding-top: 14px;
}

.sidebar-hotline {
    position: relative;
    padding: 14px 14px 16px;
    border-radius: 24px;
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.94), transparent 30%),
        radial-gradient(circle at bottom left, rgba(110, 168, 217, 0.14), transparent 36%),
        linear-gradient(180deg, rgba(248, 253, 252, 0.98), rgba(234, 247, 245, 0.96));
    border: 1px solid rgba(22, 166, 160, 0.2);
    box-shadow:
        0 12px 24px rgba(13, 127, 122, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.92);
    text-align: center;
    overflow: hidden;
}

.sidebar-hotline::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #16a6a0, #6ea8d9, #d8a73c);
}

.sidebar-hotline-label {
    color: #0f6c68;
    font-size: 0.96rem;
    font-weight: 900;
    line-height: 1.6;
}

.sidebar-hotline-phone-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    color: #c31919;
    box-shadow: 0 0 0 0 rgba(211, 25, 25, 0.28);
    animation: hotline-phone-pulse 1.6s ease-out infinite;
}

.sidebar-hotline-phone-icon::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 1px solid rgba(211, 25, 25, 0.28);
    animation: hotline-phone-ring 1.6s ease-out infinite;
}

.sidebar-hotline-number-call {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.sidebar-hotline-number {
    display: inline-block;
    margin-top: 8px;
    color: #114f62;
    font-family: 'Share Tech Mono', 'Cairo', sans-serif;
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-decoration: none;
    direction: ltr;
}

.sidebar-hotline-number:hover,
.sidebar-hotline-number:focus {
    color: #0d7f7a;
}

.sidebar-hotline-alert {
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.94), transparent 30%),
        linear-gradient(180deg, rgba(255, 245, 245, 0.98), rgba(255, 234, 234, 0.96));
    border-color: rgba(201, 38, 38, 0.18);
    box-shadow:
        0 12px 24px rgba(167, 31, 31, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.sidebar-hotline-alert::before {
    background: linear-gradient(90deg, #d71919, #ff6b6b);
}

.sidebar-hotline-alert .sidebar-hotline-label {
    color: #b11212;
}

.sidebar-hotline-alert .sidebar-hotline-number {
    color: #d20000;
}

.sidebar-hotline-alert .sidebar-hotline-number:hover,
.sidebar-hotline-alert .sidebar-hotline-number:focus {
    color: #a70000;
}

@keyframes hotline-phone-pulse {
    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(211, 25, 25, 0.24);
    }

    40% {
        transform: scale(1.08);
        box-shadow: 0 0 0 10px rgba(211, 25, 25, 0);
    }
}

@keyframes hotline-phone-ring {
    0% {
        opacity: 0.7;
        transform: scale(0.9);
    }

    100% {
        opacity: 0;
        transform: scale(1.3);
    }
}

@media screen and (max-width: 1024px) and (hover: none),
screen and (max-width: 1024px) and (pointer: coarse) {

    html,
    body {
        height: auto;
        width: 100%;
        overflow-y: auto;
        flex-direction: column;
    }

    .sidebar {
        flex: none;
        position: fixed;
        top: var(--rahmah-mobile-sidebar-top);
        right: auto;
        left: 0;
        right: 0;
        display: flex;
        width: 100%;
        min-width: 0;
        height: auto;
        max-height: none;
        margin: 0;
        border-left: none;
        border-top: none;
        border-bottom: 1px solid var(--rahmah-border);
        padding: 12px;
        box-shadow: 0 10px 26px rgba(13, 127, 122, 0.12);
        background: rgba(255, 255, 255, 0.98);
        z-index: 95;
        transition: transform 0.28s ease, opacity 0.28s ease, box-shadow 0.28s ease;
        will-change: transform;
    }

    body.mobile-sidebar-collapsed .sidebar {
        transform: translateY(calc(-100% - 10px));
        opacity: 0.98;
        box-shadow: none;
    }

    .mobile-sidebar-toggle {
        position: fixed;
        top: calc(var(--rahmah-mobile-sidebar-top) + 16px);
        left: calc(50% - 150px);
        width: 40px;
        height: 40px;
        border: 0;
        border-radius: 999px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: linear-gradient(135deg, #ffb34d 0%, #f28c28 55%, #c85c1e 100%);
        color: #ffffff;
        box-shadow: 0 12px 26px rgba(103, 42, 18, 0.24);
        z-index: 110;
        cursor: pointer;
        transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
        animation: mobile-sidebar-toggle-pulse 1.8s ease-in-out infinite;
    }

    .mobile-sidebar-toggle:hover,
    .mobile-sidebar-toggle:focus-visible {
        transform: translateY(-1px);
        box-shadow: 0 16px 30px rgba(103, 42, 18, 0.3);
        outline: none;
    }

    .mobile-sidebar-toggle i {
        font-size: 1rem;
        line-height: 1;
    }

    .sidebar::before,
    .sidebar::after {
        display: none;
    }

    .logo-container {
        display: flex;
        width: min(100%, 180px);
        min-height: auto;
        margin: 0 auto 12px;
        padding: 8px 10px;
        border-radius: 20px;
    }

    .logo-container::before {
        inset: 8px;
        border-radius: 14px;
    }

    .logo-img {
        max-width: 112px;
    }

    .sidebar nav {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: visible;
        gap: 12px;
        min-height: auto;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .nav-link {
        min-width: clamp(150px, 38vw, 200px);
        margin: 0;
        flex-shrink: 0;
    }

    .nav-scroll-wrapper {
        position: relative;
        width: 100%;
        display: flex;
        align-items: center;
        overflow: hidden;
        min-height: auto;
    }

    .nav-scroll-hint {
        position: absolute;
        top: 0;
        bottom: 8px;
        width: 34px;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 2;
        opacity: 0;
        transition: opacity 0.25s ease;
        color: var(--rahmah-primary-dark);
    }

    .hint-left {
        left: 0;
        background: linear-gradient(90deg, rgba(255, 255, 255, 0.95), transparent);
    }

    .hint-right {
        right: 0;
        background: linear-gradient(-90deg, rgba(255, 255, 255, 0.95), transparent);
    }

    .nav-scroll-hint.visible {
        opacity: 1;
    }

    .sidebar-footer {
        margin-top: 14px;
        padding-top: 0;
    }
}

@media screen and (max-width: 640px) and (hover: none),
screen and (max-width: 640px) and (pointer: coarse) {
    .sidebar {
        top: var(--rahmah-mobile-sidebar-top);
        padding: 12px;
    }

    .mobile-sidebar-toggle {
        top: calc(var(--rahmah-mobile-sidebar-top) + 14px);
        left: calc(50% - 126px);
        width: 36px;
        height: 36px;
    }

    .logo-container {
        width: min(100%, 150px);
        margin-bottom: 10px;
        padding: 7px 8px;
        border-radius: 18px;
    }

    .logo-container::before {
        inset: 7px;
        border-radius: 12px;
    }

    .logo-img {
        max-width: 92px;
    }

    .sidebar nav {
        gap: 10px;
    }

    .nav-link {
        min-width: min(62vw, 150px);
        padding: 10px 12px;
        justify-content: center;
        gap: 8px;
        border-radius: 16px;
    }

    .nav-link i {
        flex: 0 0 auto;
        font-size: 0.92rem;
    }

    .nav-link span {
        font-size: 0.88rem;
        text-align: center;
    }

    .sidebar-footer {
        gap: 0;
        overflow: hidden;
        border-radius: 16px;
        background:
            linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(238, 247, 246, 0.98));
        border: 1px solid rgba(22, 166, 160, 0.18);
        box-shadow: 0 8px 18px rgba(13, 127, 122, 0.08);
    }

    .sidebar-footer > .sidebar-hotline:first-child {
        display: none;
    }

    .sidebar-hotline {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        padding: 7px 10px;
        border-radius: 0;
        box-shadow: none;
        border: 0;
        background: transparent;
    }

    .sidebar-hotline-label {
        font-size: 0.7rem;
        line-height: 1.25;
        margin: 0;
        text-align: right;
    }

    .sidebar-hotline-number {
        margin-top: 0;
        font-size: 0.9rem;
        line-height: 1;
        white-space: nowrap;
    }

    .sidebar-hotline-number-call {
        flex-shrink: 0;
        gap: 5px;
    }

    .sidebar-hotline-phone-icon {
        width: 22px;
        height: 22px;
        font-size: 0.74rem;
    }

    .sidebar-hotline-phone-icon::after {
        inset: -3px;
    }

    .sidebar-hotline + .sidebar-hotline {
        border-top: 1px solid rgba(22, 166, 160, 0.14);
    }

    .sidebar-hotline-alert {
        border-radius: 16px;
        background: linear-gradient(180deg, rgba(255, 245, 245, 0.72), rgba(255, 234, 234, 0.82));
    }
}

@media screen and (min-width: 1025px) and (max-width: 1365px) {
    .sidebar {
        flex-basis: clamp(210px, 20vw, 250px);
        width: clamp(210px, 20vw, 250px);
    }

    .nav-link {
        padding: 13px 15px;
    }
}

@media screen and (max-width: 1500px) and (hover: hover) and (pointer: fine) {
    .sidebar {
        flex-basis: var(--sidebar-width-compact);
        width: var(--sidebar-width-compact);
        min-width: var(--sidebar-width-compact);
        padding: 12px 10px;
    }

    .logo-container {
        min-height: 88px;
        padding: 10px;
        border-radius: 22px;
    }

    .logo-container::before {
        inset: 10px;
        border-radius: 18px;
    }

    .logo-img {
        max-width: 138px;
    }

    .nav-link {
        padding: 12px 14px;
        border-radius: 16px;
    }

    .nav-link span {
        font-size: 0.9rem;
    }
}
