/* Left Navigation Feature - UI v0 Specification CSS */

:root {
    --nav-expanded-width: 300px;
    --nav-collapsed-width: 64px;
}

.left-navigation {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--nav-expanded-width);
    height: 100vh;
    background-color: #f8fafc;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    z-index: 1200;
    transition: width 0.2s ease, transform 0.3s ease;
    overflow: hidden;
    pointer-events: auto;
}

.left-navigation.collapsed {
    width: var(--nav-collapsed-width);
}

.nav-chrome {
    height: 64px;
    padding: 0 0.85rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.collapse-toggle {
    background-color: transparent;
}

/* Global Action Zone */
.global-action-zone {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.action-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: #333;
    transition: background-color 0.15s ease;
    width: 100%;
    text-align: left;
}

.action-item:hover {
    background-color: #e8e8e8;
}

.action-item:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.action-icon {
    font-size: 1.1rem;
}

.action-label {
    flex: 1;
    font-weight: 500;
}

.left-navigation.collapsed .global-action-zone {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    gap: 0.35rem;
}

.left-navigation.collapsed .action-item {
    justify-content: center;
    padding: 0.65rem 0.5rem;
}

.left-navigation.collapsed .action-label {
    display: none;
}

/* Project Context Zone */
.project-context-zone {
    position: relative;
    padding: 0 .4rem;
    margin-bottom: 0.5rem;
}

.left-navigation.collapsed .project-context-zone,
.left-navigation.collapsed .project-list-zone,
.left-navigation.collapsed .thread-list-zone,
.left-navigation.collapsed .unassigned-section {
    display: none;
}

@media (max-width: 1024px) {
    .left-navigation {
        pointer-events: none;
    }

    body.nav-drawer-open .left-navigation {
        pointer-events: auto;
    }

    .left-navigation.collapsed {
        width: min(90vw, var(--nav-expanded-width));
        max-width: min(90vw, var(--nav-expanded-width));
    }

    .left-navigation.collapsed .project-context-zone,
    .left-navigation.collapsed .project-list-zone,
    .left-navigation.collapsed .thread-list-zone,
    .left-navigation.collapsed .unassigned-section {
        display: block;
    }

    .left-navigation.collapsed .project-list-zone,
    .left-navigation.collapsed .thread-list-zone {
        display: flex;
    }

    .left-navigation.collapsed .global-action-zone {
        padding: 1rem;
        gap: 0.25rem;
    }

    .left-navigation.collapsed .action-item {
        justify-content: flex-start;
        padding: 0.75rem 1rem;
    }

    .left-navigation.collapsed .action-label {
        display: inline;
    }

    .left-navigation.collapsed .user-account-zone {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .left-navigation.collapsed .user-account-button {
        justify-content: flex-start;
    }

    .left-navigation.collapsed .user-info {
        display: block;
    }
}

.project-list-zone {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: calc(100vh - 330px);
    overflow-y: auto;
    padding-right: 0.35rem;
}

.create-project-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    margin-bottom: 0.75rem;
    padding: 0.65rem 0.9rem;
    border: 1px dashed #cbd5e1;
    border-radius: 0.5rem;
    background: transparent;
    font-weight: 600;
    color: #1f2937;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.create-project-link:hover {
    background-color: #ffffff;
    border-color: #2563eb;
}

.create-project-link .project-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background-color: #e0e7ff;
    color: #1d4ed8;
    font-weight: 700;
}

