/* ════════════════════════════════════════════════════════════
   PROFILE PANEL — стили боковой панели профиля
   (вытянуто из admin_users.css, нужно для профиля на всех страницах)
   ════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────
   ИНПУТЫ И СЕЛЕКТЫ
   ───────────────────────────────────────────── */
.au-input,
.au-select {
    height: 34px;
    padding: 7px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #f0f6fc;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.au-input:focus,
.au-select:focus {
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.1);
}
.au-input:disabled,
.au-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.02);
}

/* ─────────────────────────────────────────────
   BACKDROP + PANEL
   ───────────────────────────────────────────── */
.au-panel-backdrop {
    position: fixed;
    inset: 0;
    z-index: 998;
    background: rgba(5, 8, 18, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}
.au-panel-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.au-panel {
    position: fixed;
    top: 0;
    right: -480px;
    width: 480px;
    max-width: 100vw;
    height: 100vh;
    z-index: 999;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(ellipse 80% 60% at 10% 20%, rgba(139, 92, 246, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 90% 80%, rgba(56, 139, 253, 0.05) 0%, transparent 50%),
        rgba(16, 20, 35, 0.92);
    backdrop-filter: blur(28px) saturate(1.5);
    -webkit-backdrop-filter: blur(28px) saturate(1.5);
    border-left: 1px solid transparent;
    box-shadow: none;
    visibility: hidden;
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.3s ease,
                border-color 0.3s ease,
                visibility 0s linear 0.3s;
}
.au-panel.is-open {
    right: 0;
    visibility: visible;
    border-left-color: rgba(167, 139, 250, 0.4);
    box-shadow:
        -16px 0 30px -8px rgba(128, 70, 255, 0.30),
        -7px  0 16px -3px rgba(160, 125, 252, 0.38);
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.3s ease,
                border-color 0.3s ease,
                visibility 0s linear 0s;
}

/* Шапка панели */
.au-panel-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.au-panel-title {
    font-size: 15px;
    font-weight: 600;
    background: linear-gradient(135deg, #e6edf3, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.au-panel-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    border-radius: 8px;
    color: #8b949e;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: all 0.15s;
}
.au-panel-close:hover {
    background: rgba(248, 81, 73, 0.1);
    color: #f85149;
}
.au-panel-close:focus,
.au-panel-close:focus-visible {
    outline: none;
    box-shadow: none;
}

/* Тело и футер */
.au-panel-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px 20px;
}
.au-panel-footer {
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(13, 17, 30, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ─────────────────────────────────────────────
   HERO БЛОК С АВАТАРОМ
   ───────────────────────────────────────────── */
.au-panel-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
}
.au-panel-hero-info {
    flex: 1;
    min-width: 0;
}
.au-panel-hero-name {
    margin-bottom: 2px;
    font-size: 15px;
    font-weight: 600;
    color: #f0f6fc;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.au-panel-hero-login {
    margin-bottom: 6px;
    font-size: 12px;
    color: #8b949e;
}
.au-panel-hero-role {
    display: inline-block;
}

/* ─────────────────────────────────────────────
   АВАТАР ПРОФИЛЯ (круглый, с инициалами + картинкой)
   ───────────────────────────────────────────── */
.au-panel-avatar-wrap {
    position: relative;
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    border-radius: 50%;
    cursor: pointer;
}
.au-panel-avatar {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, #6d28d9, #8b5cf6);
    color: #fff;
    font-weight: 600;
    font-size: 22px;
    letter-spacing: 0.5px;
    user-select: none;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.3);
    z-index: 1;
}
.au-panel-avatar-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
    z-index: 2;
}

/* Тонкая внутренняя обводка */
.au-panel-avatar-wrap::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
    pointer-events: none;
    z-index: 3;
}

/* Оверлей с кнопками */
.au-panel-avatar-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 24px;
    padding: 0 4px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
    border-radius: 0 0 50% 50%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}
