/* Dropdown Component Styles */

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    cursor: pointer;
    user-select: none;
}

.dropdown-toggle::after {
    display: inline-block;
    margin-left: 0.5em;
    vertical-align: 0.125em;
    content: "";
    border-top: 0.3em solid;
    border-right: 0.3em solid transparent;
    border-bottom: 0;
    border-left: 0.3em solid transparent;
}

.dropdown-toggle:hover {
    opacity: 0.9;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    display: none;
    min-width: 280px;
    padding: 0.5rem 0;
    margin: 0.125rem 0 0;
    font-size: 1rem;
    color: var(--color-text);
    text-align: left;
    list-style: none;
    background-color: var(--color-bg-light);
    background-clip: padding-box;
    border: 1px solid var(--color-border);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.175);
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    clear: both;
    font-weight: 400;
    color: var(--color-text);
    text-align: inherit;
    text-decoration: none;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out;
}

.dropdown-item:hover,
.dropdown-item:focus {
    color: var(--color-text);
    background-color: var(--color-bg);
    text-decoration: none;
}

.dropdown-item:active {
    color: var(--color-text-contrast);
    background-color: var(--color-primary);
    text-decoration: none;
}

.dropdown-item.disabled,
.dropdown-item:disabled {
    color: var(--color-text-mid);
    pointer-events: none;
    background-color: transparent;
    cursor: not-allowed;
    opacity: 0.65;
}

.dropdown-header {
    display: block;
    padding: 0.5rem 1rem;
    margin-bottom: 0;
    font-size: 0.875rem;
    color: var(--color-text-mid);
    white-space: nowrap;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dropdown-divider {
    height: 0;
    margin: 0.5rem 0;
    overflow: hidden;
    border-top: 1px solid var(--color-border);
}

/* Dropdown menu positioning variants */
.dropdown-menu-end {
    right: 0;
    left: auto;
}

.dropdown-menu-start {
    right: auto;
    left: 0;
}

/* Reading List Dropdown Specific Styles */
.dropdown-item .d-flex {
    align-items: center;
}

.dropdown-item strong {
    font-size: 0.95rem;
    color: var(--color-text);
}

.dropdown-item small {
    font-size: 0.8rem;
    line-height: 1.3;
}

.dropdown-item .badge {
    font-size: 0.75rem;
    padding: 0.25em 0.5em;
}

/* Status alerts inside dropdown */
.dropdown + [data-reading-list-dropdown-target="status"] {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .dropdown-menu {
        min-width: 240px;
        max-width: 90vw;
    }

    .dropdown-item {
        padding: 0.75rem 1rem;
    }
}

/* Animation for dropdown appearance */
@keyframes dropdown-fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-menu.show {
    animation: dropdown-fade-in 0.15s ease-out;
}

/* Loading state */
.dropdown-item.loading {
    pointer-events: none;
    opacity: 0.6;
    position: relative;
}

.dropdown-item.loading::after {
    content: "";
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--color-text-mid);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spinner-rotate 0.6s linear infinite;
}

@keyframes spinner-rotate {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}
