/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    gap: 24px;
    flex-wrap: wrap;
    flex-shrink: 0;
    position: relative;
    z-index: 100;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.toolbar-group:not(:last-child)::after {
    content: '';
    position: absolute;
    right: -12px;
    height: 20px;
    width: 1px;
    background: var(--glass-border);
    transition: background 0.08s ease;
}

.toolbar-group.no-separator::after {
    display: none !important;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--accent);
    font-size: 24px;
    cursor: pointer;
    padding: 6px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s, color 0.2s;
}

.icon-btn:hover {
    background: var(--btn-hover);
    transform: translateY(-1px);
}

.icon-btn:active {
    transform: translateY(1px);
}

.icon-btn.active {
    color: inherit;
}

.editor-toolbar {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--glass-border);
    background: transparent;
    align-items: center;
    position: relative;
    z-index: 10;
}

/* Zadokowane kontrolki pasków narzędzi w obu panelach */
.pane .editor-toolbar {
    position: relative;
    z-index: 10;
    flex-wrap: wrap; /* Pozwala na zrzucenie elementów w wąskich oknach */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.pane .editor-toolbar.collapsed {
    padding: 8px 0 !important;
    align-items: center;
    border-bottom: none;
}
.pane .editor-toolbar.collapsed .toolbar-row:not(:first-child) {
    display: none !important;
}
.pane .editor-toolbar.collapsed .toolbar-row > *:not(.row-left) {
    display: none !important;
}


/* Narzędzia specyficzne */
.editor-toolbar .color-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
#btn-toggle-toolbar {
    transition: transform 0.3s;
}
#btn-toggle-toolbar.flipped {
    transform: rotate(180deg);
}

.custom-colors {
    display: flex;
    gap: 8px;
    animation: fadeIn 0.3s ease;
}
.custom-colors.hidden {
    display: none;
}
.custom-colors input[type="color"] {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    background: none;
    transition: transform 0.2s;
}
.custom-colors input[type="color"]:hover {
    transform: scale(1.1);
}
.custom-colors input[type="color"]::-webkit-color-swatch-wrapper {
	padding: 0;
}
.custom-colors input[type="color"]::-webkit-color-swatch {
	border: 1.5px solid var(--glass-border);
	border-radius: 6px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.right-toolbar {
    padding: 16px;
    background: transparent;
    display: flex;
    flex-direction: column;
    gap: 0;
    border-bottom: 1px solid var(--glass-border);
}

.right-toolbar {
    padding: 8px 0 !important;
}
.toolbar-row {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 8px 12px;
    border-bottom: 1px solid var(--glass-border);
}
.row-left {
    flex: 1;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}
.row-center {
    flex: 2;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.row-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.toolbar-row:first-child {
    padding-top: 0;
}

.toolbar-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.row-label {
    font-size: 11px;
    font-weight: 600;
    opacity: 0.5;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    width: 50px;
    flex-shrink: 0;
}
.swatch-label {
    font-size: 11px;
    font-weight: 600;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* Floating Graph Controls */
.graph-controls {
    position: absolute;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    z-index: 90;
    max-width: calc(100% - 48px); /* Zapobiega wyjściu kontrolek poza sam obszar prawego panelu we węższym splicie */
}

.tools-toggle-btn {
    display: none;
}

/* Ukrycie górnego paska w pełnym oknie */
.is-fullscreen .right-toolbar {
    display: none !important;
}

/* Ukrycie opcji auto-fit/checkerboard w pełnym oknie */
.is-fullscreen .bottom-toolbar .custom-checkbox,
.is-fullscreen .bottom-toolbar .custom-checkbox + .divider {
    display: none !important;
}

/* Przycisk zamknięcia fullscreen (X) */
.close-fullscreen-btn {
    display: none;
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 1000;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 50%;
}
[data-theme="light"] .close-fullscreen-btn {
    background: rgba(255, 255, 255, 0.4);
}
.is-fullscreen .close-fullscreen-btn {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Nowy pasek narzędzi nawigacyjnych (Zoom/Fullscreen) u dołu podglądu */
.bottom-toolbar {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--glass-border);
    background: transparent;
    align-items: center;
    position: relative;
    z-index: 10;
    justify-content: center; /* Wycentrowanie zamiast space-around */
}

/* Mobile Portrait Overrides */
@media (max-width: 768px) {
    .app-title, .brand-group, .no-separator {
        display: none !important;
    }
    .toolbar {
        display: grid !important;
        grid-template-columns: auto auto;
        justify-content: center;
        gap: 12px 24px;
        padding-top: 16px;
        padding-bottom: 16px;
    }
    .toolbar-group::after {
        display: none !important;
    }
}
