/* Sidebar - Navigation, Brand, Footer */

/* ── Layout ────────────────────────────────────────── */

.app-container {

    display: flex;

    min-height: 100vh;

}



/* ── Sidebar ───────────────────────────────────────── */

.sidebar {

    width: 186px;

    background: rgba(8, 10, 20, 0.95);

    backdrop-filter: blur(24px);

    border-right: 1px solid var(--border-color);

    padding: 40px 8px 12px 8px; /* extra top for drag region */

    display: flex;

    flex-direction: column;

    position: fixed;

    top: 0;

    bottom: 0;

    left: 0;

    z-index: 100;

    transition: width var(--transition-base);

    overflow: hidden;

}



/* Ensure sidebar interactive elements are clickable (not dragged) */

.sidebar button,

.sidebar a,

.sidebar .nav-link,

.sidebar .tool-ctrl-btn {

    -webkit-app-region: no-drag;

}



.brand-section {

    position: relative;

    display: block;

    min-height: 62px;

    margin-bottom: 14px;

    padding: 0 4px;

}



.brand-logo {

    position: absolute;

    top: 0;

    left: 4px;

    width: 58px;

    height: 58px;

    background: rgba(6, 24, 39, 0.78);

    border-radius: 13px;

    display: flex;

    align-items: center;

    justify-content: center;

    overflow: hidden;

    border: 1px solid rgba(125, 211, 252, 0.16);

    box-shadow: 0 0 15px rgba(34, 211, 238, 0.22);

    animation: logo-glow 3s ease-in-out infinite alternate;

}

.brand-logo img {

    width: 100%;

    height: 100%;

    object-fit: cover;

    display: block;

}



@keyframes logo-glow {

    0%   { box-shadow: 0 0 12px rgba(99, 102, 241, 0.25); }

    100% { box-shadow: 0 0 20px rgba(139, 92, 246, 0.4); }

}



.brand-name {

    position: absolute;

    top: 24px;

    left: 69px;

    font-size: 21px;

    font-weight: 800;

    letter-spacing: 1.4px;

    background: linear-gradient(135deg, #ffffff 0%, #c084fc 100%);

    -webkit-background-clip: text;

    -webkit-text-fill-color: transparent;

    text-transform: uppercase;

}



/* ── Navigation ────────────────────────────────────── */

.tool-nav {

    display: flex;

    flex: 1;

    min-height: 0;

    flex-direction: column;

    position: relative;

    overflow: visible;

}



.tool-scroll-button {

    position: absolute;

    left: 50%;

    z-index: 3;

    width: 24px;

    height: 24px;

    border: 1px solid rgba(139, 92, 246, 0.42);

    border-radius: 50%;

    padding: 0;

    color: #c4b5fd;

    background: rgba(99, 102, 241, 0.14);

    font-size: 12px;

    line-height: 22px;

    cursor: pointer;

    opacity: 0.9;

    transform: translateX(-50%);

}

#tool-scroll-up { top: -19px; }

#tool-scroll-down { bottom: -19px; }



.tool-scroll-button:hover {
    border-color: rgba(167, 139, 250, 0.8);
    color: #fff;
    background: rgba(124, 58, 237, 0.28);
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.28);
    opacity: 1;
}

.tool-scroll-button[hidden] { display: none; }

.nav-list {

    list-style: none;

    display: flex;

    flex-direction: column;

    gap: 6px;

    flex: 1;

    min-height: 0;

    overflow-y: auto;

    overscroll-behavior: contain;

    padding-right: 3px;

    scrollbar-width: thin;

    scrollbar-color: rgba(139, 92, 246, 0.55) transparent;

}



.nav-list::-webkit-scrollbar { width: 3px; }

.nav-list::-webkit-scrollbar-track { background: transparent; }

.nav-list::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(96, 165, 250, 0.65), rgba(139, 92, 246, 0.72));
}



.nav-item { width: 100%; }



.tool-item {

    cursor: grab;

    transition: transform 160ms ease, opacity 160ms ease;

}



.tool-item:active { cursor: grabbing; }



.tool-item.dragging {

    opacity: 0.45;

    transform: scale(0.98);

}



.tool-item.drag-over .nav-link {

    border-color: rgba(99, 102, 241, 0.24);

    background: rgba(99, 102, 241, 0.08);

}



.nav-divider {

    height: 1px;

    background: var(--border-color);

    margin: 6px 8px;

}



.nav-link {

    display: flex;

    align-items: center;

    gap: 8px;

    padding: 8px 10px;

    color: var(--text-secondary);

    background: rgba(255, 255, 255, 0.015);

    border: 1px solid var(--border-color);

    font-size: 13.5px;

    font-weight: 600;

    border-radius: var(--radius-md);

    cursor: pointer;

    transition: all var(--transition-fast);

    user-select: none;

    position: relative;

    overflow: hidden;

}



