/* ============================================================
   IncrediBuild V3 Sidebar - Complete Layout Engine CSS
   ============================================================ */

/* 1. Mobile Safety Cutoff */
@media (max-width: 1023px) {
    .v3-sidebar-master-container {
        display: none !important;
    }
}

/* 2. Desktop Framework Architecture */
@media (min-width: 1024px) {
    
    /* Responsive structural wrap managed dynamically via JS calculations */
    .v3-sidebar-master-container {
        position: fixed;
        left: 0;
        width: auto;
        z-index: 999; /* Sits over body blocks, under dropdown menus */
        pointer-events: none; 
        display: flex;
        align-items: center;
    }

    /* Left Navigation Rail Frame */
    .v3r {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        z-index: 10;
        background: rgba(10, 10, 11, 0.85); /* Slightly darker for better layout separation */
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        align-items: center;
        width: 64px;
        padding: 24px 8px;
        border-right: 1px solid var(--border, #222630);
        border-top: 0;
        border-bottom: 0;
        border-left: 0;
        pointer-events: auto;
        box-sizing: border-box;
        transition: height 40ms linear; /* Keeps frame resizing smooth */
    }

    .v3r-label {
        font-family: var(--font-mono, monospace);
        font-size: 10px;
        font-weight: 600;
        letter-spacing: .18em;
        text-transform: uppercase;
        color: var(--text-3, #64748b);
        white-space: nowrap;
        writing-mode: vertical-rl;
        transform: rotate(180deg);
        padding: 6px 0;
        margin-bottom: auto;
    }

    .v3r-items {
        display: flex;
        flex-direction: column;
        gap: 16px;
        align-items: center;
        margin-bottom: auto;
    }

    .v3r-dismiss {
        width: 22px;
        height: 22px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 6px;
        background: transparent;
        border: 0;
        color: var(--text-4, #475569);
        cursor: pointer;
        transition: all 160ms ease;
        margin-top: auto;
    }
    
    .v3r-dismiss:hover {
        color: #fff;
        background: rgba(255, 255, 255, .06);
    }

    /* Selector Targets */
    .v3r-pip {
        position: relative;
        width: 36px;
        height: 36px;
        border-radius: 8px;
        background: rgba(255, 255, 255, .03);
        border: 1px solid var(--border, #222630);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 200ms ease;
        color: #fff;
        padding: 0;
        flex: none;
    }

    .v3r-pip:hover {
        border-color: rgba(1, 235, 156, .55);
        background: rgba(1, 235, 156, .06);
    }

    .v3r-pip.active {
        border-color: rgba(1, 235, 156, .55);
        background: rgba(1, 235, 156, .10);
    }

    .v3r-pip.has-new::after {
        content: "";
        position: absolute;
        top: -2px;
        right: -2px;
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: var(--brand-green, #01eb9c);
        border: 1px solid #0A0A0B;
    }

    .v3r-pip .pip-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    .v3r-pip .pip-icon.green  { color: var(--brand-green, #01eb9c); }
    .v3r-pip .pip-icon.blue   { color: var(--brand-blue, #00b0f0); }
    .v3r-pip .pip-icon.yellow { color: var(--brand-yellow, #eab308); }

    .sidebar-custom-icon {
        display: block;
        width: 16px;
        height: 16px;
        object-fit: contain;
        opacity: 0.65;
        transition: opacity 160ms ease;
    }

    .v3r-pip:hover .sidebar-custom-icon,
    .v3r-pip.active .sidebar-custom-icon {
        opacity: 1;
    }

    /* ------------------------------------------------------------
       3. Hover Popover Sub-System
       ------------------------------------------------------------ */
    .v3r-popups-layer {
        position: absolute;
        left: 76px; 
        top: 35%; /* Centers the popovers relative to the rail height */
        transform: translateY(-50%);
        pointer-events: auto;
    }

    .v3r-pop {
        position: absolute;
        z-index: 20;
        width: 340px;
        background: var(--surface, #11141a);
        border: 1px solid var(--border-strong, #222630);
        border-radius: 12px;
        padding: 20px;
        box-shadow: 0 30px 80px -10px rgba(0, 0, 0, .7);
        display: none;
        opacity: 0;
        transform: translateX(-8px);
        transition: opacity 220ms ease, transform 220ms ease;
    }

    .v3r-pop.open {
        display: block;
        opacity: 1;
        transform: translateX(0);
    }

    .v3r-pop-head {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
    }

    .v3r-pop-head .t {
        font-family: var(--font-mono, monospace);
        font-size: 10px;
        font-weight: 600;
        letter-spacing: .14em;
        text-transform: uppercase;
        color: var(--text-3, #64748b);
    }

    .v3r-pop .title {
        font-size: 18px;
        font-weight: 600;
        line-height: 1.3;
        margin: 8px 0 12px;
        color: #fff;
        text-wrap: pretty;
    }

    .v3r-pop .sub {
        font-family: var(--font-mono, monospace);
        font-size: 11px;
        letter-spacing: .08em;
        text-transform: uppercase;
        color: var(--text-3, #64748b);
        margin-bottom: 16px;
    }

    .tag-pill {
        color: #000;
        font-family: var(--font-mono, monospace);
        font-size: 10px;
        font-weight: 700;
        padding: 4px 8px;
        border-radius: 4px;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    .read-more {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        font-size: 13px;
        color: var(--brand-green, #01eb9c);
        text-decoration: none;
        font-weight: 600;
        transition: opacity 160ms ease;
    }

    .read-more:hover {
        opacity: 0.8;
    }
}