/**
 * Canvas Toolbar Styles
 * Floating toolbar at top center of canvas with undo/redo + zoom controls
 */

/* Main toolbar container */
.canvas-toolbar {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    /* Offset to center between sidebars: left sidebar (350px) overlays, right (320px) is in grid */
    /* When left sidebar open: shift right by half its width */
    margin-left: 175px;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 1000;
    background: rgba(44, 62, 80, 0.95);
    padding: 6px 12px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: margin-left 0.3s ease;
}

/* Adjust when left sidebar is collapsed */
.main-content.left-collapsed .canvas-toolbar {
    margin-left: 0;
}

/* Adjust when right sidebar is collapsed */
.main-content.right-collapsed .canvas-toolbar {
    margin-left: calc(175px - 160px); /* Shift left by half of right sidebar width */
}

/* Both sidebars collapsed - center in full canvas */
.main-content.both-collapsed .canvas-toolbar {
    margin-left: 0;
}

/* Toolbar button groups */
.toolbar-group {
    display: flex;
    align-items: center;
    gap: 2px;
}

/* Divider between groups */
.toolbar-divider {
    width: 1px;
    height: 28px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 8px;
}

/* Individual toolbar button */
.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 12px;
    background: transparent;
    color: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    font-family: inherit;
    white-space: nowrap;
}

.toolbar-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.toolbar-btn:active:not(:disabled) {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(0.96);
}

/* Active state (for toggle buttons like Info) */
.toolbar-btn.active {
    background: rgba(52, 152, 219, 0.4);
    color: white;
}

.toolbar-btn.active:hover {
    background: rgba(52, 152, 219, 0.55);
}

/* Disabled state */
.toolbar-btn:disabled,
.toolbar-btn.disabled {
    color: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
}

/* Icon styling */
.toolbar-icon {
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
}

/* SVG icon styling */
.toolbar-icon-svg {
    width: 18px;
    height: 18px;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Eye icon states */
.toolbar-btn.active .eye-slash {
    display: none !important;
}

.toolbar-btn:not(.active) .eye-slash {
    display: block !important;
}

.toolbar-btn:not(.active) .eye-open {
    opacity: 0.5;
}

/* Label styling */
.toolbar-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Zoom level input */
.toolbar-zoom-input {
    width: 52px;
    padding: 6px 4px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    outline: none;
    transition: all 0.15s ease;
}

.toolbar-zoom-input:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.toolbar-zoom-input:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(52, 152, 219, 0.6);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Flash animation for button press feedback */
.toolbar-btn.flash {
    animation: toolbar-flash 0.15s ease-out;
}

@keyframes toolbar-flash {
    0% {
        background: rgba(39, 174, 96, 0.5);
    }
    100% {
        background: transparent;
    }
}

/* Settings section in sidebar */
.settings-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

/* Tablet and touch device adjustments */
@media (max-width: 1366px) and (orientation: landscape),
       (max-width: 1024px),
       (hover: none) and (pointer: coarse) {
    .canvas-toolbar {
        top: 10px;
        padding: 8px 14px;
        gap: 6px;
    }
    
    /* Larger touch targets for tablets */
    .toolbar-btn {
        padding: 10px 14px;
        gap: 6px;
    }
    
    .toolbar-icon {
        font-size: 18px;
    }
    
    .toolbar-label {
        font-size: 13px;
    }
    
    .toolbar-zoom-input {
        width: 56px;
        padding: 8px 4px;
        font-size: 13px;
    }
    
    .toolbar-divider {
        height: 32px;
        margin: 0 10px;
    }
}

/* Mobile adjustments - hide some labels */
@media (max-width: 768px) {
    .canvas-toolbar {
        top: 8px;
        padding: 6px 10px;
        gap: 3px;
    }
    
    .toolbar-btn {
        padding: 8px 10px;
    }
    
    /* Hide text labels, show icons only */
    .toolbar-label {
        display: none;
    }
    
    .toolbar-divider {
        margin: 0 6px;
    }
    
    .toolbar-zoom-input {
        width: 48px;
        font-size: 12px;
    }
}

/* Very small screens - compact layout */
@media (max-width: 480px) {
    .canvas-toolbar {
        padding: 5px 8px;
        gap: 2px;
        border-radius: 8px;
    }
    
    .toolbar-btn {
        padding: 8px;
    }
    
    .toolbar-icon {
        font-size: 14px;
    }
    
    .toolbar-divider {
        margin: 0 4px;
        height: 24px;
    }
    
    .toolbar-zoom-input {
        width: 42px;
        padding: 5px 2px;
        font-size: 11px;
    }
    
    /* Hide Reset and Fit buttons on very small screens */
    #zoomReset,
    #fitToScreen {
        display: none;
    }
}
