/**
 * PrecisionPlay Coaching - Tactical Canvas Enhancement Styles
 * Professional UI improvements to compete with premium tactical canvas software
 */

/* =============================================================================
   COMPACT CONTROLS (Pitch & Team Selector)
   ============================================================================= */

.compact-controls {
    display: flex;
    gap: 2rem;
    align-items: center;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    margin: 1rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.compact-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.compact-section label {
    font-weight: 600;
    color: #0e2338;
    white-space: nowrap;
}

.compact-section select {
    min-width: 150px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: white;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.compact-section select:hover {
    border-color: #ff6b00;
}

.compact-section select:focus {
    outline: none;
    border-color: #ff6b00;
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.1);
}

/* =============================================================================
   TOOLBAR SECTIONS & DIVIDERS
   ============================================================================= */

.toolbar-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 0.6rem 0.5rem;
    text-align: center;
    background: linear-gradient(135deg, #0e2338 0%, #1a3a52 100%);
    border-radius: 8px;
    margin: 0.5rem 0;
    box-shadow: 0 2px 4px rgba(14, 35, 56, 0.2);
    border: 1px solid #0e2338;
}

.toolbar-divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, #e0e0e0 20%, #e0e0e0 80%, transparent);
    margin: 0.75rem 0;
    border-radius: 1px;
}

/* =============================================================================
   HIDE OLD TOOLBARS
   ============================================================================= */

/* Hide vertical toolbars */
.toolbar-left,
.toolbar-right {
    display: none !important;
}

/* Hide old zoom controls */
.zoom-controls {
    display: none !important;
}

/* Hide old help FAB */
.help-fab {
    display: none !important;
}

/* Hide old top toolbar (moved to bottom) */
.toolbar-top {
    display: none !important;
}

/* =============================================================================
   BOTTOM TOOLBAR (Unified Horizontal)
   ============================================================================= */

.bottom-toolbar {
    position: relative;
    background: white;
    border: 2px solid #5a5a5a;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0.4rem 0.6rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    flex-wrap: wrap;
    max-width: 900px;
}

.toolbar-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    flex-wrap: wrap;
}

/* Scrollbar for bottom toolbar */
.bottom-toolbar::-webkit-scrollbar {
    height: 6px;
}

.bottom-toolbar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.bottom-toolbar::-webkit-scrollbar-thumb {
    background: #0e2338;
    border-radius: 3px;
}

.bottom-toolbar::-webkit-scrollbar-thumb:hover {
    background: #ff6b00;
}

/* Unified button style for bottom toolbar */
.tool-btn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid #c0c0c0 !important;
    border-radius: 6px !important;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    font-size: 1.1rem !important;
    cursor: pointer !important;
    transition: all 0.15s !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #0e2338 !important;
    font-weight: 600 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    flex-shrink: 0 !important;
}

