/* ========================================= */
/* == СТИЛИ ПРОФИЛЯ (монохром, минимализм) == */
/* ========================================= */

.profile-page {
    padding-top: 40px;
    padding-bottom: 60px;
}

/* Заголовок страницы */
.page-header {
    margin-bottom: 32px;
}

.page-title {
    font-size: 2em;
    font-weight: 700;
    margin: 0;
    color: #111;
    letter-spacing: -0.02em;
}

.page-subtitle {
    margin: 6px 0 0;
    color: #777;
    font-size: 1em;
}

/* Сетка: визитка + детали */
.profile-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 28px;
    align-items: start;
}

.profile-card {
    background-color: #fff;
    border-radius: 16px;
    border: 1px solid #ececef;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.04);
}

/* --- Левая колонка: визитка --- */
.profile-identity-card {
    position: relative;
    overflow: hidden;
    text-align: center;
    padding: 0 28px 28px;
}

.identity-cover {
    height: 96px;
    margin: 0 -28px;
    background: linear-gradient(135deg, #2b2b2b 0%, #111 100%);
}

.profile-main-avatar {
    width: 104px;
    height: 104px;
    border-radius: 50%;
    margin: -52px auto 16px;
    background: #1a1a1a;
    color: #fff;
    font-size: 2.4em;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 4px solid #fff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.profile-identity-card h2 {
    margin: 0 0 6px;
    font-size: 1.4em;
    font-weight: 700;
    color: #111;
}

.profile-identity-card .email {
    color: #777;
    font-size: 0.92em;
    word-break: break-all;
    margin: 0 0 18px;
}

/* Бейдж роли */
.profile-badge {
    margin: 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.8em;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.badge-admin { background: #111; color: #fff; }
.badge-staff { background: #4b5563; color: #fff; }
.badge-user  { background: #f1f1f3; color: #555; }

/* Статистика */
.profile-stats {
    display: flex;
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid #f0f0f2;
}

.stat-item {
    flex: 1;
    text-align: center;
}

.stat-item + .stat-item {
    border-left: 1px solid #f0f0f2;
}

.stat-value {
    font-size: 1.05em;
    font-weight: 700;
    color: #111;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.78em;
    color: #9a9aa2;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* --- Правая колонка: детали --- */
.profile-details-card {
    padding: 28px 32px;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    padding-bottom: 18px;
    border-bottom: 1px solid #f0f0f2;
}

.card-head h3 {
    margin: 0;
    font-size: 1.2em;
    font-weight: 700;
    color: #111;
}

.card-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.detail-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid #f5f5f7;
}

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

.detail-item .label {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #6b6b73;
    font-weight: 500;
    font-size: 0.95em;
}

.detail-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: #f4f4f6;
    color: #555;
    flex-shrink: 0;
}

.detail-icon svg {
    width: 17px;
    height: 17px;
}

.detail-item .value {
    font-weight: 600;
    color: #111;
    text-align: right;
    word-break: break-word;
}

/* Кнопки */
.btn-primary {
    background: #111;
    border: 1px solid #111;
    color: #fff;
    border-radius: 9px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: #000;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}

.btn-secondary {
    background: #fff;
    border: 1px solid #d7d7db;
    color: #1a1a1a;
    border-radius: 9px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    border-color: #111;
    background: #fafafa;
}

/* Иконочные кнопки в шапке карточки деталей */
.card-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.card-actions .btn svg {
    width: 15px;
    height: 15px;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.85em;
}

/* ========================================= */
/* == СТИЛИ МОДАЛЬНЫХ ОКОН == */
/* ========================================= */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-overlay.visible {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 0;
    max-width: 550px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f8f8;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
    font-weight: 600;
    color: #222;
}

.close-button {
    background: white;
    border: 1px solid #ddd;
    font-size: 1.8em;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    color: #666;
}

.close-button:hover {
    background: #222;
    color: white;
    border-color: #222;
    transform: rotate(90deg);
}

.modal-body {
    padding: 30px;
}

/* Standalone-страница входа (/users/login/ — сюда ведёт редирект @login_required) */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 80px 20px;
    min-height: 60vh;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    padding: 40px;
}

.auth-card h2 {
    margin: 0 0 28px;
    text-align: center;
}

.auth-card .btn {
    width: 100%;
    padding: 14px 20px;
}

.auth-back {
    display: block;
    margin-top: 20px;
    text-align: center;
    color: #777;
    text-decoration: none;
    font-size: 0.9em;
}

.auth-back:hover {
    color: #222;
}

/* Стили для полей формы */
.form-field {
    margin-bottom: 22px;
}

.form-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #222;
    font-size: 0.95em;
}

.form-field input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1em;
    transition: all 0.3s ease;
    background: #fafafa;
}

.form-field input:focus {
    border-color: #222;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
    background: white;
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.85em;
    color: #999;
}

/* Сообщения об ошибках и успехе */
.form-errors {
    background: #fff5f5;
    border-left: 4px solid #d93025;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.form-errors ul,
.form-errors .error-list {
    list-style: none;
    padding: 0;
    margin: 0;
    color: #c53030;
}

.form-errors li {
    margin-bottom: 5px;
}

.form-errors li:last-child {
    margin-bottom: 0;
}

.form-success {
    margin-bottom: 20px;
}

.alert {
    padding: 15px;
    border-radius: 6px;
    font-weight: 500;
}

.alert-success {
    background: #f0fdf4;
    border-left: 4px solid #10b981;
    color: #065f46;
}

/* Кнопки в модальных окнах */
.modal-content .btn-primary {
    padding: 14px 24px;
    font-size: 1em;
    width: 100%;
    background: #222;
    border: none;
    color: #fff;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-content .btn-primary:hover {
    background: #000;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn-block {
    display: block;
    width: 100%;
}

/* Курсоры */
.modal-content input {
    cursor: text;
}

.modal-content button {
    cursor: pointer;
}

/* Адаптивность */
@media (max-width: 768px) {
    .profile-grid {
        grid-template-columns: 1fr;
    }

    .card-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-actions {
        width: 100%;
    }

    .card-actions .btn {
        flex: 1;
        justify-content: center;
    }

    .modal-content {
        max-width: 95%;
    }
}
