/* ============================================================
   KING PRINTING — sidebar.css
   Sidebar layout, nav links, user profile, tooltips
   ============================================================ */

.sidebar {
    width: 280px;
    min-width: 280px;
    height: 100vh;
    background: linear-gradient(180deg, rgba(30,41,59,0.95) 0%, rgba(15,23,42,0.95) 100%);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(217,70,239,0.2);
    padding: 20px 0;
    overflow: hidden;
    transition: width 0.4s cubic-bezier(0.4,0,0.2,1);
    flex-shrink: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
}
.sidebar::-webkit-scrollbar       { width: 5px; }
.sidebar::-webkit-scrollbar-track  { background: rgba(0,0,0,0.1); }
.sidebar::-webkit-scrollbar-thumb  { background: rgba(217,70,239,0.4); border-radius: 4px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(217,70,239,0.7); }
.sidebar { scrollbar-width: thin; scrollbar-color: rgba(217,70,239,0.4) rgba(0,0,0,0.1); }

.sidebar.collapsed {
    width: 80px;
    min-width: 80px;
    padding: 15px 0;
}

/* ── Header ── */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(217,70,239,0.2);
    animation: slideInDown 0.6s ease-out;
}
.sidebar.collapsed .sidebar-header { justify-content: center; padding: 0 15px 20px; }

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.3s;
    white-space: nowrap;
    min-width: fit-content;
}
.sidebar.collapsed .logo { font-size: 24px; }

.logo-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 20px; flex-shrink: 0;
    animation: logoFloat 3s ease-in-out infinite;
}
@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-3px); }
}
.logo-text { display: block; }
.sidebar.collapsed .logo-text { display: none; }

.toggle-btn {
    width: 36px; height: 36px;
    border: 1px solid rgba(217,70,239,0.3);
    background: linear-gradient(135deg, rgba(217,70,239,0.2) 0%, rgba(249,115,22,0.2) 100%);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    transition: all 0.3s;
}
.toggle-btn:hover {
    background: linear-gradient(135deg, rgba(217,70,239,0.4) 0%, rgba(249,115,22,0.4) 100%);
    transform: rotate(90deg);
}