.au-panel-avatar-wrap:hover .au-panel-avatar-overlay,
.au-panel-avatar-wrap:focus-within .au-panel-avatar-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* Кнопки в оверлее */
.au-avatar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    margin: 0;
    background: rgba(255, 255, 255, 0.22);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    line-height: 0;
    transition: background 0.15s, transform 0.15s;
}
.au-avatar-btn:hover {
    background: rgba(139, 92, 246, 0.95);
    transform: scale(1.08);
}
.au-avatar-btn-danger:hover {
    background: rgba(248, 81, 73, 0.95);
}
.au-avatar-btn svg {
    width: 11px;
    height: 11px;
    display: block;
    stroke: #fff;
    fill: none;
    pointer-events: none;
}

/* ─────────────────────────────────────────────
   FIELDSET И ФОРМА
   ───────────────────────────────────────────── */
.au-fieldset {
    margin: 0 0 20px;
    padding: 0;
    border: none;
    background: transparent;
}
.au-fieldset legend {
    display: block;
    width: 100%;
    padding: 0;
    margin: 0 0 10px;
    color: #a78bfa;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.au-field {
    margin-bottom: 10px;
}
.au-field label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 500;
    color: #8b949e;
}
.au-req {
    color: #f85149;
}
.au-field .au-input,
.au-field .au-select {
    width: 100%;
    height: 34px;
}
.au-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.au-hint {
    margin-top: 4px;
    font-size: 11px;
    color: #8b949e;
    font-style: italic;
}

/* Валидация */
.au-field.has-error .au-input,
.au-field.has-error .au-select {
    border-color: rgba(248, 81, 73, 0.5);
    box-shadow: 0 0 0 2px rgba(248, 81, 73, 0.1);
}
.au-field-error {
    display: none;
    margin-top: 4px;
    font-size: 11px;
    color: #f85149;
}
.au-field.has-error .au-field-error {
    display: block;
}

/* ─────────────────────────────────────────────
   ПОЛЕ ПАРОЛЯ + ПОКАЗАТЬ/СКРЫТЬ
   ───────────────────────────────────────────── */
.pwd-input-wrap {
    position: relative;
}
.pwd-input-wrap .au-input {
    padding-right: 38px;
    width: 100%;
}
.pwd-toggle-btn {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    background: none;
    border: none;
    border-radius: 6px;
    color: #8b949e;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}
.pwd-toggle-btn:hover {
    color: #c9d1d9;
    background: rgba(255, 255, 255, 0.05);
}
.pwd-toggle-btn svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

/* Индикатор силы пароля */
.pwd-strength-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}
.pwd-strength-bar {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}
.pwd-strength-fill {
    height: 100%;
    width: 0;
    border-radius: 2px;
    background: #f85149;
    transition: width 0.25s ease, background 0.25s ease;
}
.pwd-strength-fill.is-weak   { width: 33%;  background: #f85149; }
.pwd-strength-fill.is-medium { width: 66%;  background: #f59e0b; }
.pwd-strength-fill.is-strong { width: 100%; background: #3fb950; }
.pwd-strength-label {
    font-size: 11px;
    color: #8b949e;
    white-space: nowrap;
}

/* ─────────────────────────────────────────────
   КРЕСТИК ЗАКРЫТИЯ В ПРОФИЛЕ
   ───────────────────────────────────────────── */
#profilePanelClose,
#profilePanelClose:hover,
#profilePanelClose:focus,
#profilePanelClose:focus-visible,
#profilePanelClose:active {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* ─────────────────────────────────────────────
   БЕЙДЖ «ИЗМЕНЕНО» В ПРОФИЛЕ
   ───────────────────────────────────────────── */
#profilePanel .changes-badge {
    display: none;
    margin-left: 8px;
    padding: 2px 8px;
    background: rgba(139, 92, 246, 0.18);
    color: #c4b5fd;
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: lowercase;
    vertical-align: middle;
}
#profilePanel.has-changes .changes-badge {
    display: inline-block;
}

/* Кнопка «Сохранить» — индикация изменений */
#profilePanel #btnProfileSave {
    transition: opacity 0.25s ease, box-shadow 0.25s ease, transform 0.15s ease;
}
#profilePanel.has-changes #btnProfileSave {
    box-shadow: 0 0 0 1px rgba(63, 185, 110, 0.35),
                0 0 14px rgba(63, 185, 110, 0.25);
}
#profilePanel.has-changes #btnProfileSave:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 0 1px rgba(63, 185, 110, 0.55),
                0 0 18px rgba(63, 185, 110, 0.4);
}