.project-block {
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 0.5rem;
    background-color: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.project-block.active {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.project-block-header {
    position: relative;
    overflow: hidden;
    border-radius: 0.65rem;
}

.project-nav-button {
    position: relative;
    display: flex;
    gap: 0.75rem;
    width: 100%;
    border: none;
    background: transparent;
    padding: 0.6rem 0.85rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
    align-items: flex-start;
    overflow: hidden;
}

.project-block.active .project-nav-button,
.project-nav-button:hover {
    background-color: #f3f4f6;
}

.project-block-header .project-icon {
    position: absolute;
    inset: 0;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: right;
    font-size: clamp(2.75rem, 7vw, 3.75rem);
    line-height: 1;
    opacity: 0.7;
    color: #e0e7ff;
    pointer-events: none;
    height: 90%;
    margin-right: -25px;
}

.project-meta {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    text-align: left;
    padding: .4em;
}

.project-name {
    flex: 1;
    font-weight: 600;
    text-align: left;
}

.project-description {
    font-size: 0.8rem;
    color: #6b7280;
}

.project-thread-sublist {
    margin-top: 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.project-empty {
    margin-top: 0.35rem;
    font-size: 0.85rem;
    color: #9ca3af;
    padding-left: 0.5rem;
}

.project-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: #333;
    transition: background-color 0.15s ease;
    width: 100%;
}

.project-selector:hover {
    background-color: #f9f9f9;
}

.project-icon {
    font-size: 1.1rem;
}

.project-name {
    flex: 1;
    font-weight: 500;
    text-align: left;
}

.chevron-icon {
    font-size: 0.8rem;
    color: #666;
}

/* Project Popover */
.project-popover {
    position: absolute;
    top: 100%;
    left: 1rem;
    right: 1rem;
    margin-top: 0.5rem;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 20;
    max-height: 320px;
    overflow-y: auto;
    padding: 0.5rem;
}

.project-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: #333;
    transition: background-color 0.15s ease;
    width: 100%;
    text-align: left;
}

.project-item:hover {
    background-color: #f5f5f5;
}

.project-item.selected {
    background-color: #e8f4ff;
}

.check-icon {
    margin-left: auto;
    color: #007bff;
    font-weight: bold;
}

/* Thread List Zone */
.thread-list-zone {
    flex: 1;
    overflow-y: auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.thread-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.thread-item-wrapper {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.thread-list-item {
    position: relative;
    border-radius: 0.5rem;
    padding: 0.25rem 0.35rem;
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.thread-list-item:hover,
.thread-list-item.selected {
    border-color: #dbeafe;
    background: #eff6ff;
}

.thread-list-item-header {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    align-items: flex-start;
}

.thread-title-stack {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.thread-item-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.thread-item-purpose {
    font-size: 0.75rem;
    color: #475569;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.thread-status-stack {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    align-items: flex-end;
}

.thread-intent-chip {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0c4a6e;
    font-weight: 600;
}

.thread-item-activity {
    font-size: 0.75rem;
    color: #94a3b8;
}

.thread-item {
    position: relative;
}

.thread-menu {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.1rem;
    padding: 0.15rem 0.25rem;
    border-radius: 0.4rem;
    align-self: flex-start;
    opacity: 0;
    transition: opacity 0.15s ease, color 0.15s ease, background-color 0.15s ease;
    cursor: pointer;
}

.thread-list-item:hover .thread-menu,
.thread-list-item.selected .thread-menu,
.thread-item.editing .thread-menu {
    opacity: 1;
}

.thread-menu:hover,
.thread-menu:focus-visible {
    background-color: #e2e8f0;
    color: #0f172a;
    outline: none;
}

.thread-menu-popover {
    position: absolute;
    top: calc(100% - 0.2rem);
    right: 0.25rem;
    margin-top: 0.25rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.15);
    display: flex;
    flex-direction: column;
    min-width: 140px;
    z-index: 30;
}

.thread-menu-popover .menu-item {
    background: transparent;
    border: none;
    padding: 0.6rem 0.9rem;
    text-align: left;
    font-size: 0.9rem;
    cursor: pointer;
    color: #0f172a;
}

.thread-menu-popover .menu-item:hover {
    background: #f1f5f9;
}

.see-all-button {
    margin-top: 0.25rem;
    border: 1px solid #dbeafe;
    border-radius: 0.65rem;
    background: #fff;
    color: #1d4ed8;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.see-all-button:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
}

/* User Account Zone */
.user-account-zone {
    position: relative;
    padding: 1rem;
    margin-top: auto;
}

.left-navigation.collapsed .user-account-zone {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.user-account-button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: transparent;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
    width: 100%;
}

.left-navigation.collapsed .user-account-button {
    justify-content: center;
}

.user-account-button:hover {
    background-color: #e8e8e8;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #007bff;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.user-info {
    flex: 1;
    text-align: left;
}

.left-navigation.collapsed .user-info {
    display: none;
}

.user-display-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: #333;
}

.user-handle {
    font-size: 0.85rem;
    color: #666;
}

/* User Popover */
.user-popover {
    position: absolute;
    bottom: 100%;
    left: 1rem;
    right: 1rem;
    margin-bottom: 0.5rem;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 20;
    padding: 0.5rem;
}

.menu-divider {
    height: 1px;
    background-color: #ddd;
    margin: 0.5rem 0;
}

/* Popover Backdrop */
.popover-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 19;
}

/* Scrollbar styling for thread list */
.thread-list-zone::-webkit-scrollbar {
    width: 6px;
}

.thread-list-zone::-webkit-scrollbar-track {
    background: transparent;
}

.thread-list-zone::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.thread-list-zone::-webkit-scrollbar-thumb:hover {
    background: #999;
}
