/* =============================================================
   Profile Drawer — Green-themed, self-contained.
   Selectors use ._user-profile-* to avoid leaking to other drawers.
   ============================================================= */

/* --- Trigger (avatar + name in navbar) --- */
.user-profile {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
}

.user-profile .user-avatar {
    display: block;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.user-profile .user-name {
    font-weight: 500;
    font-size: 16px;
    color: var(--n800);
    white-space: nowrap;
}

/* Landing navbar (dark/blue bg) — trigger must be white */
.topbar .user-name {
    color: var(--n0);
}

.topbar .user-avatar circle,
.topbar .user-avatar path {
    stroke: rgba(255, 255, 255, 0.6);
    fill: rgba(255, 255, 255, 0.3);
}

/* --- Backdrop overlay --- */
._user-profile-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: color-mix(in srgb, black 30%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1099;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

._user-profile-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

/* --- Base drawer panel --- */
._user-profile-drawer {
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    background: var(--n0);
    z-index: 1100;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-sm);
    border-radius: 16px 0 0 16px;
    display: flex;
    flex-direction: column;
}

._user-profile-drawer.open {
    transform: translateX(0);
}

/* --- Profile drawer sizing --- */
.profile-drawer {
    width: 420px;
}

/* --- Header (green gradient) --- */
.profile-drawer__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 24px;
    background: linear-gradient(135deg, var(--brand-green-dark) 0%, var(--brand-green) 100%);
    border-bottom: none;
}

.profile-drawer__header-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.profile-drawer__avatar {
    flex-shrink: 0;
    color: var(--brand-green-lighter);
}

.profile-drawer__name-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.profile-drawer__name {
    font-size: 17px;
    font-weight: 600;
    color: var(--n0);
    margin: 0;
}

.profile-drawer__name-ar {
    font-size: 14px;
    color: var(--footer-muted);
    margin: 0;
}

.profile-drawer__email {
    font-size: 13px;
    color: var(--brand-green-lighter);
    margin: 4px 0 0;
}

.profile-drawer__header .drawer-close {
    color: var(--footer-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: color 0.2s;
}

.profile-drawer__header .drawer-close:hover {
    color: var(--n0);
}

/* --- Drawer body --- */
.profile-drawer .drawer-body {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* --- Cards --- */
.profile-drawer__card {
    background: var(--n10);
    border: 1px solid var(--n30);
    border-radius: 12px;
    padding: 16px;
}

.profile-drawer__card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--n800);
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.profile-drawer__card-title svg {
    color: var(--brand-green);
    flex-shrink: 0;
}

/* --- Info rows --- */
.profile-drawer__rows {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.profile-drawer__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--n30);
}

.profile-drawer__row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.profile-drawer__label {
    font-size: 13px;
    color: var(--n300);
    font-weight: 500;
}

.profile-drawer__value {
    font-size: 14px;
    color: var(--n900);
    font-weight: 500;
}

/* --- Licenses --- */
.profile-drawer__license {
    padding: 10px 0;
    border-bottom: 1px solid var(--n30);
}

.profile-drawer__license:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.profile-drawer__license:first-of-type {
    padding-top: 0;
}

.profile-drawer__license-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.profile-drawer__license-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--n100);
    flex-shrink: 0;
}

.profile-drawer__license-dot--active {
    background: var(--brand-green);
}

.profile-drawer__license-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--n900);
}

.profile-drawer__license-meta {
    font-size: 12px;
    color: var(--n300);
    padding-inline-start: 16px;
}

/* --- Address --- */
.profile-drawer__address {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-drawer__address p {
    margin: 0;
    font-size: 14px;
    color: var(--n700);
    line-height: 1.5;
}

/* --- Footer buttons --- */
.profile-drawer__footer {
    padding: 24px;
    border-top: 1px solid var(--n30);
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--n0);
}

.profile-drawer__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--n30);
    background: var(--n0);
    color: var(--n800);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.profile-drawer__btn svg {
    flex-shrink: 0;
}

.profile-drawer__btn:hover {
    border-color: var(--brand-green);
    color: var(--brand-green);
    background: color-mix(in srgb, var(--brand-green-bg) 4%, transparent);
}

.profile-drawer__btn--accent {
    border-color: color-mix(in srgb, var(--brand-green) 30%, transparent);
    color: var(--brand-green);
}

.profile-drawer__btn--accent:hover {
    border-color: var(--brand-green);
    color: var(--brand-green);
    background: color-mix(in srgb, var(--brand-green-bg) 6%, transparent);
}

.profile-drawer__btn--danger {
    border-color: var(--border);
    color: var(--error);
}

.profile-drawer__btn--danger:hover {
    border-color: var(--error);
    color: var(--error);
    background: var(--surface);
}

/* =============================================================
   RESPONSIVE (mobile)
   ============================================================= */
@media (max-width: 768px) {
    .profile-drawer {
        width: 100vw;
        border-radius: 0;
    }

    .profile-drawer .drawer-body {
        padding: 16px;
        gap: 20px;
    }

    .profile-drawer__footer {
        padding: 16px;
    }
}

/* =============================================================
   RTL
   ============================================================= */
[dir="rtl"] ._user-profile-drawer {
    right: auto;
    left: 0;
    transform: translateX(-100%);
    border-radius: 0 16px 16px 0;
}

[dir="rtl"] ._user-profile-drawer.open {
    transform: translateX(0) !important;
}

/* =============================================================
   DARK MODE
   ============================================================= */
[data-theme="dark"] ._user-profile-drawer {
    background: var(--n10);
}

[data-theme="dark"] .profile-drawer__header {
    background: linear-gradient(135deg, var(--brand-green-dark) 0%, var(--brand-green-dark) 100%);
}

[data-theme="dark"] .profile-drawer__card {
    background: var(--n20);
    border-color: var(--n40);
}

[data-theme="dark"] .profile-drawer__footer {
    background: var(--n10);
    border-top-color: var(--n30);
}

[data-theme="dark"] .profile-drawer__btn {
    background: var(--n20);
    border-color: var(--n40);
    color: var(--n800);
}

[data-theme="dark"] .profile-drawer__btn--danger {
    border-color: var(--border);
    color: var(--error);
}

[data-theme="dark"] .user-profile .user-name {
    color: var(--n200);
}
