.toolbar {
    width: var(--toolbar-width);
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: var(--z-ui);
}

.tools-section {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    overflow: visible;
}

.tools-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
    width: 100%;
    padding: 0 4px;
    justify-items: center;
}

.tool-btn {
    width: 38px;
    height: 34px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    position: relative;
}

.tool-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.tool-btn:active {
    transform: scale(0.92);
}

.tool-btn.active {
    background-color: var(--bg-active);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.tool-btn.active::before {
    content: '';
    position: absolute;
    left: -2px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    background: var(--accent-color);
    border-radius: 0 2px 2px 0;
}

.ai-section {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 6px 0;
}

.ai-toggle {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #a855f7, #ec4899);
    border: none;
    border-radius: 14px;
    color: #fff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 16px rgba(168, 85, 247, 0.4);
    position: relative;
}

.ai-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(168, 85, 247, 0.55);
}

.ai-toggle:active {
    transform: scale(0.96);
}

.ai-toggle.active {
    background: linear-gradient(135deg, #ec4899, #a855f7);
    box-shadow: 0 4px 20px rgba(236, 72, 153, 0.5);
}

.ai-toggle-icon {
    opacity: 0.7;
}

.ai-toggle-label {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.5px;
    line-height: 1;
}

.ai-flyout {
    display: none;
    position: absolute;
    left: calc(100% + 4px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px;
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    flex-direction: column;
    gap: 3px;
    min-width: 130px;
}

.ai-flyout.open {
    display: flex;
}

.ai-tool-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 5px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    white-space: nowrap;
    transition: all var(--transition-fast);
    width: 100%;
}

.ai-tool-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.ai-tool-btn:active {
    transform: scale(0.97);
}

.color-swatches {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.swatch-container {
    position: relative;
    width: 32px;
    height: 32px;
}

.color-picker-bg, .color-picker-fg {
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    border: 2px solid var(--bg-panel);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: transform var(--transition-fast);
}

.color-picker-bg:hover, .color-picker-fg:hover {
    transform: scale(1.1);
    z-index: 3;
}

.color-picker-bg {
    bottom: 0;
    right: 0;
    z-index: 1;
}

.color-picker-fg {
    top: 0;
    left: 0;
    z-index: 2;
}

.global-tooltip {
    position: fixed;
    background-color: #18181f;
    color: #e0e0e0;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    opacity: 0;
    transform: translateY(-50%) translateX(-4px);
    transition: opacity 0.12s ease, transform 0.12s ease;
    z-index: 10000;
    font-family: inherit;
}

.global-tooltip.active {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

.global-tooltip::before {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: #18181f;
    pointer-events: none;
}
