/* SVG Toolbelt - Universal SVG Enhancement Styles */

/* Base container for zoom functionality - minimal styling only for functionality */
.svg-toolbelt-wrapper,
.svg-toolbelt-container {
    position: relative;
    /* Only add styles necessary for zoom/pan functionality */
    overflow: hidden;
}

/* SVG styling for zoom functionality - only functional styles */
.svg-toolbelt-svg,
.svg-toolbelt-wrapper svg {
    /* Only add styles necessary for zoom/pan interaction, preserve original SVG styles */
    cursor: grab;
    user-select: none;
    transform-origin: 0 0;
}

.svg-toolbelt-svg:active {
    cursor: grabbing;
}

/* Zoom control buttons container */
.svg-toolbelt-controls {
    position: absolute;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Position controls based on config.controlsPosition */
.svg-toolbelt-controls.position-top-right    {
    top: 12px;
    right: 12px;
}
.svg-toolbelt-controls.position-top-left     {
    top: 12px;
    left: 12px;
}
.svg-toolbelt-controls.position-bottom-right {
    bottom: 12px;
    right: 12px;
}
.svg-toolbelt-controls.position-bottom-left  {
    bottom: 12px;
    left: 12px;
}

/* Individual control buttons */
.svg-toolbelt-controls .svg-toolbelt-btn,
.svg-toolbelt-controls button {
    width: 32px;
    height: 32px;
    border: 1px solid #a4a3a8;
    background: #ffffff;
    color: #535158;
    cursor: pointer;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
    padding: 0;
    margin: 0;
}

.svg-toolbelt-controls .svg-toolbelt-btn:hover,
.svg-toolbelt-controls button:hover {
    background-color: #ececef;
    border-color: #89888d;
    color: #333238;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
}

.svg-toolbelt-controls .svg-toolbelt-btn:active,
.svg-toolbelt-controls button:active {
    background-color: #dcdcde;
    border-color: #737278;
    color: #333238;
    transform: translateY(0) scale(0.95);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.svg-toolbelt-controls .svg-toolbelt-btn:focus,
.svg-toolbelt-controls button:focus {
    outline: 2px solid #428fdc;
    outline-offset: 2px;
    border-color: #428fdc;
}

/* Zoom Level Indicator */
.svg-toolbelt-zoom-indicator {
    position: absolute;
    top: 12px;
    left: 12px;
    background-color: #333238; /* --gray-900 equivalent */
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1;
    min-width: 32px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Fullscreen adjustments */
:fullscreen .svg-toolbelt-zoom-indicator {
    top: 16px;
    left: 16px;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .svg-toolbelt-zoom-indicator {
        top: 8px;
        left: 8px;
        font-size: 12px;
        padding: 3px 6px;
        background-color: rgba(51, 50, 56, 0.9);
        backdrop-filter: blur(4px);
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .svg-toolbelt-zoom-indicator {
        background-color: #000;
        color: #fff;
        border: 2px solid #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .svg-toolbelt-zoom-indicator {
        transition: none !important;
    }
}

/* Print styles */
@media print {
    .svg-toolbelt-zoom-indicator {
        display: none !important;
    }
}

/* Fullscreen styles - only necessary positioning */
:fullscreen .svg-toolbelt-wrapper {
    width: 100vw;
    height: 100vh;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .svg-toolbelt-controls {
        padding: 6px;
        gap: 2px;
        border-radius: 4px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(4px);
    }
    .svg-toolbelt-controls .svg-toolbelt-btn,
    .svg-toolbelt-controls button {
        width: 40px !important; /* Larger touch targets */
        height: 40px !important;
        font-size: 14px !important;
        border-radius: 3px;
        min-width: 44px; /* iOS/Android recommended minimum */
        min-height: 44px;
    }
}

/* Tablet optimizations */
@media (max-width: 1024px) and (min-width: 769px) {
    .svg-toolbelt-controls {
        padding: 7px;
        gap: 3px;
    }
    .svg-toolbelt-controls .svg-toolbelt-btn,
    .svg-toolbelt-controls button {
        width: 36px;
        height: 36px;
        font-size: 15px;
    }
}

/* High contrast mode support - only style controls, not wrapper */
@media (prefers-contrast: high) {
    .svg-toolbelt-controls,
    .svg-toolbelt-controls button {
        background: #ffffff;
        border: 2px solid #000;
        color: #000;
    }
    .svg-toolbelt-controls button:hover {
        background: #000;
        color: #ffffff;
    }
    .svg-toolbelt-controls button:focus {
        outline: 3px solid #1068bf;
    }
}

/* Reduced motion support - only disable transitions on controls */
@media (prefers-reduced-motion: reduce) {
    .svg-toolbelt-controls button {
        transition: none !important;
        transform: none !important;
    }
}

/* Print styles - hide controls only, preserve SVG original styles */
@media print {
    .svg-toolbelt-controls {
        display: none !important;
    }
}

/* Keyboard navigation hint */
.svg-toolbelt-wrapper::after {
    content: "Use +/- to zoom, arrows to pan, 0 to reset, or double-click";
    position: absolute;
    bottom: 8px;
    left: 12px;
    background: #333238;
    color: #ffffff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 5;
    font-weight: 500;
}

:fullscreen .svg-toolbelt-wrapper::after {
    position: fixed;
    bottom: 16px;
    left: 16px;
    max-width: 90%;
}

.svg-toolbelt-wrapper:focus::after,
.svg-toolbelt-wrapper:hover::after {
    opacity: 1;
}

@media (max-width: 768px) {
    .svg-toolbelt-wrapper::after {
        content: "Pinch to zoom, drag to pan, double-tap to reset";
        bottom: 4px;
        left: 8px;
        font-size: 10px;
        padding: 3px 6px;
        background: rgba(51, 50, 56, 0.9); /* --gray-900 with transparency */
        backdrop-filter: blur(4px);
    }
}
