/**
 * Profile Dropdown Styles
 * Version: 5.1.1
 * Last Update: November 25, 2025
 *
 * Styles for user profile dropdown menu with favorites and profile actions
 */

/* Profile Actions Group - Container for favorites + profile */
.profile-actions-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Favorites Button */
.favorites-btn {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
    color: var(--gray-600);
}

.favorites-btn:hover {
    background: transparent;
    transform: scale(1.05);
}

.favorites-btn svg {
    width: 20px;
    height: 20px;
    transition: color 0.2s;
}

.favorites-btn:hover svg {
    color: #ef4444;
}

/* Favorites Badge */
.favorites-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--theme-primary);
    color: white;
    font-size: 0.625rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Favorites Dropdown */
.favorites-btn-wrapper {
    position: relative;
}

.favorites-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    width: min(320px, calc(100vw - 2rem)); /* v2.44.25: Fix #2 - Responsive width */
    max-height: 420px;
    z-index: 10001;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.favorites-dropdown.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Dropdown Header */
.favorites-dropdown-header {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    color: var(--gray-900);
    font-size: 0.9375rem;
    flex-shrink: 0;
}

.favorites-count {
    color: var(--gray-500);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Favorites List */
.favorites-dropdown-list {
    max-height: 240px;
    overflow-y: auto;
    padding: 0.5rem;
    flex: 1;
}

/* Custom Scrollbar */
.favorites-dropdown-list::-webkit-scrollbar {
    width: 6px;
}

.favorites-dropdown-list::-webkit-scrollbar-track {
    background: var(--gray-50);
    border-radius: 3px;
}

.favorites-dropdown-list::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.favorites-dropdown-list::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* Individual Favorite Item */
.favorite-item-wrapper {
    position: relative;
    display: block;
    background: transparent;
    border: none;
    margin: 0;
}

.favorite-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--gray-100);
}

.favorite-item:last-child {
    border-bottom: none;
}

.favorite-item:hover {
    background: var(--gray-50);
}

/* Delete Button for Favorite Items */
.favorite-item-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 71, 71, 0.9);
    color: white;
    border: none;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
    opacity: 0;
    padding: 0;
}

.favorite-item-wrapper:hover .favorite-item-delete {
    opacity: 1;
}

.favorite-item-delete:hover {
    background: rgba(255, 71, 71, 1);
    transform: scale(1.1);
}

.favorite-item-delete:active {
    transform: scale(0.95);
}

.favorite-thumb {
    width: 60px;
    height: 60px;
    border-radius: 0.375rem;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--gray-200);
}

.favorite-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.favorite-title {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--gray-900);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.3;
}

.favorite-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: auto;
}

.favorite-price {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.875rem;
}

.favorite-platform-badge {
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    color: white;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Empty State */
.favorites-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--gray-500);
}

.favorites-empty svg {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    color: var(--gray-300);
}

.favorites-empty p {
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.25rem;
    font-size: 0.9375rem;
}

.favorites-empty small {
    font-size: 0.8125rem;
    color: var(--gray-500);
}

/* Dropdown Footer */
.favorites-dropdown-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--gray-200);
    flex-shrink: 0;
}

.btn-view-all {
    display: block;
    width: 100%;
    padding: 0.625rem;
    background: var(--primary-color);
    color: white;
    text-align: center;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    transition: background 0.2s;
}

.btn-view-all:hover {
    background: var(--primary-dark);
}

/* Profile Button */
.profile-btn-wrapper {
    position: relative;
}

.profile-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--gray-700);
    font-weight: 500;
    font-size: 0.875rem;
}

.profile-btn:hover {
    /* No hover effect */
}

.profile-btn.active {
    background: var(--gray-100);
    color: var(--gray-700);
}

/* Profile Avatar */
.profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--theme-primary) !important;
    color: white !important;
    font-weight: 600;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Profile Name (hidden on small screens) */
.profile-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 769px) {
    .profile-name {
        display: none;
    }

    .profile-btn {
        padding: 0.375rem;
        gap: 0;
    }

    /* v2.44.25: Fix #15 - Minimum touch target size on mobile */
    .favorites-btn {
        width: 44px;
        height: 44px;
    }
}

