/**
 * INFINITE RENOVATIONS - Collapsible Sidebar
 * DEV MODE: sidebar.css v4.0
 *
 * V3: Warm Terracotta & Espresso
 * Updated: Feb 10, 2026 - Warm theme transformation
 */

/* ========================================
   SIDEBAR CONTAINER
======================================== */
.sidebar {
    position: fixed;
    top: 28px; /* Account for dev banner */
    left: 0;
    bottom: 0;
    width: var(--sidebar-width-expanded);
    background: linear-gradient(180deg,
        rgba(36, 31, 26, 0.99) 0%,
        rgba(30, 27, 24, 0.98) 100%);
    border-right: 1px solid rgba(250, 243, 225, 0.06);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width 300ms cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    box-shadow:
        inset -1px 0 0 rgba(250, 243, 225, 0.03),
        4px 0 24px rgba(43, 37, 32, 0.4);
}

/* Collapsed State */
.sidebar.collapsed {
    width: var(--sidebar-width-collapsed);
}

.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .sidebar-footer-info {
    opacity: 0;
    visibility: hidden;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-brand {
    justify-content: center;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 10px;
}

.sidebar.collapsed .nav-icon {
    margin-right: 0;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed .sidebar-toggle {
    position: static;
    transform: none;
}

/* ========================================
   SIDEBAR HEADER - COMPACT
======================================== */
.sidebar-header {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(250, 243, 225, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    background: linear-gradient(180deg,
        rgba(250, 243, 225, 0.03) 0%,
        transparent 100%);
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 300ms ease;
}

.sidebar-logo {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #D4845A 0%, #F5D5B8 100%);
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow:
        inset 0 2px 4px rgba(250, 243, 225, 0.2),
        inset 0 -2px 4px rgba(43, 37, 32, 0.2),
        0 4px 12px rgba(212, 132, 90, 0.3);
    border: 1px solid rgba(250, 243, 225, 0.15);
}

.sidebar-logo svg {
    width: 18px;
    height: 18px;
    color: white;
}

.sidebar-brand-text {
    transition: opacity 200ms ease, visibility 200ms ease;
    white-space: nowrap;
}

.sidebar-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.sidebar-subtitle {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Toggle Button */
.sidebar-toggle {
    width: 28px;
    height: 28px;
    border: 1px solid rgba(250, 243, 225, 0.08);
    background: linear-gradient(180deg,
        rgba(61, 53, 46, 0.8) 0%,
        rgba(53, 47, 40, 0.7) 100%);
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 180ms ease;
    flex-shrink: 0;
    box-shadow:
        inset 0 1px 0 rgba(250, 243, 225, 0.08),
        0 2px 6px rgba(43, 37, 32, 0.3);
}

.sidebar-toggle:hover {
    background: linear-gradient(180deg,
        rgba(71, 63, 56, 0.9) 0%,
        rgba(61, 53, 46, 0.8) 100%);
    border-color: rgba(250, 243, 225, 0.12);
    color: var(--text-primary);
}

.sidebar-toggle svg {
    width: 14px;
    height: 14px;
    transition: transform 300ms ease;
}

.sidebar.collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

/* ========================================
   NAVIGATION - COMPACT, NO SCROLL
======================================== */
.sidebar-nav {
    flex: 1;
    padding: 6px 0;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* No scrollbar */
}

/* NAV ITEM - COMPACT, EVENLY SPACED */
.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all 180ms ease;
    text-decoration: none;
    position: relative;
    border-left: 3px solid transparent;
    background: transparent;
}

.nav-item:hover {
    background: rgba(250, 243, 225, 0.03);
    color: var(--text-secondary);
    border-left-color: rgba(250, 243, 225, 0.1);
}

.nav-item.active {
    background: linear-gradient(90deg,
        rgba(212, 132, 90, 0.15) 0%,
        transparent 100%);
    color: #F5D5B8;
    border-left-color: var(--primary);
}

.nav-item.active .nav-icon {
    color: #F5D5B8;
}

/* Nav Icon - FIXED SIZE */
.nav-icon {
    width: 20px;
    height: 20px;
    min-width: 20px;
    max-width: 20px;
    margin-right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: margin 200ms ease;
    color: currentColor;
}

.nav-icon svg {
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    stroke-width: 1.75;
    display: block;
}

.nav-label {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: opacity 200ms ease, visibility 200ms ease;
    line-height: 1;
}

.nav-badge {
    background: linear-gradient(180deg, #f85149 0%, #da3633 100%);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 0;
    min-width: 18px;
    text-align: center;
    transition: opacity 200ms ease, visibility 200ms ease;
    box-shadow:
        inset 0 1px 0 rgba(250, 243, 225, 0.2),
        0 2px 6px rgba(248, 81, 73, 0.4);
    margin-left: auto;
}

/* ========================================
   SIDEBAR FOOTER - COMPACT
======================================== */
.sidebar-footer {
    padding: 10px 12px;
    border-top: 1px solid rgba(250, 243, 225, 0.06);
    background: rgba(43, 37, 32, 0.1);
    flex-shrink: 0;
}

.sidebar.collapsed .sidebar-footer {
    padding: 10px;
    display: flex;
    justify-content: center;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px;
    border-radius: 0;
    cursor: pointer;
    transition: all 180ms ease;
}

.sidebar-user:hover {
    background: rgba(250, 243, 225, 0.03);
}

.sidebar-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 0;
    background: linear-gradient(135deg, #D4845A 0%, #F5D5B8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow:
        inset 0 1px 0 rgba(250, 243, 225, 0.2),
        0 2px 8px rgba(212, 132, 90, 0.25);
    border: 1px solid rgba(250, 243, 225, 0.1);
}

.sidebar-footer-info {
    flex: 1;
    min-width: 0;
    transition: opacity 200ms ease, visibility 200ms ease;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========================================
   MAIN CONTENT ADJUSTMENT
======================================== */
.main-content {
    margin-left: var(--sidebar-width-expanded);
    min-height: calc(100vh - 28px);
    transition: margin-left 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed ~ .main-content,
body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-width-collapsed);
}

/* ========================================
   MOBILE MENU BUTTON
======================================== */
.mobile-menu-btn {
    position: fixed;
    top: var(--dev-banner-height, 28px);
    left: 0;
    z-index: 101;
    width: 48px;
    height: var(--mobile-header-height, 44px);
    background: transparent;
    border: none;
    border-radius: 0;
    color: var(--text-secondary, #C4B8A8);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 200ms ease;
    padding: 0;
}

.mobile-menu-btn:hover,
.mobile-menu-btn:active {
    color: var(--text-primary, #FAF3E1);
    background: rgba(250, 243, 225, 0.06);
}

.mobile-menu-btn svg {
    width: 20px;
    height: 20px;
}

/* ========================================
   MOBILE STYLES
======================================== */
@media (max-width: 1024px) {
    .mobile-menu-btn {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width-expanded);
        box-shadow: 8px 0 40px rgba(43, 37, 32, 0.6);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        width: var(--sidebar-width-expanded);
    }

    .main-content,
    .sidebar.collapsed ~ .main-content,
    body.sidebar-collapsed .main-content {
        margin-left: 0;
    }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        top: 28px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(43, 37, 32, 0.6);
        backdrop-filter: blur(4px);
        z-index: 99;
    }

    .sidebar-backdrop.visible,
    .sidebar-backdrop.active {
        display: block;
    }
}

@media (min-width: 1025px) {
    .mobile-menu-btn {
        display: none !important;
    }

    .sidebar-backdrop {
        display: none !important;
    }
}

/* ========================================
   TOOLTIP FOR COLLAPSED STATE
======================================== */
.sidebar.collapsed .nav-item {
    position: relative;
}

.sidebar.collapsed .nav-item[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(180deg,
        rgba(53, 47, 40, 0.98) 0%,
        rgba(43, 37, 32, 0.95) 100%);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: 0;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 150ms ease;
    pointer-events: none;
    box-shadow:
        0 4px 16px rgba(43, 37, 32, 0.4),
        inset 0 1px 0 rgba(250, 243, 225, 0.06);
    border: 1px solid rgba(250, 243, 225, 0.08);
    z-index: 1000;
}

.sidebar.collapsed .nav-item:hover[data-tooltip]::after {
    opacity: 1;
    visibility: visible;
}

/* ========================================
   ALTERNATE HEADER LAYOUT (logo-icon/text)
======================================== */
.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #D4845A 0%, #F5D5B8 100%);
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow:
        inset 0 2px 4px rgba(250, 243, 225, 0.2),
        inset 0 -2px 4px rgba(43, 37, 32, 0.2),
        0 4px 12px rgba(212, 132, 90, 0.3);
    border: 1px solid rgba(250, 243, 225, 0.15);
    cursor: pointer;
    transition: all 180ms ease;
}

.logo-icon:hover {
    transform: scale(1.05);
    box-shadow:
        inset 0 2px 4px rgba(250, 243, 225, 0.25),
        inset 0 -2px 4px rgba(43, 37, 32, 0.2),
        0 6px 16px rgba(212, 132, 90, 0.4);
}

.logo-icon svg {
    width: 20px;
    height: 20px;
    color: white;
}

.logo-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    transition: opacity 200ms ease, visibility 200ms ease;
}

.sidebar.collapsed .logo-text {
    opacity: 0;
    visibility: hidden;
    width: 0;
    overflow: hidden;
}

/* User avatar in footer - alternate style */
.user-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 0;
    background: linear-gradient(135deg, #D4845A 0%, #F5D5B8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow:
        inset 0 1px 0 rgba(250, 243, 225, 0.2),
        0 2px 8px rgba(212, 132, 90, 0.25);
    border: 1px solid rgba(250, 243, 225, 0.1);
}

.user-info {
    flex: 1;
    min-width: 0;
    transition: opacity 200ms ease, visibility 200ms ease;
}

.sidebar.collapsed .user-info {
    opacity: 0;
    visibility: hidden;
    width: 0;
    overflow: hidden;
}

.user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
