/* Category options styling */
.category-options-container {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 600px;
    margin: 8px auto;
    animation: fadeIn 0.5s ease-out;
}

.category-options-intro {
    font-size: 1rem;
    margin-bottom: 12px;
    color: #555;
    text-align: center;
    font-weight: 500;
}

.category-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.category-option-btn {
    padding: 12px 18px;
    border-radius: 10px;
    border: none;
    background-color: #1a9e78;
    color: white;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(26, 158, 120, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.category-option-btn:hover {
    background-color: #158a69;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(26, 158, 120, 0.4);
}

/* Custom tooltip styling - only show when data-description exists */
.category-option-btn[data-description]::after {
    content: attr(data-description);
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    /* Allow text wrapping with reasonable width constraints */
    white-space: normal;
    max-width: min(300px, 90vw);
    width: max-content;
    text-align: center;
    line-height: 1.4;
    z-index: 1000;
    font-size: 0.85rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
    pointer-events: none;
    /* Prevent overflow off screen edges */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.category-option-btn[data-description]:hover::after {
    opacity: 1;
    visibility: visible;
}

.category-option-btn[data-description]::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.85) transparent transparent transparent;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
}

.category-option-btn[data-description]:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Tooltip positioning adjustments for buttons near edges */
/* Right-side buttons: align tooltip to the right edge */
.category-buttons .category-option-btn:last-child[data-description]::after {
    left: auto;
    right: 0;
    transform: none;
}

.category-buttons .category-option-btn:last-child[data-description]::before {
    left: auto;
    right: 20px;
    transform: none;
}

/* Left-side buttons: align tooltip to the left edge */
.category-buttons .category-option-btn:first-child[data-description]::after {
    left: 0;
    transform: none;
}

.category-buttons .category-option-btn:first-child[data-description]::before {
    left: 20px;
    transform: none;
}

/* Make famous people options a different color */
.category-option-btn[data-category-type="famous-person"] {
    background-color: #e85d54;
    box-shadow: 0 2px 5px rgba(232, 93, 84, 0.3);
}

.category-option-btn[data-category-type="famous-person"]:hover {
    background-color: #d44d44;
    box-shadow: 0 4px 8px rgba(232, 93, 84, 0.4);
}

/* Make historic events options a different color */
.category-option-btn[data-category-type="historic-event"] {
    background-color: #1a9e78;
    box-shadow: 0 2px 5px rgba(26, 158, 120, 0.3);
}

.category-option-btn[data-category-type="historic-event"]:hover {
    background-color: #158a69;
    box-shadow: 0 4px 8px rgba(26, 158, 120, 0.4);
}

/* Make dream options a different color */
.category-option-btn[data-category-type="dream"] {
    background-color: #7c3aed;
    box-shadow: 0 2px 5px rgba(124, 58, 237, 0.3);
}

.category-option-btn[data-category-type="dream"]:hover {
    background-color: #6d28d9;
    box-shadow: 0 4px 8px rgba(124, 58, 237, 0.4);
}

/* Mobile responsive tooltip adjustments */
@media (max-width: 768px) {
    .category-option-btn[data-description]::after {
        max-width: calc(100vw - 40px);
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        font-size: 0.8rem;
        padding: 6px 10px;
    }
    
    /* On mobile, all tooltips center align for simplicity */
    .category-buttons .category-option-btn:first-child[data-description]::after,
    .category-buttons .category-option-btn:last-child[data-description]::after {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }
    
    .category-buttons .category-option-btn:first-child[data-description]::before,
    .category-buttons .category-option-btn:last-child[data-description]::before {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }
}
