/* Premium SaaS Expert Dual-Sidebar Navigation & Motion Design */

/* --- GLOBAL TRANSITIONS & MOTION --- */
.transition-250 { transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1); }
.animate-fade-up { animation: fadeUp 250ms cubic-bezier(0.4, 0, 0.2, 1) forwards; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIndicatorIn {
    from { opacity: 0; transform: scaleY(0.5); }
    to { opacity: 1; transform: scaleY(1); }
}

/* --- GRID TRANSITIONS --- */
.admin-layout, .client-layout {
    transition: grid-template-columns 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- SIDEBAR TOGGLE --- */
.sidebar-toggle-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: #64748b;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 150ms ease-in-out;
    cursor: pointer;
}
.sidebar-toggle-btn:hover {
    background: #f1f5f9;
    color: var(--primary);
}
.sidebar-toggle-btn:active, .expert-clickable:active {
    transform: scale(0.97);
}

/* --- PRIMARY SIDEBAR (Level 1) --- */
.admin-primary-sidebar, .client-primary-sidebar {
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    height: calc(100vh - var(--topbar-h));
    position: sticky;
    top: var(--topbar-h);
    z-index: 1060;
    display: flex;
    flex-direction: column;
    padding: 0;
    transition: width 250ms cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.primary-sidebar-header {
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    border-bottom: 1px solid transparent; 
    flex-wrap: nowrap;
    width: 260px; 
    justify-content: flex-end; /* Push hamburger to right when expanded */
}

body:not(.primary-expanded) .primary-sidebar-header {
    justify-content: center;
}

.sidebar-nav-container {
    padding: 1.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    overflow-y: auto;
}

.primary-nav-link {
    display: flex;
    align-items: center;
    padding: 0 14px;
    height: 48px;
    border-radius: 8px;
    color: #64748b;
    text-decoration: none !important;
    transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    overflow: hidden;
    width: 100%;
}

.primary-nav-link i {
    width: 24px;
    text-align: center;
    font-size: 1.1rem;
    transition: color 150ms;
}

body:not(.primary-expanded) .primary-nav-link {
    justify-content: center;
    padding: 0;
}

.primary-nav-link:hover {
    background: #f8fafc;
    color: var(--primary);
}

.primary-nav-link.active {
    background: rgba(var(--primary-rgb), 0.06);
    color: var(--primary);
    font-weight: 700;
}

.primary-nav-label {
    opacity: 0;
    transform: translateX(10px);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    margin-left: 14px;
    transition: opacity 150ms, transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
    display: none;
}

body.primary-expanded .primary-nav-label {
    display: inline-block;
    opacity: 1;
    transform: translateX(0);
    transition-delay: 50ms;
}

/* --- SECONDARY SIDEBAR (Level 2) --- */
.secondary-sidebar {
    background: #f8fafc;
    border-right: 1px solid #e2e8f0;
    height: calc(100vh - var(--topbar-h));
    position: sticky;
    top: var(--topbar-h);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: width 250ms cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.secondary-sidebar-header {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    width: 260px; /* Keep internal layout fixed, let parent wrapper clip it */
}

/* Title text disappears when minimal */
.secondary-title {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    transition: opacity 150ms;
}
body.primary-expanded .secondary-title {
    opacity: 0;
}

.secondary-links-container {
    padding: 1rem 0.75rem;
    overflow-y: auto;
    width: 260px; /* Full width internally */
}

.secondary-group-label {
    padding: 1rem 0.75rem 0.5rem;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #cbd5e1;
    transition: opacity 150ms;
}
body.primary-expanded .secondary-group-label {
    opacity: 0;
    height: 0;
    padding: 0;
    overflow: hidden;
}

.secondary-link {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    text-decoration: none !important;
    border-radius: 8px;
    transition: all 150ms ease;
    margin-bottom: 2px;
}

.secondary-link:hover {
    background: #e2e8f0;
    color: var(--primary);
}

.secondary-link.active {
    background: rgba(var(--primary-rgb), 0.08); /* Soft primary tint */
    color: var(--primary);
    font-weight: 700;
}

.secondary-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 15%;
    bottom: 15%;
    width: 3px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
    animation: slideIndicatorIn 200ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Initials Avatar / Icon Box for Minimal Mode */
.secondary-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #e2e8f0;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
    margin-right: 12px;
    transition: all 150ms;
}

.secondary-link:hover .secondary-icon {
    background: rgba(var(--primary-rgb), 0.15);
    color: var(--primary);
}

.secondary-link.active .secondary-icon {
    background: var(--primary);
    color: #ffffff;
}

/* Adjust layout when primary is expanded (Secondary is minimal) */
body.primary-expanded .secondary-sidebar {
    width: 70px;
}

body.primary-expanded .secondary-link {
    width: 44px;
    margin-left: 13px; /* Center it in the 70px container */
    padding: 0.6rem 0;
    justify-content: center;
}

body.primary-expanded .secondary-link .secondary-icon {
    margin-right: 0;
}

body.primary-expanded .secondary-label {
    display: none;
}

/* Scrollbars */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }
