/* Block HP Menu Styles for Moodle 4.5 */

.block-hp-menu {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 0;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
    align-items: stretch;
}

.block-hp-menu .hp-menu-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    background-color: #0056b3;
    color: #ffffff;
    text-decoration: none;
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    min-width: 200px;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    border: none;
    cursor: pointer;
    overflow: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
}

.block-hp-menu .hp-menu-button:hover,
.block-hp-menu .hp-menu-button:focus {
    background-color: #004085;
    color: #ffffff;
    text-decoration: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.block-hp-menu .hp-menu-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.block-hp-menu .hp-menu-text {
    flex: 1 1 auto;
    margin-right: 0.5rem;
    z-index: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    line-height: 1.4;
    min-width: 0;
    max-width: calc(100% - 3rem);
    overflow: hidden;
}

.block-hp-menu .hp-menu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.block-hp-menu .hp-menu-icon-img {
    width: 1.5rem;
    height: 1.5rem;
    object-fit: contain;
    display: block;
    vertical-align: middle;
}

/* Ensure block doesn't have default block styling that interferes */
.block.block_hp_menu {
    border: none;
    box-shadow: none;
    background: transparent;
    padding: 0;
    margin: 0;
}

.block.block_hp_menu .card-body {
    padding: 0;
}

/* Hide block title text but keep the header structure for controls */
.block.block_hp_menu .card-title,
.block.block_hp_menu h3,
.block.block_hp_menu .header .title,
.block.block_hp_menu .block-title,
.block.block_hp_menu .card-title-text {
    display: none !important;
    visibility: hidden !important;
}

/* Ensure block controls (settings, move) remain visible */
.block.block_hp_menu .card-header {
    display: flex !important;
    justify-content: flex-end;
    align-items: center;
    min-height: 2.5rem;
    padding: 0.5rem !important;
}

/* Ensure action menu and move icons are visible */
.block.block_hp_menu .card-header .block-action,
.block.block_hp_menu .card-header .dropdown,
.block.block_hp_menu .card-header [data-action],
.block.block_hp_menu .card-header .icon {
    display: inline-block !important;
    visibility: visible !important;
}

/* Make block work well in drawer or main content */
.block_hp_menu {
    width: 100%;
    box-sizing: border-box;
}

/* Ensure consistent width in both edit and normal mode */
.block.block_hp_menu .card-body,
.block.block_hp_menu .block-content {
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

/* Fix button alignment in edit mode */
.editing .block.block_hp_menu .block-hp-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    width: 100%;
}

.editing .block.block_hp_menu .hp-menu-button {
    flex: 0 1 auto;
    max-width: 100%;
    width: fit-content;
}


/* Ensure buttons display properly in drawer */
.drawer .block.block_hp_menu .block-hp-menu {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.drawer .block.block_hp_menu .hp-menu-button {
    width: 100%;
    min-width: auto;
}

/* Responsive design */
@media (max-width: 768px) {
    .block-hp-menu {
        flex-direction: column;
    }
    
    .block-hp-menu .hp-menu-button {
        width: 100%;
        min-width: auto;
    }
}

/* Alternative styling for different themes */
.block-hp-menu.hp-menu-container {
    /* Additional custom class styling can be added here */
}

