﻿/* ============================================
   أصول CRM - Sidebar
   Premium Dark Tech Theme - elosool.com
   ============================================ */

.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--panel-blue-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-left: 1px solid var(--panel-blue-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Subtle pattern overlay on sidebar */
.sidebar::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035) 0%, transparent 28%, transparent 72%, rgba(255, 255, 255, 0.03) 100%);
    pointer-events: none;
    z-index: 0;
}

/* Glowing accent line on left border — landing gold */
.sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg,
            transparent 0%,
            rgba(204, 180, 120, 0.45) 20%,
            rgba(204, 180, 120, 0.85) 50%,
            rgba(176, 148, 77, 0.45) 80%,
            transparent 100%);
    box-shadow: 0 0 15px rgba(204, 180, 120, 0.35), 0 0 30px rgba(176, 148, 77, 0.16);
    z-index: 1;
}

/* Logo */
.sidebar-logo {
    padding: 14px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(204, 180, 120, 0.32);
    min-height: 56px;
    position: relative;
    z-index: 1;
    background: linear-gradient(180deg, rgba(204, 180, 120, 0.12) 0%, transparent 100%);
}

.sidebar-logo-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

/* Glow ring behind logo */
.sidebar-logo-icon::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(204, 180, 120, 0.35), rgba(176, 148, 77, 0.2));
    filter: blur(4px);
    z-index: -1;
}

.sidebar-logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 12px rgba(204, 180, 120, 0.45));
}

.sidebar-logo-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    min-width: 0;
}

.sidebar-logo-name {
    display: inline-flex;
    align-items: center;
    font-weight: 800;
    font-size: 1rem;
    color: #ffffff;
    line-height: 1;
    white-space: nowrap;
}

.sidebar-logo-name .brand-title-inner {
    display: inline-block;
    white-space: nowrap;
    line-height: 1.25;
    font-size: inherit;
    font-weight: inherit;
}

.sidebar-logo-name .brand-osool-word,
.sidebar-logo-name .brand-rest-word {
    display: inline;
    line-height: inherit;
    font-size: inherit;
    font-weight: inherit;
    font-family: var(--font);
    vertical-align: unset;
    transform: none;
    padding: 0;
    margin: 0;
}

.sidebar-logo-name .brand-osool-word {
    color: var(--osool-gold, #CCB478);
    text-shadow: 0 0 8px rgba(204, 180, 120, 0.28);
}

.sidebar-logo-name .brand-rest-word {
    color: #ffffff;
    letter-spacing: 0.04em;
}

.sidebar-logo-desc {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.88);
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.25;
    white-space: nowrap;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 8px;
    position: relative;
    z-index: 1;
}

.sidebar-section {
    margin-bottom: 8px;
}

.sidebar-section-title {
    display: block;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.4px;
    color: rgba(204, 180, 120, 0.72);
    margin: 10px 8px 6px;
    text-transform: uppercase;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.92);
    transition: var(--transition);
    margin-bottom: 2px;
    text-decoration: none;
    cursor: pointer;
    position: relative;
    font-size: 0.82rem;
    font-weight: 700;
    border: 1px solid transparent;
    white-space: nowrap;
}

.sidebar-item:hover {
    color: #ffffff;
    background: var(--osool-chrome-tab-bg, rgba(204, 180, 120, 0.14));
    border-color: rgba(204, 180, 120, 0.32);
    transform: translateX(-4px);
}

.sidebar-item.active {
    background: var(--osool-chrome-tab-bg, rgba(204, 180, 120, 0.14));
    color: #ffffff;
    font-weight: 800;
    box-shadow: inset 0 0 0 1px rgba(204, 180, 120, 0.35);
    border-color: var(--osool-chrome-tab-border, #B0944D);
    border-bottom: 2px solid var(--osool-gold, #CCB478);
    transform: translateX(-2px);
}

/* Active item glow effect */
.sidebar-item.active::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(204, 180, 120, 0.28), rgba(176, 148, 77, 0.14));
    filter: blur(8px);
    z-index: -1;
    opacity: 0.5;
}

.sidebar-item i {
    width: 18px;
    text-align: center;
    font-size: 0.88rem;
    flex-shrink: 0;
}

.sidebar-item .item-badge {
    margin-right: auto;
    margin-left: 0;
    background: var(--osool-gold, #CCB478);
    color: #1a1408;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 22px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(204, 180, 120, 0.35);
}

.sidebar-item.active .item-badge {
    background: rgba(255, 255, 255, 0.25);
    box-shadow: none;
}

.sidebar-item-featured {
    background: linear-gradient(135deg, rgba(121, 80, 242, 0.18), rgba(14, 165, 233, 0.08));
    border-color: rgba(147, 112, 255, 0.24);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.sidebar-item-featured:hover {
    background: linear-gradient(135deg, rgba(121, 80, 242, 0.26), rgba(14, 165, 233, 0.12));
    border-color: rgba(177, 153, 255, 0.34);
}

.sidebar-item-featured.active {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.95), rgba(59, 130, 246, 0.88));
    box-shadow: 0 8px 26px rgba(105, 72, 221, 0.34), 0 0 42px rgba(96, 165, 250, 0.12);
}

.item-badge-new {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.95), rgba(249, 115, 22, 0.95));
    color: #fff;
    box-shadow: 0 4px 14px rgba(249, 115, 22, 0.26);
}

.item-badge-alert {
    background: linear-gradient(135deg, #EF4444, #F97316);
    color: #fff;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
    animation: followupBadgePulse 2s ease-in-out infinite;
}

.item-badge-tasks {
    background: linear-gradient(135deg, #0EA5E9, #6366F1);
    color: #fff;
    box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
}

@keyframes followupBadgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

/* Logout */
.sidebar-footer {
    padding: 8px;
    border-top: 1px solid rgba(204, 180, 120, 0.22);
    position: relative;
    z-index: 1;
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.95);
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 800;
    width: 100%;
    border: 1px solid transparent;
    background: none;
    font-family: var(--font);
}

.sidebar-logout:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.35);
}

.sidebar-logout i {
    width: 20px;
    text-align: center;
}

/* Mobile overlay */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ============ MOBILE ============ */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(110%);
        z-index: 1000;
        width: 220px;
        box-shadow: none;
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: -20px 0 60px rgba(0,0,0,0.8);
    }

    .sidebar-item {
        padding: 11px 12px;
        font-size: 0.84rem;
        min-height: 42px;
    }

    .sidebar-logout {
        min-height: 42px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 100vw;
        border-radius: 0;
    }
}

/* ============ LTR (English) — sidebar stays on the left ============ */
[dir="ltr"] .sidebar {
    right: auto;
    left: 0;
    border-left: none;
    border-right: 1px solid var(--panel-blue-border);
}

[dir="ltr"] .sidebar::after {
    left: auto;
    right: 0;
}

[dir="ltr"] .main-content {
    margin-right: 0;
    margin-left: var(--sidebar-width);
}

[dir="ltr"] .main-content::before {
    left: var(--sidebar-width);
    right: 0;
}

@media (max-width: 992px) {
    [dir="ltr"] .sidebar {
        transform: translateX(-110%);
    }

    [dir="ltr"] .sidebar.active {
        transform: translateX(0);
        box-shadow: 20px 0 60px rgba(0, 0, 0, 0.8);
    }

    [dir="ltr"] .main-content {
        margin-left: 0;
        margin-right: 0;
    }

    [dir="ltr"] .main-content::before {
        left: 0;
        right: 0;
    }
}