﻿/* FLOATING SIDEBAR DOCK */
#floating-dock {
    position: fixed;
    top: 50%;
    right: 20px;
    width: 60px;
    background: var(--header-bg);
    border: 1px solid var(--grid-color);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: var(--z-dock);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 0 10px 0;
    transition: width 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    overflow: hidden;
    height: auto;
}

#floating-dock:not(.dragging):hover {
    width: 160px;
    align-items: stretch;
}

#floating-dock.dragging {
    width: 160px;
    align-items: stretch;
    cursor: grabbing;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
    transition: none !important;
}

#floating-dock.dragging .dock-label {
    opacity: 1;
}

.dock-handle {
    width: 100%;
    height: 20px;
    background: rgba(0, 0, 0, 0.05);
    cursor: grab;
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid var(--grid-color);
    margin-bottom: 5px;
    flex-shrink: 0;
}

.dock-handle:active {
    cursor: grabbing;
}

.dock-handle-icon {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: var(--grid-color);
}

.dock-handle:hover .dock-handle-icon {
    background: var(--accent-color);
}

.dock-section {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 5px 0;
    flex-shrink: 0;
}

.dock-item {
    display: flex;
    align-items: center;
    height: 44px;
    padding: 0 18px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    color: var(--text-color);
    white-space: nowrap;
    position: relative;
    /* Ensure relative positioning for hotkey */
}

.dock-item:hover {
    background: rgba(128, 128, 128, 0.1);
}

.dock-item.active {
    color: var(--accent-color);
}

.dock-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10%;
    bottom: 10%;
    width: 4px;
    background: var(--accent-color);
    border-radius: 0 4px 4px 0;
}

.dock-label {
    margin-left: 15px;
    opacity: 0;
    transition: opacity 0.2s 0.1s;
    font-size: 0.95rem;
    font-weight: 500;
}

#floating-dock:not(.dragging):hover .dock-label {
    opacity: 1;
}

.hotkey-indicator {
    position: absolute;
    bottom: 4px;
    left: 42px;
    /* Replaces right: 18px to allow transition (18px padding + 24px icon approx) */
    /* right: 18px; REMOVED to prevent layout jump */
    font-size: 0.6rem;
    opacity: 0.5;
    font-weight: 600;
    pointer-events: none;
    text-transform: uppercase;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    /* Match dock transition */
}

/* Hide hotkey when dock is expanded to avoid clutter? Or keep it? 
   Let's keep it but maybe move it if needed. For now, simple absolute pos.
*/
#floating-dock:not(.dragging):hover .hotkey-indicator,
#floating-dock.dragging .hotkey-indicator {
    /* Keep hotkey near the icon when expanded or dragging */
    right: auto;
    left: 38px;
    /* 18px padding + ~20px icon width */
    bottom: 8px;
}


.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
    font-size: 0.85rem;
}

.control-group input[type="color"] {
    width: 32px;
    height: 32px;
    padding: 0;
    cursor: pointer;
}

.control-group .cp-swatch-trigger {
    min-width: 32px;
    min-height: 32px;
}

.toggle-icon {
    padding: 5px;
    border: 1px solid var(--grid-color);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
}

.toggle-icon.active {
    background: var(--accent-color);
    color: var(--on-accent-color);
    border-color: var(--accent-color);
}


/* Icon styling for img elements */
.dock-item img.icon {
    opacity: 0.7;
    transition: opacity 0.2s, filter 0.3s;
}

.dock-item:hover img.icon,
.dock-item.active img.icon {
    opacity: 1;
}

/* Invert icon colors for dark themes */
/* Invert icon colors for dark themes */
body.dark-mode .dock-item img.icon,
body.midnight-mode .dock-item img.icon,
body.amoled-mode .dock-item img.icon,
body.high-contrast-mode .dock-item img.icon,
body.neon-mode .dock-item img.icon {
    filter: invert(1) brightness(1.2);
}

/* HORIZONTAL DOCK VARIANT */
#floating-dock.horizontal {
    width: auto;
    height: 60px;
    flex-direction: row;
    padding: 0 10px 0 0;
    top: auto;
    bottom: 20px;
    left: 50%;
    right: auto;
    /* transform: translateX(-50%); REMOVED to avoid conflict with dragging which uses left/top */
    transition: height 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

#floating-dock.horizontal:not(.dragging):hover {
    width: auto;
    height: 60px;
    /* No expansion */
}

#floating-dock.horizontal .dock-handle {
    width: 30px;
    height: 100%;
    margin-bottom: 0;
    margin-right: 5px;
    border-bottom: none;
    border-right: 1px solid var(--grid-color);
    flex-direction: column;
}

#floating-dock.horizontal .dock-handle-icon {
    width: 4px;
    height: 20px;
}

#floating-dock.horizontal .dock-section {
    flex-direction: row;
    width: auto;
    height: 100%;
    padding: 0 5px;
    align-items: center;
}

#floating-dock.horizontal .dock-item {
    flex-direction: column;
    justify-content: center;
    height: 100%;
    padding: 0 12px;
    /* Adjusted to 12px */
    width: auto;
}

#floating-dock.horizontal .dock-label {
    display: none;
}

#floating-dock.horizontal .dock-item.active::before {
    left: 15%;
    right: 15%;
    top: auto;
    bottom: 0;
    width: auto;
    height: 3px;
    border-radius: 3px 3px 0 0;
}

#floating-dock.horizontal .hotkey-indicator {
    bottom: 12px;
    /* Moved up */
    left: auto;
    right: 6px;
    /* Tucked in slightly */
    transform: none;
    font-size: 0.6rem;
    font-weight: 700;
}

#floating-dock.horizontal:not(.dragging):hover .hotkey-indicator {
    bottom: 12px;
    left: auto;
    right: 6px;
}