.nav-link::before {

    content: "";

    position: absolute;

    left: 0;

    top: 0;

    bottom: 0;

    width: 0;

    background: var(--accent-indigo);

    border-radius: var(--radius-md);

    transition: width var(--transition-base);

    opacity: 0.15;

}



.nav-link:hover {

    color: var(--text-primary);

    background: rgba(255, 255, 255, 0.045);

    border-color: var(--border-color);

}



.nav-link.active {

    color: white;

    background: rgba(99, 102, 241, 0.12);

    border: 1px solid rgba(99, 102, 241, 0.2);

    font-weight: 600;

}



.nav-link.active::before {

    width: 3px;

    opacity: 1;

}



.nav-icon {

    font-size: 14px;

    width: 18px;

    text-align: center;

}



.nav-text {

    display: inline-block;

    margin-left: 1px;

}



/* ── Sidebar Footer ───────────────────────────────── */

.nav-footer {

    flex: 0 0 auto;

    margin-top: 0;

    padding-top: 8px;

    border-top: 1px solid rgba(255, 255, 255, 0.04);

    display: flex;

    flex-direction: column;

    gap: 5px;

}



@keyframes pulse-dot {

    0%   { transform: scale(0.8); opacity: 0.5; }

    100% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 6px currentColor; }

}



.sidebar-version {
    position: absolute;
    top: 8px;
    right: 12px;
    z-index: 10000;
    padding: 3px 6px;
    border: 1px solid rgba(96, 165, 250, 0.42);
    border-radius: 999px;
    background: rgba(24, 63, 126, 0.68);
    color: #bfdbfe;
    -webkit-text-fill-color: #bfdbfe;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.1px;
    pointer-events: none;
}



/* ── Sidebar Extended Navigation (Stage 2) ───────── */

.placeholder-nav-link {

    opacity: 0.6;

    cursor: pointer;

}



.placeholder-nav-link:hover {

    opacity: 0.95;

    background: rgba(255, 255, 255, 0.03);

}



.sidebar-theme-switch {

    background: rgba(255, 255, 255, 0.03);

    border: 1px solid var(--border-color);

    padding: 6px 12px;

    border-radius: 6px;

    font-size: 12px;

    font-weight: 600;

    color: var(--text-secondary);

    display: flex;

    align-items: center;

    gap: 8px;

    cursor: pointer;

    transition: all var(--transition-fast);

    margin-bottom: 8px;

}



.sidebar-theme-switch:hover {

    background: rgba(255, 255, 255, 0.06);

    color: white;

}



.theme-dot {

    width: 8px;

    height: 8px;

    border-radius: 50%;

    background: #eab308;

    /* yellow dot for Light theme */

    box-shadow: 0 0 8px #eab308;

    display: inline-block;

}

body[data-theme="soft-light"] .sidebar,
body[data-theme="soft-light"] .settings-dialog,
body[data-theme="soft-light"] .modal-panel {
    background: rgba(246, 241, 240, 0.72);
    border-color: rgba(95, 82, 98, 0.14);
    box-shadow: 0 22px 70px rgba(86, 65, 98, 0.16);
    backdrop-filter: blur(22px) saturate(135%);
}

body[data-theme="soft-light"] .glass-card,
body[data-theme="soft-light"] .config-card,
body[data-theme="soft-light"] .method-card {
    background: rgba(246, 241, 240, 0.58);
    border-color: rgba(95, 82, 98, 0.13);
    box-shadow: 0 18px 46px rgba(86, 65, 98, 0.12);
    backdrop-filter: blur(18px) saturate(130%);
}

body[data-theme="soft-light"] .sidebar-theme-switch {
    background: rgba(255, 255, 255, 0.48);
    color: var(--text-secondary);
}

body[data-theme="soft-light"] .theme-dot {
    background: #9b7cf0;
    box-shadow: 0 0 10px rgba(155, 124, 240, 0.52);
}

body[data-theme="soft-light"] .nav-link,
body[data-theme="soft-light"] .tool-ctrl-btn,
body[data-theme="soft-light"] .settings-gear-btn,
body[data-theme="soft-light"] .sidebar-account-card {
    background: rgba(255, 255, 255, 0.65);
    border-color: rgba(95, 82, 98, 0.3);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

body[data-theme="soft-light"] .nav-link:hover,
body[data-theme="soft-light"] .tool-ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(95, 82, 98, 0.45);
}

body[data-theme="soft-light"] .nav-link.active {
    background: rgba(151, 120, 232, 0.22);
    border-color: rgba(151, 120, 232, 0.7);
    box-shadow: 0 2px 8px rgba(151, 120, 232, 0.2);
}

body[data-theme="soft-light"] .brand-name,
body[data-theme="soft-light"] .nav-text,
body[data-theme="soft-light"] .tool-ctrl-text,
body[data-theme="soft-light"] .settings-text,
body[data-theme="soft-light"] .sidebar-account-name {
    color: var(--text-primary);
}

body[data-theme="soft-light"] .brand-name {
    color: #4b35b7;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.48);
}

body[data-theme="soft-light"] .nav-link.active .nav-text {
    color: #5f45c9;
}