/* ─────────────────────────────────────────────
   CONFIRM-OVERLAY ВНУТРИ #profilePanel
   ───────────────────────────────────────────── */
#profilePanel .profile-confirm-overlay {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(13, 17, 23, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
#profilePanel .profile-confirm-overlay.is-open {
    display: flex !important;
}
#profilePanel .profile-confirm-box {
    width: 90%;
    max-width: 360px;
    padding: 20px 22px;
    background: rgba(22, 27, 44, 0.98);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
#profilePanel .profile-confirm-box h4 {
    margin: 0 0 8px;
    font-size: 14px;
    color: #e6edf3;
}
#profilePanel .profile-confirm-box p {
    margin: 0 0 16px;
    font-size: 12px;
    color: #8b949e;
    line-height: 1.5;
}
#profilePanel .profile-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ─────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────── */
@media (max-width: 720px) {
    .au-panel {
        width: 100vw;
    }
    .au-grid-2 {
        grid-template-columns: 1fr;
    }
}
/* ─────────────────────────────────────────────
   5. HERO БЛОК С АВАТАРОМ ВНУТРИ ПАНЕЛИ
   ───────────────────────────────────────────── */
.au-panel-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
}
.au-panel-hero-info {
    flex: 1;
    min-width: 0;
}
.au-panel-hero-name {
    margin-bottom: 2px;
    font-size: 15px;
    font-weight: 600;
    color: #f0f6fc;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.au-panel-hero-login {
    margin-bottom: 6px;
    font-size: 12px;
    color: #8b949e;
}
.au-panel-hero-role {
    display: inline-block;
}

/* Обёртка вокруг аватара в hero */
.au-panel-hero-avatar-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
/* ─────────────────────────────────────────────
   3. БЕЙДЖИ РОЛЕЙ И СТАТУСОВ
   ───────────────────────────────────────────── */
.au-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    border: 1px solid;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.au-badge-user       { color: #8b949e; border-color: rgba(139, 148, 158, 0.30); background: rgba(139, 148, 158, 0.06); }
.au-badge-admin      { color: #58a6ff; border-color: rgba(56, 139, 253, 0.35);  background: rgba(56, 139, 253, 0.08); }
.au-badge-superadmin {
    color: #a78bfa;
    border-color: rgba(139, 92, 246, 0.4);
    background: rgba(139, 92, 246, 0.1);
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.15);
}
/* ─────────────────────────────────────────────
   7. FIELDSET И ФОРМА
   ───────────────────────────────────────────── */
/* Текст ошибки под полем */
.au-field-error {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.3;
    color: #f85149;
    min-height: 0;
}
.au-field-error:empty {
    display: none;
}

/* Невалидное поле */
.au-input.is-invalid {
    border-color: #f85149 !important;
    box-shadow: 0 0 0 2px rgba(248, 81, 73, 0.15);
}

/* Валидное поле */
.au-input.is-valid {
    border-color: #3fb950 !important;
}

/* Индикатор силы пароля */
.pwd-strength-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}
.pwd-strength-bar {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}
.pwd-strength-fill {
    height: 100%;
    width: 0;
    border-radius: 2px;
    transition: width 0.25s, background 0.25s;
}
.pwd-strength-fill[data-level="1"] { width: 20%;  background: #f85149; }
.pwd-strength-fill[data-level="2"] { width: 40%;  background: #f0883e; }
.pwd-strength-fill[data-level="3"] { width: 60%;  background: #d29922; }
.pwd-strength-fill[data-level="4"] { width: 80%;  background: #3fb950; }
.pwd-strength-fill[data-level="5"] { width: 100%; background: #2ea043; }

.pwd-strength-label {
    font-size: 11px;
    color: #8b949e;
    white-space: nowrap;
    min-width: 60px;
}