﻿/* ============================================
   MODERN PROFILE DROPDOWN STYLES
   ============================================ */

/* Profile Dropdown Container */
.profile-dropdown-container {
    position: relative;
    display: inline-block;
}

/* Profile Trigger Button */
.profile-trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

    .profile-trigger:hover {
        background: rgba(102, 126, 234, 0.1);
    }

    .profile-trigger:focus {
        outline: none;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    }

/* Profile Avatar */
.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    transition: transform 0.3s ease;
}

.profile-trigger:hover .profile-avatar {
    transform: scale(1.05);
}

.avatar-initials {
    color: white;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #ef4444;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.badge-count {
    line-height: 1;
}

/* Dropdown Menu */
.profile-dropdown-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 320px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    border: 1px solid #e5e7eb;
}

    /* Dropdown arrow */
    .profile-dropdown-menu::before {
        content: '';
        position: absolute;
        top: -8px;
        right: 16px;
        width: 16px;
        height: 16px;
        background: white;
        border-left: 1px solid #e5e7eb;
        border-top: 1px solid #e5e7eb;
        transform: rotate(45deg);
    }

    .profile-dropdown-menu.show {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

/* Dropdown Content */
.dropdown-content {
    position: relative;
    z-index: 1;
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

/* Dropdown Sections */
.dropdown-section {
    padding: 16px;
}

/* User Info Section */
.user-info-section {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    padding: 20px 16px;
}

.user-info-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar-large {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.avatar-initials-large {
    color: white;
    font-size: 24px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 4px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-email {
    font-size: 13px;
    color: #64748b;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Credits Section */
.credits-section {
    padding: 16px;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
}

.credits-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.credits-icon-wrapper {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

    .credits-icon-wrapper i {
        font-size: 20px;
        color: white;
    }

.credits-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.credits-label {
    font-size: 12px;
    color: #78716c;
    font-weight: 500;
}

.credits-amount-large {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
}

/* Divider */
.dropdown-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 0;
}

/* Menu Items */
.menu-items-section {
    padding: 8px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    color: #1e293b;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    position: relative;
}

    .dropdown-item:hover {
        background: #f1f5f9;
        color: #667eea;
        text-decoration: none;
    }

    .dropdown-item i {
        width: 20px;
        font-size: 16px;
        text-align: center;
        color: #64748b;
        transition: color 0.2s ease;
    }

    .dropdown-item:hover i {
        color: #667eea;
    }

    .dropdown-item span:not(.item-badge) {
        flex: 1;
    }

.item-badge {
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
}

/* Sign Out Section */
.signout-section {
    padding: 8px;
    background: #fafafa;
}

.signout-item {
    width: 100%;
    background: transparent;
    border: none;
    color: #dc2626;
    cursor: pointer;
    font-family: inherit;
}

    .signout-item:hover {
        background: #fee2e2;
        color: #dc2626;
    }

    .signout-item i {
        color: #dc2626;
    }

#logoutForm {
    margin: 0;
}

/* Login Button (for non-authenticated users) */
.btn-login {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

    .btn-login:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
        text-decoration: none;
        color: white;
    }

    .btn-login i {
        font-size: 16px;
    }

/* Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .profile-dropdown-menu {
        width: 280px;
        right: -20px;
    }

        .profile-dropdown-menu::before {
            right: 32px;
        }
}

/* Accessibility */
.profile-trigger:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.dropdown-item:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: -2px;
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .profile-dropdown-menu {
        background: #1e293b;
        border-color: #334155;
    }

        .profile-dropdown-menu::before {
            background: #1e293b;
            border-color: #334155;
        }

    .dropdown-content {
        background: #1e293b;
    }

    .user-name {
        color: #f1f5f9;
    }

    .user-email {
        color: #94a3b8;
    }

    .credits-amount-large {
        color: #f1f5f9;
    }

    .dropdown-item {
        color: #f1f5f9;
    }

        .dropdown-item:hover {
            background: #334155;
        }

    .dropdown-divider {
        background: #334155;
    }
}

.credit-updated {
    animation: creditPulse 700ms ease;
}

@keyframes creditPulse {
    0% {
        transform: scale(1);
        box-shadow: none;
    }

    40% {
        transform: scale(1.06);
        box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    }

    100% {
        transform: scale(1);
        box-shadow: none;
    }
}
