/**
 * دراپ‌داون‌های هدر: منوی کاربر، مینی کارت سبد، مینی کارت اعلان‌ها
 * همیار گرافیک - هاور + کلیک، پرفورمنس
 */

/* ---- z-index و wrapper: دراپ‌داون‌ها بالای همه المان‌های هدر و محتوا ---- */
.header-dropdown-wrap {
    position: relative;
    display: inline-block;
    z-index: 100;
}

/* ---- منوی کاربر: هاور و کلیک ---- */
.header-user-menu .header-user-menu-trigger {
    cursor: pointer;
}

.header-user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0;
    min-width: 16rem;
    width: 18rem;
    max-width: calc(100vw - 2rem);
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
    border: 1px solid #f3f4f6;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

[dir="rtl"] .header-user-dropdown {
    right: 0;
    left: auto;
}

.header-user-menu:hover .header-user-dropdown,
.header-user-menu.is-open .header-user-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.header-user-dropdown-inner {
    overflow: hidden;
    border-radius: inherit;
}

.header-user-dropdown-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f3f4f6;
}

.header-user-dropdown-close {
    flex-shrink: 0;
    border: none;
    background: none;
    cursor: pointer;
}

.header-user-dropdown-wallet {
    padding: 0 1.25rem 1rem;
}

.header-user-dropdown-links {
    padding: 0.5rem 0;
    border-top: 1px solid #f3f4f6;
}

.header-user-dropdown-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
}

.header-user-dropdown-link:hover {
    background: #f9fafb;
    color: #111827;
}

.header-user-dropdown-footer {
    padding: 0.5rem 0;
    border-top: 1px solid #f3f4f6;
}

.header-user-dropdown-logout {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 700;
    color: #dc2626;
    background: none;
    border: none;
    cursor: pointer;
    transition: background-color 0.15s;
    text-align: right;
}

.header-user-dropdown-logout:hover {
    background: #fef2f2;
}

/* ---- مینی کارت‌ها (سبد و اعلان): فقط هاور ---- */
.header-cart-mini .header-mini-trigger,
.header-notifications-mini .header-mini-trigger {
    display: inline-flex;
}

.header-mini-badge {
    pointer-events: none;
}

.header-mini-card {
    position: absolute;
    top: 100%;
    right: -180px;
    margin-top: 0;
    padding-top: 0.375rem;
    min-width: 20rem;
    width: 22rem;
    max-width: calc(100vw - 2rem);
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.04);
    border: 1px solid #e5e7eb;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}
/* ناحیه نامرئی بالای باکس تا با حرکت موس به پایین باکس بسته نشود */
.header-mini-card::before {
    content: '';
    position: absolute;
    right: 0;
    left: 0;
    top: 0;
    height: 0.5rem;
    margin-top: -0.5rem;
}

/* با JS کلاس is-open اضافه می‌شود تا هاور راحت‌تر باشد (با تأخیر بسته شدن) */
.header-cart-mini:hover .header-cart-dropdown,
.header-cart-mini.is-open .header-cart-dropdown,
.header-notifications-mini:hover .header-notifications-dropdown,
.header-notifications-mini.is-open .header-notifications-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.header-mini-card-inner {
    padding: 1rem 1.25rem;
    overflow-x: hidden;
}

.header-mini-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.375rem;
}

.header-mini-card-text {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0 0 0.75rem 0;
}

.header-mini-card-btn {
    display: block;
    width: 100%;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    background: #E5AA08;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    text-decoration: none;
    transition: background-color 0.2s;
}

.header-mini-card-btn:hover {
    background: #b78806;
    color: #fff;
}

/* حالت خالی مینی کارت / اعلان */
.header-mini-empty {
    text-align: center;
    padding: 0.75rem 0;
}

.header-mini-empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.header-mini-empty-text {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #374151;
    margin: 0 0 0.25rem 0;
}

.header-mini-empty-hint {
    font-size: 0.8125rem;
    color: #9ca3af;
    margin: 0 0 0.75rem 0;
}

.header-mini-card-btn--outline {
    background: transparent;
    color: #E5AA08;
    border: 2px solid #E5AA08;
}

.header-mini-card-btn--outline:hover {
    background: #fefbf3;
    color: #b78806;
    border-color: #b78806;
}

/* لیست آیتم‌ها در مینی کارت */
.header-mini-list {
    list-style: none;
    padding: 0;
    margin: 0 0 0.75rem 0;
    max-height: 12rem;
    overflow-y: auto;
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 0.75rem;
}

.header-mini-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f9fafb;
}

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

.header-mini-item-thumb {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-mini-item-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-mini-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
}

.header-mini-item-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.header-mini-item-title {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #111827;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.header-mini-item-price {
    font-size: 0.75rem;
    color: #059669;
    font-weight: 600;
}

/* آیتم اعلان در مینی کارت */
.header-mini-item--notification {
    padding: 0.375rem 0;
}

.header-mini-item--notification .header-mini-item-link {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 0.25rem 0;
}

.header-mini-item--notification .header-mini-item-link:hover {
    color: #E5AA08;
}

.header-mini-item-link--plain {
    cursor: default;
}

.header-mini-item--unread .header-mini-item-title {
    font-weight: 700;
}

.header-mini-item-meta {
    font-size: 0.6875rem;
    color: #9ca3af;
    margin-top: 0.125rem;
    display: block;
}
