
/* =========================================
   STAFFLYX MODALS
========================================= */

/* Затемнение фона */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    background: rgba(10, 20, 38, 0.62);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
}

.modal-overlay[hidden] {
    display: none;
}

/* Основное окно */
.modal {
    width: 100%;
    max-width: 480px;
    max-height: calc(100dvh - 40px);
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin: auto;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
    animation: stafflyx-modal-enter 0.22s ease-out;
}

/* Анимация */
@keyframes stafflyx-modal-enter {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Шапка */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
}

.modal-close:hover {
    background: var(--surface-hover);
    color: var(--text);
}

/* Форма и содержимое */
#profile-edit-form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.modal-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 22px 24px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

/* Аватар */
.avatar-upload-preview {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 14px auto 18px;
}

.avatar-upload-preview img {
    width: 112px;
    height: 112px;
    object-fit: cover;
    border: 2px solid #438ff0;
    border-radius: 20px;
    box-shadow: 0 6px 20px rgba(55, 130, 225, 0.18);
}

/* Поля */
.modal .form-group {
    margin-bottom: 20px;
}

.modal .form-label {
    display: block;
    margin-bottom: 9px;
    font-weight: 600;
}

.modal .form-control {
    width: 100%;
    border-radius: 12px;
    padding: 12px 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.modal .form-control:focus {
    border-color: #438ff0;
    box-shadow: 0 0 0 3px rgba(67, 143, 240, 0.13);
}

.modal .form-hint {
    display: block;
    margin-top: 8px;
    font-size: 11px;
}

/* Кнопки */
.modal .button {
    min-height: 40px;
    padding: 9px 18px;
    border-radius: 11px;
}

.modal #avatar-delete {
    width: 100%;
    margin-top: 12px;
}

/* Прокрутка */
.modal-body {
    scrollbar-width: thin;
}

.modal-body::-webkit-scrollbar {
    width: 7px;
}

.modal-body::-webkit-scrollbar-thumb {
    border-radius: 10px;
}

/* =========================================
   LIGHT THEME
========================================= */

html[data-theme="light"] .modal {
    background: #ffffff;
    color: #24344d;
    border-color: #e3eaf3;
}

html[data-theme="light"] .modal-header,
html[data-theme="light"] .modal-body,
html[data-theme="light"] .modal-footer {
    background: #ffffff;
    color: #24344d;
    border-color: #e3eaf3;
}

html[data-theme="light"] .modal-title,
html[data-theme="light"] .modal .form-label {
    color: #293e5a;
}

html[data-theme="light"] .modal .form-hint {
    color: #8192aa;
}

html[data-theme="light"] .modal .form-control {
    background: #f7faff;
    color: #263a56;
    border-color: #d6e2f2;
}

html[data-theme="light"] .modal .form-control::placeholder {
    color: #9aa9bd;
}

html[data-theme="light"] .modal .form-control:focus {
    background: #ffffff;
    border-color: #438ff0;
}

html[data-theme="light"] .modal-close {
    color: #71839c;
}

html[data-theme="light"] .modal #avatar-delete {
    background: #edf5ff;
    color: #29496f;
    border-color: #d4e5fa;
}

html[data-theme="light"] .modal-body {
    scrollbar-color: #c5d4e8 #f5f8fc;
}

html[data-theme="light"] .modal-body::-webkit-scrollbar-track {
    background: #f5f8fc;
}

/* =========================================
   DARK THEME
========================================= */

html[data-theme="dark"] .modal {
    background: #17243a;
    color: #e7efff;
    border-color: #30435f;
}

html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-body,
html[data-theme="dark"] .modal-footer {
    background: #17243a;
    color: #e7efff;
    border-color: #30435f;
}

html[data-theme="dark"] .modal-title,
html[data-theme="dark"] .modal .form-label {
    color: #e7efff;
}

html[data-theme="dark"] .modal .form-hint {
    color: #91a6c5;
}

html[data-theme="dark"] .modal .form-control {
    background: #24344d;
    color: #edf4ff;
    border-color: #405775;
}

html[data-theme="dark"] .modal .form-control::placeholder {
    color: #91a6c5;
}

html[data-theme="dark"] .modal .form-control:focus {
    background: #293c58;
    border-color: #62a5ff;
    box-shadow: 0 0 0 3px rgba(75, 145, 235, 0.2);
}

html[data-theme="dark"] .modal-close {
    color: #a8bbd6;
}

html[data-theme="dark"] .modal-close:hover {
    color: #70adff;
}

html[data-theme="dark"] .modal #avatar-delete {
    background: #243a57;
    color: #e7efff;
    border-color: #405775;
}

html[data-theme="dark"] .modal-body {
    scrollbar-color: #405775 #17243a;
}

html[data-theme="dark"] .modal-body::-webkit-scrollbar-track {
    background: #17243a;
}

/* =========================================
   MOBILE
========================================= */

@media (max-width: 600px) {
    .modal-overlay {
        padding: 12px;
    }

    .modal {
        width: 100%;
        max-width: 480px;
        max-height: calc(100dvh - 24px);
        border-radius: 16px;
    }

    .modal-header {
        padding: 16px 18px;
    }

    .modal-body {
        padding: 18px;
    }

    .modal-footer {
        padding: 14px 18px;
    }
}
