/* Profile Dropdown Menu */

.profile-nav-wrapper {
    position: relative;
}

.profile-nav {
    position: relative;
    cursor: pointer;
    border: none;
    background: none;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-nav:hover {
    background: rgba(255, 255, 255, 0.1);
}

.profile-nav:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    min-width: 240px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

/* Méga-menu styles */
.profile-megamenu {
    padding: 0;
    max-width: 800px;
    width: max-content;
    min-width: 600px;
}

.megamenu-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    padding: 0.875rem;
}

.megamenu-column {
    padding: 0 0.75rem;
    border-right: 1px solid var(--gray-200);
    min-height: auto;
}

.megamenu-column:first-child {
    padding-left: 0;
}

.megamenu-column:last-child {
    border-right: none;
    padding-right: 0;
}

.megamenu-section-title {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gray-600);
    margin: 0 0 0.625rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.megamenu-accordion-toggle {
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    padding: 0;
    margin: 0 0 0.625rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-200);
    transition: all 0.2s ease;
}

.megamenu-accordion-toggle:hover {
    color: var(--primary-600);
}

.megamenu-accordion-arrow {
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.megamenu-accordion-toggle.active .megamenu-accordion-arrow {
    transform: rotate(180deg);
}

.megamenu-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
    padding: 0;
    display: block;
    opacity: 0;
}

.megamenu-accordion-toggle.active + .megamenu-accordion-content {
    max-height: 5000px; /* Increased to accommodate more content */
    padding: 0.5rem 0 0 0;
    overflow: visible; /* Allow content to be visible when open */
    opacity: 1;
}

.megamenu-section-title:first-child {
    margin-top: 0;
}

.megamenu-column .profile-dropdown-item {
    padding: 0.5rem 0.625rem;
    font-size: 0.8125rem;
    margin-bottom: 0.25rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.megamenu-column .profile-dropdown-item:hover {
    background: var(--gray-50);
    transform: translateX(2px);
}

.megamenu-column .profile-dropdown-item.active {
    background: linear-gradient(135deg, rgba(200, 16, 46, 0.12), rgba(200, 16, 46, 0.08));
    color: var(--primary-600);
    font-weight: 600;
    border-left: 3px solid var(--primary-600);
    padding-left: calc(0.75rem - 3px);
}

.megamenu-column .profile-dropdown-item.active:hover {
    background: linear-gradient(135deg, rgba(200, 16, 46, 0.15), rgba(200, 16, 46, 0.12));
}

.megamenu-column .profile-dropdown-item span {
    font-size: 0.8125rem;
}

.megamenu-footer {
    padding: 0.75rem 0.875rem;
    border-top: 1px solid var(--gray-200);
    background: linear-gradient(to bottom, var(--gray-50), #ffffff);
}

.megamenu-footer .profile-dropdown-item {
    margin: 0;
    font-weight: 600;
    justify-content: center;
}

.megamenu-footer .profile-dropdown-item:hover {
    background: #fee2e2;
    transform: none;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .profile-megamenu {
        min-width: auto;
        max-width: 100%;
        width: 100%;
    }

    .megamenu-columns {
        grid-template-columns: 1fr;
        gap: 0;
        padding: 1rem;
    }

    .megamenu-column {
        padding: 1rem 0;
        border-right: none;
        border-bottom: 2px solid var(--gray-200);
        min-height: auto;
    }

    .megamenu-column:first-child {
        padding-left: 0;
    }

    .megamenu-column:last-child {
        padding-right: 0;
        border-bottom: none;
        padding-bottom: 0;
    }

    .megamenu-section-title {
        margin-top: 0.75rem;
        margin-bottom: 0.5rem;
        padding-bottom: 0.375rem;
    }

    .megamenu-column .megamenu-section-title:first-child {
        margin-top: 0;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .profile-megamenu {
        min-width: 500px;
        max-width: 700px;
    }

    .megamenu-columns {
        grid-template-columns: repeat(2, 1fr);
        padding: 0.75rem;
    }

    .megamenu-column {
        min-height: auto;
    }

    .megamenu-column:nth-child(3) {
        border-right: none;
        grid-column: span 2;
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px solid var(--gray-200);
    }
}

.profile-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.profile-dropdown-header {
    padding: 0.75rem;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.profile-dropdown-company {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.profile-dropdown-company .avatar-small {
    width: 36px;
    height: 36px;
    font-size: 0.875rem;
}

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

.profile-dropdown-company-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-900);
    margin: 0 0 0.125rem 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-dropdown-company-email {
    font-size: 0.75rem;
    color: var(--gray-600);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-dropdown-menu {
    padding: 0.5rem;
}

.profile-dropdown-menu.profile-megamenu {
    padding: 0;
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
    color: var(--gray-700);
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.9375rem;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

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

.profile-dropdown-item.active {
    background: linear-gradient(135deg, rgba(200, 16, 46, 0.1), rgba(200, 16, 46, 0.05));
    color: var(--primary-600);
    font-weight: 600;
    border-left: 3px solid var(--primary-600);
    padding-left: calc(0.75rem - 3px);
}

.profile-dropdown-item.active:hover {
    background: linear-gradient(135deg, rgba(200, 16, 46, 0.15), rgba(200, 16, 46, 0.1));
}

.profile-dropdown-item.danger {
    color: #dc2626;
}

.profile-dropdown-item.danger:hover {
    background: #fee2e2;
    color: #991b1b;
}

.profile-dropdown-item.admin-item {
    position: relative;
    background: linear-gradient(135deg, rgba(200, 16, 46, 0.1), rgba(200, 16, 46, 0.05));
    border-left: 3px solid #1F3A5F;
}

.profile-dropdown-item.admin-item:hover {
    background: linear-gradient(135deg, rgba(200, 16, 46, 0.15), rgba(200, 16, 46, 0.1));
}

.admin-badge-small {
    margin-left: auto;
    padding: 0.25rem 0.5rem;
    background: #1F3A5F;
    color: white;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.profile-dropdown-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.megamenu-column .profile-dropdown-item svg {
    width: 16px;
    height: 16px;
}

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

/* Backdrop */
.profile-dropdown-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    background: transparent;
    display: none;
}

.profile-dropdown-backdrop.show {
    display: block;
}

/* Mobile */
@media (max-width: 768px) {
    .profile-dropdown {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        min-width: auto;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

