/**
 * Custom Toolbox Styling for AntArt
 * Makes the horizontal toolbox look like a visual blocks bar
 */

/* Override the default toolbox background */
.scratchCategoryMenuHorizontal {
    width: 100% !important;
    height: 90px !important;
    background: #ffffff !important;
    border-bottom: 1px solid #e2e8f0 !important;
    padding: 10px 16px !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    overflow-x: auto !important;
    box-shadow: none !important;
}

/* Category rows - make them display inline */
.scratchCategoryMenuHorizontal .scratchCategoryMenuRow {
    float: none !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 6px !important;
}

/* Category items - styled as visual blocks */
.scratchCategoryMenuHorizontal .scratchCategoryMenuItem {
    padding: 0 !important;
    margin: 0 5px !important;
    cursor: grab !important;
    transition: all 0.2s ease !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 4px !important;
}

.scratchCategoryMenuHorizontal .scratchCategoryMenuItem:hover {
    transform: translateY(-4px) !important;
}

.scratchCategoryMenuHorizontal .scratchCategoryMenuItem:active {
    cursor: grabbing !important;
    transform: scale(0.95) !important;
}

/* Remove selected state background */
.scratchCategoryMenuHorizontal .scratchCategoryMenuItem.categorySelected {
    background: transparent !important;
}

/* Bubble styled as a block shape */
.scratchCategoryMenuHorizontal .scratchCategoryItemBubble {
    width: 56px !important;
    height: 52px !important;
    border-radius: 10px !important;
    margin: 0 !important;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1) !important;
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: none !important;
}

/* Add connecting notches using pseudo-elements */
.scratchCategoryMenuHorizontal .scratchCategoryItemBubble::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 6px;
    background: inherit;
    filter: brightness(0.9);
    border-radius: 3px;
}

.scratchCategoryMenuHorizontal .scratchCategoryItemBubble::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 6px;
    background: inherit;
    border-radius: 3px;
}

/* Event blocks have special shape (no top notch) */
.scratchCategoryMenuHorizontal .scratchCategoryMenuItem[data-category="event"] .scratchCategoryItemBubble {
    border-radius: 10px 10px 10px 0 !important;
}

.scratchCategoryMenuHorizontal .scratchCategoryMenuItem[data-category="event"] .scratchCategoryItemBubble::before {
    display: none !important;
}

/* Icon styling */
.scratchCategoryMenuHorizontal .scratchCategoryItemIcon {
    width: auto !important;
    height: auto !important;
    font-size: 20px !important;
    color: white !important;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2)) !important;
    margin: 0 !important;
}

/* Label styling */
.scratchCategoryMenuHorizontal .scratchCategoryMenuItemLabel {
    font-size: 10px !important;
    font-weight: 600 !important;
    color: #64748b !important;
    white-space: nowrap !important;
    text-align: center !important;
}

/* Hover effect on bubble */
.scratchCategoryMenuHorizontal .scratchCategoryMenuItem:hover .scratchCategoryItemBubble {
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1) !important;
}

/* Category separators */
.scratchCategoryMenuHorizontal .scratchCategorySeparator {
    width: 1px !important;
    height: 60px !important;
    background: #e2e8f0 !important;
    margin: 0 8px !important;
    flex-shrink: 0 !important;
}

/* Hide the flyout initially - we'll show blocks on click */
.blocklyFlyout {
    background: #f0f4f8 !important;
}

/* Grid pattern is now visible - styled via Blockly config */

/* Scrollbar styling */
.scratchCategoryMenuHorizontal::-webkit-scrollbar {
    height: 6px;
}

.scratchCategoryMenuHorizontal::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.scratchCategoryMenuHorizontal::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.scratchCategoryMenuHorizontal::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Category group wrapper */
.scratchCategoryGroup {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 6px !important;
}

.scratchCategoryGroupLabel {
    font-size: 10px !important;
    font-weight: 700 !important;
    color: #94a3b8 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.scratchCategoryGroupBlocks {
    display: flex !important;
    gap: 6px !important;
}

/* ==================== TABLET RESPONSIVE (1024px) ==================== */
@media (max-width: 1024px) {
    /* Menú de categorías más compacto */
    .scratchCategoryMenuHorizontal {
        height: 58px !important;
        padding: 4px 10px !important;
        gap: 6px !important;
    }

    .scratchCategoryMenuHorizontal .scratchCategoryMenuRow {
        gap: 3px !important;
    }

    .scratchCategoryMenuHorizontal .scratchCategoryMenuItem {
        margin: 0 2px !important;
        gap: 1px !important;
    }

    .scratchCategoryMenuHorizontal .scratchCategoryItemBubble {
        width: 32px !important;
        height: 28px !important;
        border-radius: 5px !important;
        box-shadow: 0 2px 3px rgba(0,0,0,0.1) !important;
    }

    .scratchCategoryMenuHorizontal .scratchCategoryItemBubble::before {
        width: 8px;
        height: 2px;
        top: 2px;
    }

    .scratchCategoryMenuHorizontal .scratchCategoryItemBubble::after {
        width: 8px;
        height: 2px;
        bottom: -2px;
    }

    .scratchCategoryMenuHorizontal .scratchCategoryItemIcon {
        font-size: 13px !important;
    }

    .scratchCategoryMenuHorizontal .scratchCategoryMenuItemLabel {
        font-size: 7px !important;
    }

    .scratchCategoryMenuHorizontal .scratchCategorySeparator {
        height: 32px !important;
        margin: 0 4px !important;
    }

    .scratchCategoryGroup {
        gap: 2px !important;
    }

    .scratchCategoryGroupLabel {
        font-size: 7px !important;
    }

    .scratchCategoryGroupBlocks {
        gap: 3px !important;
    }

    /* Tacho de basura pequeño en esquina inferior derecha */
    .blocklyTrash {
        transform: scale(0.5) !important;
        transform-origin: bottom right !important;
        right: 10px !important;
        bottom: 10px !important;
        opacity: 0.6 !important;
    }
}

/* ==================== SMALL TABLET (768px) ==================== */
@media (max-width: 768px) {
    .scratchCategoryMenuHorizontal {
        height: 50px !important;
        padding: 3px 6px !important;
        gap: 4px !important;
    }

    .scratchCategoryMenuHorizontal .scratchCategoryItemBubble {
        width: 28px !important;
        height: 24px !important;
        border-radius: 4px !important;
    }

    .scratchCategoryMenuHorizontal .scratchCategoryItemBubble::before,
    .scratchCategoryMenuHorizontal .scratchCategoryItemBubble::after {
        display: none !important;
    }

    .scratchCategoryMenuHorizontal .scratchCategoryItemIcon {
        font-size: 11px !important;
    }

    .scratchCategoryMenuHorizontal .scratchCategoryMenuItemLabel {
        display: none !important;
    }

    .scratchCategoryMenuHorizontal .scratchCategorySeparator {
        height: 26px !important;
        margin: 0 3px !important;
    }

    /* Tacho de basura muy pequeño */
    .blocklyTrash {
        transform: scale(0.4) !important;
        transform-origin: bottom right !important;
        right: 5px !important;
        bottom: 5px !important;
        opacity: 0.5 !important;
    }
}