/* Dropdown Arrow */
.profile-dropdown-arrow {
    width: 16px;
    height: 16px;
    transition: transform 0.2s;
    color: var(--gray-500);
}

.profile-btn.active .profile-dropdown-arrow {
    transform: rotate(180deg);
}

/* Profile Dropdown Menu */
.profile-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    min-width: 220px;
    z-index: 10001;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.profile-dropdown.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

/* Dropdown Header - User Info */
.profile-dropdown-header {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.profile-dropdown-header .profile-avatar {
    width: 42px;
    height: 42px;
    font-size: 1rem;
}

.profile-dropdown-user-info {
    flex: 1;
    min-width: 0;
}

.profile-dropdown-user-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--gray-900);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-dropdown-user-email {
    font-size: 0.8125rem;
    color: var(--gray-500);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 0.125rem;
}

/* Dropdown Menu Items */
.profile-dropdown-menu {
    padding: 0.5rem;
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    color: var(--gray-700);
    font-size: 0.875rem;
    font-weight: 500;
}

.profile-dropdown-item:hover {
    background: var(--gray-50);
    color: var(--primary-600);
}

.profile-dropdown-item svg {
    width: 18px;
    height: 18px;
    color: var(--gray-400);
    flex-shrink: 0;
}

.profile-dropdown-item:hover svg {
    color: var(--primary-600);
}

/* Admin Panel Item - Special Highlight */
.profile-dropdown-item.admin-panel {
    background: linear-gradient(135deg, var(--primary-50) 0%, var(--secondary-50) 100%);
    border: 1px solid var(--primary-100);
}

.profile-dropdown-item.admin-panel svg {
    color: var(--primary-600);
}

.profile-dropdown-item.admin-panel img {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    filter: brightness(0) saturate(100%) invert(42%) sepia(93%) saturate(1352%) hue-rotate(210deg) brightness(92%) contrast(101%);
}

.profile-dropdown-item.admin-panel:hover {
    background: linear-gradient(135deg, var(--primary-100) 0%, var(--secondary-100) 100%);
    border-color: var(--primary-200);
    color: var(--primary-700);
}

.profile-dropdown-item.admin-panel:hover img {
    filter: brightness(0) saturate(100%) invert(28%) sepia(77%) saturate(1234%) hue-rotate(210deg) brightness(95%) contrast(102%);
}

/* Dropdown Divider */
.profile-dropdown-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 0.5rem 0;
}

/* Logout Item */
.profile-dropdown-item.logout {
    color: var(--danger-600);
}

.profile-dropdown-item.logout:hover {
    background: var(--danger-50);
    color: var(--danger-700);
}

.profile-dropdown-item.logout svg {
    color: var(--danger-500);
}

.profile-dropdown-item.logout:hover svg {
    color: var(--danger-700);
}

/* Login Button (when not authenticated) */
.login-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.login-btn svg {
    width: 18px;
    height: 18px;
}

/* Mobile Bottom Navigation Profile */
.mobile-nav-item.profile-nav {
    position: relative;
}

.mobile-nav-item .profile-avatar {
    width: 24px;
    height: 24px;
    font-size: 0.625rem;
}

/* Responsive Adjustments */
@media (max-width: 400px) {
    .profile-dropdown {
        right: -1rem;
        left: -1rem;
        min-width: auto;
    }

    .favorites-btn {
        width: 34px;
        height: 34px;
    }

    .favorites-btn svg {
        height: 18px;
    }
}

/* Dark Theme Support (Future) */
@media (prefers-color-scheme: dark) {
    .profile-dropdown {
        background: var(--gray-800);
        border-color: var(--gray-700);
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    }

    .profile-dropdown-header {
        border-bottom-color: var(--gray-700);
    }

    .profile-dropdown-user-name {
        color: var(--gray-100);
    }

    .profile-dropdown-user-email {
        color: var(--gray-400);
    }

    .profile-dropdown-item {
        color: var(--gray-200);
    }

    .profile-dropdown-item:hover {
        background: var(--gray-700);
        color: var(--primary-400);
    }
}
