/**
 * Product Actions & Favorite Button Styles
 *
 * Follows existing dropdown patterns from:
 * - .user-dropdown (theme-vars.css)
 * - .builds-dropdown (builder.css)
 *
 * Uses ONLY CSS variables from theme-vars.css
 *
 * @package Flavor
 */

/* ============================================
   PRODUCT ACTIONS DROPDOWN
   ============================================ */

/* Container */
.product-actions {
    position: relative;
    display: inline-flex;
}

/* Trigger Button - matches .header-action-btn pattern */
.product-actions__trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.product-actions__trigger:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.product-actions__trigger:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Dropdown Menu - matches .user-dropdown pattern */
.product-actions__dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 100;
    min-width: 200px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    padding: 8px;
}

/* Position variant for left-aligned dropdown */
.product-actions--left .product-actions__dropdown {
    right: auto;
    left: 0;
}

/* Dropdown Items - matches .user-dropdown__item pattern */
.product-actions__item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.product-actions__item:hover {
    background-color: var(--bg-hover);
}

.product-actions__item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

/* Item icons */
.product-actions__item svg {
    flex-shrink: 0;
    color: var(--text-muted);
    transition: color 0.15s ease;
}

.product-actions__item:hover svg {
    color: var(--text-primary);
}

/* Favorite active state - matches .user-dropdown__item--logout pattern */
.product-actions__item--active {
    color: var(--error);
}

.product-actions__item--active svg {
    color: var(--error);
}

.product-actions__item--active:hover {
    background-color: var(--error-bg);
}


/* ============================================
   FAVORITE BUTTON (Standalone)
   ============================================ */

.favorite-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.favorite-btn:hover {
    background-color: var(--bg-hover);
    border-color: var(--border-light);
    color: var(--text-primary);
}

.favorite-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Active/Favorited state */
.favorite-btn--active {
    color: var(--error);
    border-color: var(--error);
    background-color: var(--error-bg);
}

.favorite-btn--active:hover {
    background-color: var(--error-bg);
    border-color: var(--error);
}

/* Loading state */
.favorite-btn--loading {
    pointer-events: none;
    opacity: 0.7;
}

.favorite-btn__spinner {
    animation: favorite-spin 0.8s linear infinite;
}

@keyframes favorite-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Icon transitions */
.favorite-btn__icon {
    transition: transform 0.2s ease;
}

.favorite-btn:hover .favorite-btn__icon {
    transform: scale(1.1);
}

.favorite-btn:active .favorite-btn__icon {
    transform: scale(0.95);
}

/* Size variants */
.favorite-btn--small {
    border-radius: 6px;
}

.favorite-btn--large {
    border-radius: 10px;
}


/* ============================================
   DROPDOWN TRANSITIONS
   (Using same pattern as theme-vars.css)
   ============================================ */

.dropdown-enter {
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.dropdown-enter-start {
    opacity: 0;
    transform: translateY(-4px);
}

.dropdown-enter-end {
    opacity: 1;
    transform: translateY(0);
}

.dropdown-leave {
    transition: opacity 0.1s ease, transform 0.1s ease;
}

.dropdown-leave-start {
    opacity: 1;
    transform: translateY(0);
}

.dropdown-leave-end {
    opacity: 0;
    transform: translateY(-4px);
}


/* ============================================
   MOBILE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
    .product-actions__dropdown {
        min-width: 180px;
    }

    .product-actions__item {
        padding: 12px;
        font-size: 0.9375rem;
    }
}