.tool-btn:hover {
    background: linear-gradient(135deg, #ff6b00 0%, #e65c00 100%) !important;
    border-color: #ff6b00 !important;
    color: white !important;
    transform: scale(1.05) !important;
    box-shadow: 0 3px 8px rgba(255, 107, 0, 0.3) !important;
}

/* Active tool button - stays orange when selected */
.tool-btn.active,
.tool-btn.active:hover {
    background: linear-gradient(135deg, #ff6b00 0%, #e65c00 100%) !important;
    border-color: #ff6b00 !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.5) !important;
}

/* SVG icons inside buttons */
.tool-btn svg {
    display: block;
}

.tool-btn.active svg {
    fill: white;
    stroke: white;
}

.tool-btn:active {
    transform: scale(0.95) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

/* Zoom display in bottom toolbar */
.zoom-display {
    min-width: 50px !important;
    height: 42px !important;
    padding: 0 0.4rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    color: #0e2338 !important;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    border: 2px solid #e0e0e0 !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08) !important;
    flex-shrink: 0 !important;
}

/* Toolbar separator */
.toolbar-separator {
    width: 1px;
    height: 28px;
    background: #d0d0d0;
    margin: 0 0.3rem;
    flex-shrink: 0;
}

/* =============================================================================
   GROUPED TOOL BUTTONS (Hover to expand like tactical-board.com)
   ============================================================================= */

.tool-group {
    position: relative;
    display: inline-block;
}

.tool-group-trigger {
    position: relative;
}

/* Small indicator arrow on grouped buttons */
.tool-group-trigger::after {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid #0e2338;
}

.tool-group:hover .tool-group-trigger::after {
    border-top-color: white;
}

.tool-group-menu {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 2px solid #0e2338;
    border-radius: 10px;
    padding: 0.4rem;
    display: none;
    flex-direction: column;
    gap: 0.3rem;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.2);
    z-index: 1100;
    margin-bottom: 8px;
    min-width: 50px;
}

/* Arrow pointing down from menu to button */
.tool-group-menu::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid white;
}

.tool-group-menu::before {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #0e2338;
}

.tool-group:hover .tool-group-menu {
    display: flex;
}

.tool-group-menu .tool-btn {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    font-size: 1.2rem !important;
}

.toolbar-left {
    left: 20px !important;
}

.toolbar-right {
    right: 20px !important;
}

/* Scrollbar styling for toolbars */
.toolbar-left::-webkit-scrollbar,
.toolbar-right::-webkit-scrollbar {
    width: 6px;
}

.toolbar-left::-webkit-scrollbar-track,
.toolbar-right::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.toolbar-left::-webkit-scrollbar-thumb,
.toolbar-right::-webkit-scrollbar-thumb {
    background: #ff6b00;
    border-radius: 10px;
}

.toolbar-left::-webkit-scrollbar-thumb:hover,
.toolbar-right::-webkit-scrollbar-thumb:hover {
    background: #e65c00;
}

/* Toolbar buttons enhanced for floating design */
.toolbar-left button:not(.toolbar-collapse-btn),
.toolbar-right button:not(.toolbar-collapse-btn) {
    width: 46px !important;
    height: 46px !important;
    margin: 0.2rem 0 !important;
    border: 2px solid #e0e0e0 !important;
    border-radius: 10px !important;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    font-size: 1.4rem !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #0e2338 !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08) !important;
}

.toolbar-left button:not(.toolbar-collapse-btn):hover,
.toolbar-right button:not(.toolbar-collapse-btn):hover {
    background: linear-gradient(135deg, #ff6b00 0%, #e65c00 100%) !important;
    border-color: #ff6b00 !important;
    color: white !important;
    transform: scale(1.08) translateY(-2px) !important;
    box-shadow: 0 6px 16px rgba(255, 107, 0, 0.4) !important;
}

.toolbar-left button:not(.toolbar-collapse-btn):active,
.toolbar-right button:not(.toolbar-collapse-btn):active {
    transform: scale(0.95) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

/* Collapse/Expand functionality */
.toolbar-collapse-btn {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #0e2338 0%, #1a3a52 100%) !important;
    color: white !important;
    border: 2px solid #e0e0e0 !important;
    width: 36px !important;
    height: 24px !important;
    border-radius: 12px !important;
    cursor: pointer !important;
    font-size: 0.9rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 901 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.toolbar-collapse-btn:hover {
    background: linear-gradient(135deg, #ff6b00 0%, #e65c00 100%) !important;
    transform: translateX(-50%) scale(1.05) !important;
    border-color: #ff6b00 !important;
    box-shadow: 0 4px 8px rgba(255, 107, 0, 0.3) !important;
}

/* Collapsed state */
.toolbar-left.collapsed,
.toolbar-right.collapsed {
    padding: 2.5rem 0.5rem 0.5rem 0.5rem !important;
    overflow: hidden !important;
}

.toolbar-left.collapsed button:not(.toolbar-collapse-btn),
.toolbar-right.collapsed button:not(.toolbar-collapse-btn) {
    display: none !important;
}

.toolbar-left.collapsed {
    left: -50px !important;
}

.toolbar-right.collapsed {
    right: -50px !important;
}

/* =============================================================================
   KEYBOARD SHORTCUTS MODAL
   ============================================================================= */

.shortcuts-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.shortcuts-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 15px;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.shortcuts-close {
    color: #999;
    float: right;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.shortcuts-close:hover {
    color: #ff6b00;
}

.shortcuts-content h2 {
    color: #0e2338;
    margin-bottom: 1.5rem;
    font-size: 2rem;
}

.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.shortcuts-category {
    background: #f8f8f8;
    padding: 1.5rem;
    border-radius: 10px;
    border-left: 4px solid #ff6b00;
}

.shortcuts-category h3 {
    color: #0e2338;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e0e0e0;
}

.shortcut-item:last-child {
    border-bottom: none;
}

.shortcut-key {
    background: #0e2338;
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 0.9rem;
    min-width: 80px;
    text-align: center;
}

.shortcut-desc {
    color: #666;
    flex: 1;
    margin-left: 1rem;
}

/* =============================================================================
   ENHANCED TOOLBAR STYLES
   ============================================================================= */

.toolbar-enhancement-section {
    background: linear-gradient(135deg, #0e2338 0%, #1a3c5e 100%);
    padding: 0.5rem 1rem;
    border-radius: 10px;
    margin: 1rem 0;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.toolbar-section-label {
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0 0.5rem;
    border-right: 2px solid rgba(255, 255, 255, 0.3);
}

.enhanced-tool-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.enhanced-tool-btn:hover {
    background: rgba(255, 107, 0, 0.8);
    border-color: #ff6b00;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 0, 0.3);
}

.enhanced-tool-btn:active {
    transform: translateY(0);
}

.enhanced-tool-btn.active {
    background: #ff6b00;
    border-color: #ff6b00;
}

/* =============================================================================
   PITCH TYPE SELECTOR
   ============================================================================= */

.pitch-selector-container {
    background: white;
    padding: 1rem;
    border-radius: 10px;
    margin: 1rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.pitch-selector-label {
    color: #0e2338;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
}

.pitch-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
}

.pitch-option {
    background: #f8f8f8;
    border: 2px solid #ddd;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.pitch-option:hover {
    background: #ff6b00;
    border-color: #ff6b00;
    color: white;
    transform: translateY(-2px);
}

.pitch-option.active {
    background: #0e2338;
    border-color: #0e2338;
    color: white;
    font-weight: bold;
}

.pitch-option-name {
    font-size: 0.9rem;
    font-weight: 600;
}

.pitch-option-size {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-top: 0.25rem;
}

/* =============================================================================
   TEAM COLOR PRESET SELECTOR
   ============================================================================= */

.team-presets-container {
    background: white;
    padding: 1rem;
    border-radius: 10px;
    margin: 1rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.team-presets-label {
    color: #0e2338;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
}

.team-presets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
}

.team-preset-btn {
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.team-preset-btn:hover {
    border-color: #ff6b00;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(255, 107, 0, 0.2);
}

.team-preset-btn.active {
    border-color: #ff6b00;
    background: rgba(255, 107, 0, 0.1);
}

.team-color-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* =============================================================================
   ZOOM CONTROLS
   ============================================================================= */

.zoom-controls {
    position: fixed;
    bottom: 30px;
    right: 110px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1000;
    border: 2px solid #e0e0e0;
}

.zoom-btn {
    background: linear-gradient(135deg, #0e2338 0%, #1a3a52 100%);
    color: white;
    border: 2px solid #0e2338;
    width: 45px;
    height: 45px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s;
    box-shadow: 0 2px 6px rgba(14, 35, 56, 0.2);
}

.zoom-btn:hover {
    background: linear-gradient(135deg, #ff6b00 0%, #e65c00 100%);
    border-color: #ff6b00;
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.4);
}

.zoom-btn:active {
    transform: scale(0.95);
}

.zoom-level {
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: #0e2338;
    padding: 0.4rem 0;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

/* =============================================================================
   HELP BUTTON (Floating)
   ============================================================================= */

.help-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, #ff6b00 0%, #e65c00 100%);
    color: white;
    border: 3px solid white;
    border-radius: 50%;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(255, 107, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-fab:hover {
    transform: scale(1.15) rotate(15deg);
    box-shadow: 0 10px 30px rgba(255, 107, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.2);
    border-color: #fff;
}

.help-fab:active {
    transform: scale(0.95) rotate(0deg);
}

/* =============================================================================
   MEASUREMENT TOOL INDICATOR
   ============================================================================= */

.measurement-indicator {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: #fbc02d;
    color: #000;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(251, 192, 45, 0.4);
    z-index: 1000;
    display: none;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: translateX(-50%) scale(1);
    }
    50% {
        transform: translateX(-50%) scale(1.05);
    }
}

.measurement-indicator.active {
    display: block;
}

/* =============================================================================
   TRAINING EQUIPMENT INDICATORS
   ============================================================================= */

.equipment-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 10000;
    white-space: nowrap;
}

/* =============================================================================
   MOBILE OPTIMIZATIONS
   ============================================================================= */

@media (max-width: 768px) {
    .compact-controls {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .compact-section {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .compact-section select {
        width: 100%;
    }

    .toolbar-section-title {
        font-size: 0.65rem;
    }
    .shortcuts-content {
        width: 95%;
        margin: 10% auto;
        padding: 1.5rem;
    }

    .shortcuts-grid {
        grid-template-columns: 1fr;
    }

    .toolbar-enhancement-section {
        padding: 0.5rem;
    }

    .enhanced-tool-btn {
        padding: 0.4rem 0.8rem;
        font-size: 1rem;
    }

    .pitch-selector-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .team-presets-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .zoom-controls {
        bottom: 20px;
        right: 90px;
        scale: 0.9;
        padding: 0.5rem;
    }

    .help-fab {
        width: 55px;
        height: 55px;
        font-size: 1.6rem;
        bottom: 20px;
        right: 20px;
    }

    .toolbar-left,
    .toolbar-right {
        max-height: 70vh !important;
    }

    .bottom-toolbar {
        padding: 0.4rem 0.5rem;
        gap: 0.25rem;
    }

    .toolbar-row {
        gap: 0.25rem;
    }

    .tool-btn {
        width: 38px !important;
        height: 38px !important;
        min-width: 38px !important;
        font-size: 1.1rem !important;
    }

    .zoom-display {
        min-width: 45px !important;
        height: 38px !important;
        font-size: 0.8rem !important;
        padding: 0 0.3rem !important;
    }

    .toolbar-separator {
        margin: 0 0.2rem;
        height: 32px;
    }
}

/* =============================================================================
   PROFESSIONAL TOUCH: Subtle Animations
   ============================================================================= */

.tactical-container {
    animation: containerFadeIn 0.5s ease-out;
}

@keyframes containerFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Smooth button interactions */
button {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Focus states for accessibility */
button:focus,
.enhanced-tool-btn:focus,
.pitch-option:focus,
.team-preset-btn:focus {
    outline: 3px solid #ff6b00;
    outline-offset: 2px;
}

/* =============================================================================
   PRINT STYLES (for PDF export optimization)
   ============================================================================= */

@media print {
    .toolbar-top,
    .toolbar-left,
    .toolbar-right,
    .animation-controls,
    .zoom-controls,
    .help-fab,
    .shortcuts-modal {
        display: none !important;
    }

    .canvas-container-wrapper {
        width: 100%;
        height: auto;
    }

    canvas {
        max-width: 100%;
        height: auto !important;
    }
}

/* =============================================================================
   MEGA MENU (Consolidated Tools Menu)
   ============================================================================= */

.master-tools-group {
    position: relative;
}

.tool-mega-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    background: white;
    border: 2px solid #0e2338;
    border-radius: 10px;
    padding: 0.5rem;
    display: none;
    flex-direction: row;
    gap: 0.5rem;
    box-shadow: 0 -6px 25px rgba(0, 0, 0, 0.25);
    z-index: 1200;
    margin-bottom: 10px;
    min-width: auto;
}

/* Arrow pointing down from mega menu */
.tool-mega-menu::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid white;
}

.tool-mega-menu::before {
    content: '';
    position: absolute;
    bottom: -13px;
    left: 18px;
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid #0e2338;
}

/* Removed hover - now using click toggle via JavaScript */
.master-tools-group .tool-mega-menu.open {
    display: flex;
}

.mega-menu-section {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 70px;
}

.mega-menu-label {
    display: none; /* Hide the section labels */
}

.mega-menu-items {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

/* Mega menu button style - with label */
.tool-mega-menu .tool-btn {
    width: auto !important;
    min-width: 70px !important;
    height: 32px !important;
    padding: 0 0.5rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 0.3rem !important;
    font-size: 0.7rem !important;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 5px !important;
    color: #0e2338 !important;
    font-weight: 500 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}

.tool-mega-menu .tool-btn:hover {
    background: linear-gradient(135deg, #ff6b00 0%, #e65c00 100%) !important;
    border-color: #ff6b00 !important;
    color: white !important;
    transform: scale(1.02) !important;
}

.tool-mega-menu .tool-btn svg {
    flex-shrink: 0;
    width: 18px !important;
    height: 18px !important;
}

.tool-mega-menu .tool-btn span {
    white-space: nowrap;
    font-weight: 500;
}

/* Responsive mega menu */
@media (max-width: 768px) {
    .tool-mega-menu {
        min-width: 280px;
        flex-wrap: wrap;
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .mega-menu-section {
        min-width: 60px;
    }

    .tool-mega-menu .tool-btn {
        min-width: 60px !important;
        height: 32px !important;
        font-size: 0.65rem !important;
        padding: 0 0.4rem !important;
    }

    .tool-mega-menu .tool-btn svg {
        width: 18px !important;
        height: 18px !important;
    }

    .mega-menu-label {
        font-size: 0.6rem;
        padding: 0.2rem 0.3rem;
    }
}