/* ── User Profile ── */
.user-profile {
    padding: 16px 20px;
    margin: 0 10px 10px;
    background: linear-gradient(135deg, rgba(217,70,239,0.1) 0%, rgba(249,115,22,0.1) 100%);
    border: 1px solid rgba(217,70,239,0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    animation: slideInUp 0.6s ease-out 0.1s both;
}
.user-profile::before {
    content: '';
    position: absolute;
    top: -50%; right: -50%;
    width: 200%; height: 200%;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
    transition: all 0.6s;
    opacity: 0;
}
.user-profile:hover::before { opacity: 1; animation: shimmer 0.6s; }
@keyframes shimmer {
    0%   { transform: translate(-100%, -100%); }
    100% { transform: translate(100%, 100%); }
}
.user-profile:hover {
    background: linear-gradient(135deg, rgba(217,70,239,0.15) 0%, rgba(249,115,22,0.15) 100%);
    border-color: rgba(217,70,239,0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(217,70,239,0.2);
}
.sidebar.collapsed .user-profile { padding: 12px; margin: 0 5px 10px; }

.profile-info   { display: flex; align-items: center; gap: 12px; }
.profile-avatar {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 18px; flex-shrink: 0;
    position: relative;
}
.profile-avatar::after {
    content: '';
    position: absolute;
    bottom: 0; right: 0;
    width: 12px; height: 12px;
    background: var(--success);
    border: 2px solid var(--card-bg);
    border-radius: 50%;
    animation: pulseOnline 2s ease-in-out infinite;
}
@keyframes pulseOnline {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.7); }
    50%       { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
}
.profile-text    { flex: 1; min-width: 0; }
.profile-name    { font-size: 13px; font-weight: 600; color: var(--text-primary); display: block; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-role    { font-size: 11px; color: var(--text-muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar.collapsed .profile-text { display: none; }

/* ── User Info box ── */
.user-info {
    padding: 12px 15px;
    margin: 0 10px 15px;
    background: linear-gradient(135deg, rgba(217,70,239,0.08) 0%, rgba(249,115,22,0.08) 100%);
    border: 1px solid rgba(217,70,239,0.2);
    border-radius: 10px;
    font-size: 12px;
    color: var(--text-muted);
    animation: slideInUp 0.6s ease-out 0.3s both;
}
.sidebar.collapsed .user-info { display: none; }
.user-info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(217,70,239,0.1);
}
.user-info-row:last-child { margin-bottom: 0; border-bottom: none; padding-bottom: 0; }
.user-info-label { color: var(--text-muted); }
.user-info-value { color: var(--text-primary); font-weight: 600; }

/* ── Nav Menu ── */
.nav-menu {
    flex: 1;
    min-height: 0;
    padding: 10px;
    overflow-y: auto;
    overflow-x: hidden;
}
.nav-menu::-webkit-scrollbar       { width: 6px; }
.nav-menu::-webkit-scrollbar-thumb { background: rgba(217,70,239,0.2); border-radius: 3px; }

.nav-section       { margin-bottom: 20px; }
.nav-section-title {
    font-size: 11px; font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 15px 10px;
    letter-spacing: 0.5px;
    display: block;
    transition: all 0.3s;
}
.sidebar.collapsed .nav-section-title { display: none; }

.nav-item {
    position: relative;
    margin-bottom: 8px;
    animation: slideInLeft 0.5s ease-out backwards;
}
.nav-item:nth-child(1) { animation-delay: .10s; }
.nav-item:nth-child(2) { animation-delay: .15s; }
.nav-item:nth-child(3) { animation-delay: .20s; }
.nav-item:nth-child(4) { animation-delay: .25s; }
.nav-item:nth-child(5) { animation-delay: .30s; }
.nav-item:nth-child(6) { animation-delay: .35s; }
.nav-item:nth-child(7) { animation-delay: .40s; }
.nav-item:nth-child(8) { animation-delay: .45s; }
.nav-item:nth-child(9) { animation-delay: .50s; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
    font-size: 14px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid transparent;
}
.nav-link::before {
    content: '';
    position: absolute; left: 0; top: 0;
    width: 4px; height: 100%;
    background: linear-gradient(180deg, var(--primary) 0%, var(--accent) 100%);
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.nav-link:hover::before { transform: scaleY(1); }
.nav-link:hover {
    background: linear-gradient(135deg, rgba(217,70,239,0.15) 0%, rgba(249,115,22,0.15) 100%);
    color: var(--text-primary);
    transform: translateX(4px);
    border-color: rgba(217,70,239,0.3);
}
.nav-link.active {
    background: linear-gradient(135deg, rgba(217,70,239,0.25) 0%, rgba(249,115,22,0.25) 100%);
    color: var(--text-primary);
    border-color: rgba(217,70,239,0.5);
    font-weight: 600;
}

.nav-icon {
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; flex-shrink: 0;
    transition: all 0.3s;
    background: linear-gradient(135deg, rgba(217,70,239,0.2) 0%, rgba(249,115,22,0.2) 100%);
    border-radius: 6px;
    position: relative;
}
.nav-link:hover .nav-icon {
    background: linear-gradient(135deg, rgba(217,70,239,0.4) 0%, rgba(249,115,22,0.4) 100%);
    transform: scale(1.1) rotate(5deg);
}
.nav-link.active .nav-icon {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
}

.nav-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar.collapsed .nav-text { display: none; }

/* ── Badge ── */
.badge {
    display: inline-flex;
    align-items: center; justify-content: center;
    min-width: 20px; height: 20px;
    padding: 0 6px;
    background: linear-gradient(135deg, var(--danger) 0%, var(--warning) 100%);
    color: white; font-size: 11px; font-weight: 700;
    border-radius: 10px; flex-shrink: 0;
    animation: badgePulse 2s ease-in-out infinite;
}
@keyframes badgePulse {
    0%, 100% { transform: scale(1);    box-shadow: 0 0 0 0 rgba(239,68,68,0.7); }
    50%       { transform: scale(1.05); box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}
.sidebar.collapsed .badge {
    position: absolute; top: 8px; right: 8px;
    min-width: 24px; height: 24px;
}

/* ── Tooltip ── */
.tooltip-wrapper { position: relative; }
.tooltip {
    position: absolute;
    left: 100%; top: 50%;
    transform: translateY(-50%) translateX(10px);
    background: rgba(15,23,42,0.98);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
    border: 1px solid rgba(217,70,239,0.3);
    z-index: 200;
    backdrop-filter: blur(10px);
}
.tooltip::before {
    content: '';
    position: absolute;
    right: 100%; top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: rgba(217,70,239,0.3);
}
.sidebar.collapsed .tooltip-wrapper:hover .tooltip {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* ── Sidebar footer (logout) ── */
.sidebar-footer {
    padding: 15px;
    border-top: 1px solid rgba(217,70,239,0.15);
    margin-top: auto;
}
.sidebar.collapsed .sidebar-footer-text { display: none; }
.logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: 8px;
    color: #f87171;
    font-size: 13px;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.3s;
}
.logout-btn:hover {
    background: rgba(239,68,68,0.2);
    border-color: rgba(239,68,68,0.4);
    transform: translateX(2px);
}

/* Mobile sidebar */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -300px;
        top: 0; bottom: 0;
        z-index: 600;
        transition: left 0.3s cubic-bezier(0.4,0,0.2,1);
        width: 280px !important;
        min-width: 280px !important;
    }
    .sidebar.open { left: 0; }
    .mobile-header { display: flex !important; }
    .bottom-nav    { display: flex !important; }
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 599;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }
