/**
 * RE::DACT Sidebar Styles
 * 
 * This file contains:
 * - Sidebar container
 * - Mobile overlay
 * - Create item buttons
 * - Project list
 * - Contact list
 * - Sidebar footer
 * - Finder/Search
 */

/* --- SIDEBAR CONTAINER --- */
aside {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--color-bg-primary);
    border-right: 1px solid var(--color-border-light);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 4px 0 24px rgba(var(--color-overlay-dark), 0.05);
}

aside.open {
    transform: translateX(0);
}

/* --- MOBILE OVERLAY --- */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(var(--color-overlay-light), 0.8);
    backdrop-filter: blur(2px);
    z-index: 900;
    opacity: 0;
    transition: opacity 0.2s;
}

.mobile-overlay.show {
    display: block;
    opacity: 1;
}

/* --- SIDEBAR CONTENT --- */
.sidebar-content {
    flex: 1;
    overflow: hidden; /* BEZ wspólnego slidera - każda sekcja ma własny */
    padding: 0 20px;
    display: flex;
    flex-direction: column;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

/* Sekcja projektów - połowa dostępnej przestrzeni */
.sidebar-section-projects {
    flex: 1;
}

/* Sekcja Sparks - połowa dostępnej przestrzeni, z kreską u góry */
.sidebar-section-sparks {
    flex: 1;
    border-top: 1px solid var(--color-border-light, #e5e5e5);
    padding-top: 8px;
}

/* Każda sekcja ma WŁASNY slider */
.scrollable-list {
    overflow-y: auto;
    padding-top: 2px;
    flex: 1;
    min-height: 0;
}

/* --- CREATE NEW (Action Buttons) --- */
.create-item {
    display: flex;
    align-items: center;
    padding: 8px;
    margin-bottom: 2px;
    cursor: pointer;
    font-size: 13px !important; 
    color: var(--color-text-primary) !important; 
    font-weight: 700 !important; 
    transition: all var(--transition-fast);
    flex-shrink: 0;
    width: 100%;
    text-align: left;
}

.create-item:hover {
    opacity: 0.7;
}

.create-prefix {
    margin-right: 6px;
    color: inherit;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 700;
    letter-spacing: -0.02em;
    user-select: none;
    min-width: 15px;
}

.create-prefix-icon {
    width: 14px;
    height: 14px;
    margin-right: 6px;
    flex-shrink: 0;
    color: inherit;
}

.create-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.create-icon {
    font-weight: 400;
    font-size: 16px;
    color: inherit;
    margin-left: 8px;
}

.import-icon-btn {
    width: 24px; 
    height: 24px; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    border-radius: 4px;
    color: var(--color-text-primary);
    transition: all 0.2s;
    margin-left: auto;
    margin-right: 4px;
}

.import-icon-btn:hover {
    background: rgba(var(--color-overlay-dark), 0.05);
}

/* --- PROJECT LIST --- */
.project {
    display: flex;
    align-items: center;
    padding: 8px;
    margin-bottom: 2px;
    background: transparent;
    cursor: pointer;
    font-size: 13px !important;
    font-weight: 400;
    color: var(--color-text-tertiary) !important;
    transition: background 0.15s;
    position: relative;
    border-radius: 4px;
}

.project:hover {
    background: rgba(var(--color-overlay-dark), 0.03);
}

.project.active {
    font-weight: 700 !important;
    opacity: 1;
    color: var(--color-text-primary) !important;
}

.prefix-span {
    margin-right: 6px;
    color: inherit; 
    font-weight: 600;
    letter-spacing: -0.02em;
    user-select: none;
    min-width: 15px; 
}

.project input {
    flex: 1;
    border: none;
    background: none;
    font-size: 13px;
    color: inherit;
    font-weight: inherit;
    outline: none;
    padding: 0;
    min-width: 0;
}

.project-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.project:hover .project-actions {
    opacity: 1;
}

.action-icon {
    width: 16px;
    height: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: inherit;
    border-radius: 3px;
}

.action-icon:hover {
    background-color: rgba(var(--color-overlay-dark), 0.05);
}

.action-icon svg {
    width: 10px;
    height: 10px;
    fill: currentColor;
    display: block;
}

/* --- CONTACT LIST --- */
.contact {
    padding: 6px 12px;
    margin-bottom: 2px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: relative;
    font-size: 13px !important;
    cursor: pointer;
}

.contact:hover {
    background: rgba(var(--color-overlay-dark), 0.03);
    border-radius: 4px;
}

.contact-first-line {
    display: flex;
    align-items: center;
    gap: 6px;
}

.contact input {
    border: none;
    background: transparent;
    font-size: 11px;
    color: var(--color-text-primary);
    outline: none;
    padding: 0;
    width: 100%;
}

.contact-name {
    font-weight: 600;
    font-size: 13px !important;
    flex: 1;
}

.contact .del {
    position: absolute;
    top: 6px;
    right: 6px;
    opacity: 0;
    cursor: pointer;
    background: none;
    border: none;
}

.contact:hover .del {
    opacity: 1;
}

.contact-placeholder {
    font-size: 10px;
    color: var(--color-text-tertiary);
    font-weight: 400;
    user-select: none;
}

.contact-aliases {
    padding: 4px 0;
    font-size: 11px;
    color: var(--color-text-tertiary);
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.aliases-label {
    color: var(--color-text-muted);
    font-size: 10px;
}

.alias-tag {
    background: var(--color-bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.alias-tag:hover {
    background: var(--color-border-medium);
}

.contact-phone-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
}

.contact-phone-wrapper input {
    flex: 1;
}

.contact-call-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #10b981;
    color: white;
    text-decoration: none;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.contact-call-btn:active {
    transform: scale(0.95);
    background: #059669;
}

.contact-call-btn svg {
    width: 14px;
    height: 14px;
}

/* --- SIDEBAR FOOTER --- */
.sidebar-footer {
    padding: 20px;
    flex-shrink: 0;
    background: var(--color-accent);
    color: var(--color-bg-primary);
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: auto;
}

/* Container for profile + action buttons */
.user-profile-container {
    display: flex;
    align-items: center;
    gap: 0;
    width: 100%;
    margin-top: 5px;
}

.user-profile-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
    color: white;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.user-profile-box:hover {
    background: rgba(var(--color-overlay-light), 0.1);
}

/* Archive and Settings buttons */
.archive-btn,
.settings-btn {
    background: none;
    border: none;
    padding: 4px;
    border-radius: 6px;
    cursor: pointer;
    color: white;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.archive-btn svg,
.settings-btn svg {
    width: 18px;
    height: 18px;
    stroke: white !important;
}

.archive-btn:hover,
.settings-btn:hover {
    background: rgba(var(--color-overlay-light), 0.1);
    color: white;
}

/* Guest box specific styles */
.guest-box {
    flex-direction: row;
}

.user-name-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.user-signin-hint {
    font-size: 10px;
    color: var(--color-text-secondary);
    opacity: 0.8;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-bg-tertiary);
    object-fit: cover;
    border: 1px solid var(--color-border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.guest-avatar {
    background: var(--color-bg-secondary);
    border-color: var(--color-border);
}

.user-name {
    font-size: 13px;
    font-weight: 500;
    color: white;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-settings-trigger {
    font-size: 12px;
    color: var(--color-text-muted);
}

.copyright-box {
    color: rgba(255, 255, 255, 0.8);
    padding: 8px 15px 0 0;
    font-size: 10px;
    line-height: 1.6;
    text-align: right;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    margin-top: 8px;
}

.copyright-email {
    color: inherit;
    text-decoration: none;
}

.copyright-email:hover {
    color: white;
}

/* --- SIDEBAR FINDER --- kompaktowy */
.sidebar-finder {
    padding: 12px 20px 8px 20px;
    flex-shrink: 0;
}

.finder-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.finder-input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1px solid var(--color-border-light);
    border-radius: 10px;
    font-size: 13px;
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.08);
}

.finder-input:focus {
    border-color: var(--color-border-medium);
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.08), 0 0 0 3px rgba(var(--color-overlay-dark), 0.05);
}

.finder-input::placeholder {
    color: var(--color-text-muted);
}

.finder-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--color-text-muted);
    pointer-events: none;
}

.finder-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-tertiary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--color-text-tertiary);
    font-size: 12px;
}

.finder-clear.visible {
    display: flex;
}

.project.hidden,
.contact.hidden,
.spark-topic-item.hidden {
    display: none !important;
}

/* =============================================================================
   THEME COLOR MODES - Sidebar styling
   ============================================================================= */

/* Blue theme - sidebar matches note background */
body.theme-blue aside {
    background: #f0f7fc;
    border-right-color: #d4e8f7;
}

/* Red theme - light gray sidebar */
body.theme-red aside {
    background: #f9f9f9;
    border-right-color: #e5e5e5;
}

/* Color themes - create buttons use accent color */
body.theme-orange .create-item,
body.theme-orange .create-prefix-icon {
    color: var(--color-accent) !important;
}

body.theme-orange .finder-input {
    border-color: var(--color-accent) !important;
}

body.theme-red .create-item,
body.theme-red .create-prefix-icon {
    color: var(--color-accent) !important;
}

body.theme-red .finder-input {
    border-color: var(--color-accent) !important;
}

body.theme-blue .create-item,
body.theme-blue .create-prefix-icon {
    color: var(--color-accent) !important;
}

body.theme-blue .finder-input {
    border-color: var(--color-accent) !important;
}

body.theme-matrix .create-item,
body.theme-matrix .create-prefix-icon {
    color: var(--color-accent) !important;
}

body.theme-matrix .finder-input {
    border-color: var(--color-accent) !important;
}

body.theme-dark-sparks .create-item,
body.theme-dark-sparks .create-prefix-icon {
    color: var(--color-accent) !important;
}

body.theme-dark-sparks .finder-input {
    border-color: var(--color-accent) !important;
}

/* === MOBILE CONTACTS === */
@media (max-width: 768px) {
    .contact {
        padding: 4px 10px;
        gap: 1px;
    }
    .contact input {
        font-size: 9px;
    }
    .contact input.contact-name {
        font-size: 13px;
    }
    .contact-placeholder {
        font-size: 8px;
    }
    .contact-aliases {
        font-size: 8px;
    }
    .contact-first-line {
        gap: 4px;
    }
}
