/* ===== Sidebar Styles - Conversation History ===== */

/* Sidebar - Pixel treasure map style */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg,
            var(--parchment) 0%,
            var(--parchment-dark) 100%);
    border-right: 6px solid var(--brown-dark);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.3s ease;
    z-index: 1000;
    box-shadow: 6px 0 0 rgba(92, 64, 51, 0.4);
    /* Desktop fixed height */
    height: calc(100vh - 80px); /* Subtract header height */
    position: sticky;
    top: 0;
    /* GPU acceleration to prevent rendering artifacts during resize */
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    will-change: width;
}

.sidebar.collapsed {
    width: 0;
    border-right: none;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 4px solid var(--brown-dark);
    background: linear-gradient(180deg,
            var(--orange-light) 0%,
            var(--orange) 100%);
}

.conversation-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    background: linear-gradient(180deg,
            var(--parchment) 0%,
            var(--parchment-dark) 100%);
}

.conversation-item {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: white;
    border: 3px solid var(--brown-dark);
    border-radius: 0;
    cursor: pointer;
    transition: all 0.1s ease;
    box-shadow: 4px 4px 0 rgba(92, 64, 51, 0.3);
}

.conversation-item:hover {
    background: var(--parchment);
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 rgba(92, 64, 51, 0.3);
}

.conversation-item.active {
    background: #dbeafe;
    border-color: var(--blue);
}

.conversation-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--brown-dark);
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-meta {
    font-size: 0.6rem;
    color: var(--brown-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.conversation-delete {
    padding: 0.25rem 0.5rem;
    background: #fee2e2;
    color: #dc2626;
    border: 2px solid #dc2626;
    border-radius: 0;
    cursor: pointer;
    font-size: 0.6rem;
    opacity: 0;
    transition: all 0.1s ease;
    font-weight: 600;
}

.conversation-item:hover .conversation-delete {
    opacity: 1;
}

.conversation-delete:hover {
    background: #dc2626;
    color: white;
}

.sidebar-footer {
    padding: 0.75rem;
    border-top: 4px solid var(--brown-dark);
    text-align: center;
    font-size: 0.6rem;
    color: var(--brown-light);
    background: linear-gradient(180deg,
            var(--parchment-dark) 0%,
            var(--parchment-accent) 100%);
}

/* Toggle sidebar button */
.toggle-sidebar-button {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%) translateZ(0);
    background: linear-gradient(180deg,
            var(--orange-light) 0%,
            var(--orange) 100%);
    color: white;
    border: 4px solid var(--brown-dark);
    border-left: none;
    border-radius: 0;
    padding: 1rem 0.5rem;
    cursor: pointer;
    z-index: 1100;
    transition: left 0.3s ease;
    font-size: 1.2rem;
    box-shadow: 6px 6px 0 rgba(92, 64, 51, 0.5);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* When sidebar is expanded, button follows */
.sidebar:not(.collapsed)~.toggle-sidebar-button {
    left: 280px;
}

.toggle-sidebar-button:hover {
    transform: translateY(-50%) translateZ(0) translate(3px, 3px);
    box-shadow: 3px 3px 0 rgba(92, 64, 51, 0.5);
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(92, 64, 51, 0.7);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}
