/* ==========================================================================
   Croplod — Profile Modal (طراحی الهام‌گرفته از Google Account)
   استایل‌های پایه مودال پروفایل که توسط profile-modal.js ساخته می‌شود.
   (پیش از این فایل فقط استایل‌های سوییچ تم وجود داشت و مودال بدون استایل
   رندر می‌شد؛ به همین دلیل با کلیک روی آواتار باز نمی‌شد.)
   ========================================================================== */

.profile-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 980;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    transition: opacity 200ms ease;
}
.profile-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.profile-modal {
    position: fixed;
    top: calc(var(--header-height, 64px) + 12px);
    inset-inline-end: 22px;
    z-index: 990;
    width: 372px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - var(--header-height, 64px) - 44px);
    overflow-y: auto;
    background: var(--bg-card, #ffffff);
    color: var(--text-primary, #1c1c22);
    border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.06));
    border-radius: 24px;
    box-shadow: 0 24px 64px -12px rgba(0, 0, 0, 0.35);
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
    transform-origin: top center;
    pointer-events: none;
    transition: transform 200ms cubic-bezier(0.2, 0, 0, 1), opacity 200ms ease;
}
.profile-modal.active {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

/* ---------- نوار بالا: ایمیل + دکمه بستن ---------- */
.pm-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px 8px;
}
.pm-topbar-email {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-tertiary, #9aa0a6);
    direction: ltr;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pm-topbar-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: var(--bg-secondary, #f6f7f9);
    color: var(--text-secondary, #5f6368);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 150ms ease, color 150ms ease;
}
.pm-topbar-close:hover {
    background: var(--icon-bg-primary, rgba(79, 70, 229, 0.1));
    color: var(--color-primary-500, #4f46e5);
}
.pm-topbar-close svg {
    width: 15px;
    height: 15px;
}

/* ---------- آواتار + خوش‌آمدگویی ---------- */
.pm-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 24px 18px;
    text-align: center;
}
.pm-avatar-wrap {
    position: relative;
    width: 84px;
    height: 84px;
}
.pm-avatar {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: linear-gradient(135deg, #06b6d4, #0284c7 55%, #3b82f6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    overflow: hidden;
    box-shadow: 0 0 0 3px var(--bg-card, #fff), 0 0 0 4px rgba(6, 182, 212, 0.35);
}
.pm-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.pm-avatar-camera {
    position: absolute;
    bottom: 0;
    inset-inline-end: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border-primary, #e6e8ec);
    color: var(--text-secondary, #5f6368);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    transition: color 150ms ease, transform 150ms ease;
}
.pm-avatar-camera:hover {
    color: var(--color-primary-500, #4f46e5);
    transform: scale(1.08);
}
.pm-avatar-camera svg {
    width: 15px;
    height: 15px;
}
.pm-greeting {
    margin-top: 14px;
    font-size: 19px;
    font-weight: 700;
    color: var(--text-primary, #1c1c22);
}

/* ---------- دکمه مدیریت حساب ---------- */
.pm-manage-btn {
    display: block;
    margin: 0 20px 14px;
    padding: 12px 16px;
    text-align: center;
    text-decoration: none;
    background: var(--bg-secondary, #f6f7f9);
    border: 1px solid var(--border-primary, #e6e8ec);
    border-radius: 14px;
    color: var(--text-primary, #1c1c22);
    font-size: 13.5px;
    font-weight: 700;
    font-family: var(--font-family, inherit);
    transition: background 150ms ease, border-color 150ms ease;
}
.pm-manage-btn:hover {
    background: var(--icon-bg-primary, rgba(79, 70, 229, 0.1));
    border-color: var(--color-primary-500, #4f46e5);
}

/* ---------- لیست حساب‌های متصل ---------- */
.pm-accounts-section {
    padding: 0 12px 12px;
}
.pm-accounts-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.pm-account-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 14px;
    cursor: pointer;
    transition: background 150ms ease;
}
.pm-account-item:hover {
    background: var(--bg-secondary, #f6f7f9);
}
.pm-account-item.active {
    background: var(--icon-bg-primary, rgba(79, 70, 229, 0.1));
}
.pm-account-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #06b6d4, #0284c7 55%, #3b82f6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
}
.pm-account-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.pm-account-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 2px;
}
.pm-account-name {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-primary, #1c1c22);
}
.pm-account-email {
    font-size: 11.5px;
    color: var(--text-tertiary, #9aa0a6);
    direction: ltr;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pm-account-check {
    margin-inline-start: auto;
    color: var(--color-primary-500, #4f46e5);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.pm-account-check svg {
    width: 17px;
    height: 17px;
}

/* ---------- سوییچ تم ---------- */

/* ---------- دکمه‌های پایین: افزودن حساب + خروج ---------- */
.pm-bottom-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 12px 12px;
}
.pm-action-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--text-primary, #1c1c22);
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font-family, inherit);
    cursor: pointer;
    text-decoration: none;
    transition: background 150ms ease;
}
.pm-action-btn:hover {
    background: var(--bg-secondary, #f6f7f9);
}
.pm-action-btn svg {
    width: 17px;
    height: 17px;
    color: var(--text-secondary, #5f6368);
    flex-shrink: 0;
}
.pm-action-btn--signout {
    color: var(--color-error-500, #dc2626);
}
.pm-action-btn--signout svg {
    color: var(--color-error-500, #dc2626);
}
.pm-action-btn--signout:hover {
    background: rgba(220, 38, 38, 0.08);
}

/* ---------- فوتر ---------- */
.pm-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 16px 16px;
    border-top: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.06));
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-tertiary, #9aa0a6);
}
.pm-footer a {
    color: var(--text-tertiary, #9aa0a6);
    text-decoration: none;
    transition: color 150ms ease;
}
.pm-footer a:hover {
    color: var(--color-primary-500, #4f46e5);
}
.pm-footer-dot {
    opacity: 0.5;
}

/* ---------- موبایل و تبلت: وسط‌چین شدن کامل مودال ---------- */
@media (max-width: 1023px) {
  .profile-modal {
    top: 50%;
    left: 50%;
    right: auto;
    width: min(372px, calc(100vw - 28px));
    max-height: calc(100vh - 32px);
    transform: translate(-50%, -46%) scale(0.98);
    transform-origin: center;
  }
  .profile-modal.active {
    transform: translate(-50%, -50%);
  }
}