body[data-theme="soft-light"] .sidebar-account-plan {
    color: #fff;
    background: linear-gradient(135deg, #5f45c9, #8b73e6);
    box-shadow: 0 6px 14px rgba(95, 69, 201, 0.22);
}

.nav-footer .sidebar-account-card {

    padding: 12px 10px;

    display: flex !important;

    flex-direction: column !important;

    align-items: center !important;

    border-radius: 10px;

    background: rgba(255, 255, 255, 0.035);

    border: 1px solid var(--border-color);

    text-align: center;

    cursor: pointer;

    transition: all var(--transition-fast);

}

.sidebar-account-card:hover {
    background: rgba(255, 255, 255, 0.055);
    border-color: rgba(125, 211, 252, 0.18);
}

@keyframes premium-hue-loop {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

.sidebar-account-card.premium-active {
    position: relative;
    isolation: isolate;
    border-color: transparent !important;
}

.sidebar-account-card.premium-active::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 12px;
    pointer-events: none;
    border: 1px solid rgba(139, 92, 246, 0.6);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.3), inset 0 0 10px rgba(139, 92, 246, 0.15);
    background: linear-gradient(145deg, rgba(139, 92, 246, 0.08), rgba(236, 72, 153, 0.03));
    z-index: -1;
    animation: premium-hue-loop 6s linear infinite;
    will-change: filter;
}

.sidebar-account-card.premium-active:hover::before {
    background: linear-gradient(145deg, rgba(139, 92, 246, 0.12), rgba(236, 72, 153, 0.06));
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4), inset 0 0 12px rgba(139, 92, 246, 0.2);
}

.sidebar-account-avatar {

    width: 52px;

    height: 52px;

    border-radius: 50%;

    object-fit: cover;

    border: 1px solid rgba(125, 211, 252, 0.22);

}

.sidebar-account-name {

    margin-top: 6px;

    font-size: 13.5px;

    font-weight: 800;

    color: var(--text-primary);

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;

}

.sidebar-account-plan {

    margin-top: 4px;

    display: inline-block;

    padding: 3px 9px;

    border-radius: 999px;
    font-size: 10.5px;

    font-weight: 800;

    color: var(--accent-cyan);

    background: rgba(34, 211, 238, 0.1);

    letter-spacing: 0.4px;

    text-transform: uppercase;

}

.sidebar-account-time {
    /* Styles moved to inline block in index.html to ensure priority */
}

.sidebar-account-card.premium-active .sidebar-account-time {
    font-size: 13.5px !important;
}

.sidebar-account-card.premium-active .sidebar-account-plan {
    border: 1px solid rgba(147, 197, 253, 0.58) !important;
    text-shadow: 0 1px 2px rgba(15, 23, 42, 0.8);
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.16) !important;
}

.sidebar-account-plan.is-blocked {
    border: 1px solid rgba(252, 165, 165, 0.55) !important;
    text-shadow: 0 1px 2px rgba(69, 10, 10, 0.85);
    box-shadow: 0 3px 10px rgba(185, 28, 28, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
}

.sidebar-account-plan.is-expired {
    border: 1px solid rgba(253, 186, 116, 0.58) !important;
    text-shadow: 0 1px 2px rgba(67, 20, 7, 0.85);
    box-shadow: 0 3px 10px rgba(194, 65, 12, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
}

.sidebar-account-time.reactivate {
    display: block;
    width: fit-content;
    min-width: 100px;
    margin-right: auto;
    margin-left: auto;
    padding: 5px 14px;
    border: 1px solid rgba(249, 115, 22, 0.4);
    border-radius: 999px;
    color: #fdba74 !important;
    background: rgba(249, 115, 22, 0.12);
    font-size: 12px !important;
    letter-spacing: 0.2px !important;
    overflow: visible !important;
    animation: reactivate-pulse 1.8s ease-in-out infinite;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

@keyframes reactivate-pulse {
    0%, 100% { box-shadow: 0 0 0 rgba(249, 115, 22, 0.18); }
    50% { box-shadow: 0 0 14px rgba(249, 115, 22, 0.58); }
}

.sidebar-account-card:hover .sidebar-account-time.reactivate {
    transform: scale(1.06);
}

@media (prefers-reduced-motion: reduce) {
    .sidebar-account-time.reactivate { animation: none; }
}

.nav-footer .settings-gear-btn {
    margin-bottom: 0;
    padding: 6px 10px;
}



/* ── Tool Item in Sidebar (dynamic) ─────────────── */

.tool-item .nav-link {

    position: relative;

}

/* Onboarding Tooltip */
.onboarding-tooltip {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 15px;
    width: 130px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    padding: 14px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(99,102,241,0.4);
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.onboarding-tooltip.hidden {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    pointer-events: none;
}
.onboarding-arrow {
    position: absolute;
    top: -6px;
    left: 30px;
    width: 12px;
    height: 12px;
    background: #6366f1;
    transform: rotate(45deg);
    border-radius: 2px;
}
