.quantfos-action-buttons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); /* Adjust minmax as needed */
    gap: 15px;
    padding: 15px;
    background-color: transparent; /* Match page background */
    box-shadow: none; /* Remove shadow to blend in */
}

.quantfos-action-button {
    position: relative;
    width: 100%; /* Take full width of grid cell */
    padding-bottom: 100%; /* Makes the height equal to the width */
    background-color: var(--button-bg-color, #0073aa);
    color: var(--button-text-color, #ffffff);
    border: 2px solid var(--button-border-color, #005177);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
    overflow: hidden; /* Hide content overflow */
}

.quantfos-action-button:hover {
    filter: brightness(1.1);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* New styles for the disabled state */
.quantfos-action-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(50%);
}

.quantfos-action-button:disabled:hover {
    filter: grayscale(50%); /* Prevent hover effect on disabled buttons */
    box-shadow: none;
}

.quantfos-action-button .dashicons {
    font-size: 2.5em; /* Adjust icon size */
    margin-bottom: 5px;
    line-height: 1;
}

.quantfos-action-button .button-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%; /* Ensure text wraps within the button */
    word-wrap: break-word;
    white-space: normal;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 10px;
    box-sizing: border-box;
}

/* Flashing Animation */
.quantfos-action-button.flashing {
    animation: quantfos-flash-red 1s infinite alternate;
}

@keyframes quantfos-flash-red {
    from {
        background-color: var(--button-bg-color, #0073aa);
        border-color: var(--button-border-color, #005177);
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7);
    }
    to {
        background-color: #ff4d4d; /* Bright red */
        border-color: #cc0000;
        box-shadow: 0 0 15px 5px rgba(255, 0, 0, 0.7);
    }
}

/* Modal Styles (reusing existing QuantFOS modal styles if possible, or defining new ones) */
.quantfos-modal {
    position: fixed;
    z-index: 99999; /* Ensure it's on top */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantfos-modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 0;
    border: 1px solid #888;
    width: 95%;
    max-width: 1000px;
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh; /* Limit modal height */
}

.quantfos-modal-header {
    padding: 15px 20px;
    background-color: #f1f1f1;
    color: #333;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quantfos-modal-header h3 {
    margin: 0;
    font-size: 1.5em;
}

.quantfos-modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.quantfos-modal-close:hover,
.quantfos-modal-close:focus {
    color: #000;
    text-decoration: none;
    outline: none;
}

.quantfos-modal-body {
    padding: 20px;
    flex-grow: 1;
    overflow-y: auto; /* Allow scrolling for modal content */
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .quantfos-action-buttons-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 15px;
        padding: 15px;
    }

    .quantfos-action-button .dashicons {
        font-size: 2em;
    }

    .quantfos-action-button .button-label {
        font-size: 0.9em;
    }

    .quantfos-modal-content {
        width: 95%;
        margin: 10px;
    }

    .quantfos-modal-header h3 {
        font-size: 1.2em;
    }
}