/* Dropdown container */
.dropdown {
    position: relative;
    display: flex;
    align-items: center;
}

/* Dropdown button */
.dropbtn {
    background-color: transparent;
    color: var(--text-main);
    padding: 0;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
    font-family: inherit;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
}

.dropbtn:hover,
.dropdown:hover .dropbtn {
    opacity: 1;
}

/* Dropdown Content (Hidden by Default) */
.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--bg-card);
    min-width: 160px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    /* More visible shadow */
    z-index: 1002;
    right: 0;
    top: 100%;
    /* Anchor to bottom of container */
    border-radius: 4px;
    border: 1px solid var(--border-color);
    margin-top: 0.5rem;
    /* Visual gap */
    overflow: visible;
    /* Allow pseudo-element to extend */
    flex-direction: column;
}

/* Transparent bridge to prevent mouseleave when crossing the gap */
.dropdown-content::before {
    content: "";
    position: absolute;
    top: -0.5rem;
    /* Same as margin-top */
    left: 0;
    width: 100%;
    height: 0.5rem;
    background: transparent;
    display: block;
}

/* Links inside the dropdown */
.dropdown-content a {
    color: var(--text-main);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    text-transform: none;
    text-align: left;
    white-space: nowrap;
    transition: background-color 0.2s;
}

/* Change color of dropdown links on hover */
.dropdown-content a:hover {
    background-color: var(--hover-overlay);
}

/* Show the dropdown menu on hover or focus */
.dropdown:hover .dropdown-content,
.dropdown:focus-within .dropdown-content {
    display: flex;
}

/* Mobile responsiveness for dropdown */
@media (max-width: 768px) {
    .dropdown {
        display: flex;
        flex-direction: column;
        width: 100%;
        align-items: center;
    }

    .dropbtn {
        width: 100%;
        justify-content: center;
        padding: 0.5rem 0;
    }

    .dropdown-content {
        position: static;
        box-shadow: none;
        border: none;
        background-color: rgba(0, 0, 0, 0.03);
        width: 100%;
        margin-top: 0;
    }

    .dropdown-content a {
        text-align: center;
        padding: 10px;
    }
}