/* ==============================================
   ПРОФИЛЬ ПОЛЬЗОВАТЕЛЯ - УЛУЧШЕННЫЙ ДИЗАЙН
   Оптимизировано для светлой и темной темы
   ============================================== */

/* ==============================================
   ПЕРЕМЕННЫЕ ДЛЯ СВЕТЛОЙ ТЕМЫ
   ============================================== */
[data-theme="light"] {
    --profile-bg: #f8f9fa;
    --profile-card-bg: #ffffff;
    --profile-card-border: #e5e7eb;
    --profile-text-primary: #1f2937;
    --profile-text-secondary: #6b7280;
    --profile-text-muted: #9ca3af;
    --profile-accent: #3b82f6;
    --profile-accent-hover: #2563eb;
    --profile-success: #10b981;
    --profile-success-bg: #ecfdf5;
    --profile-danger: #ef4444;
    --profile-danger-bg: #fef2f2;
    --profile-warning: #f59e0b;
    --profile-warning-bg: #fffbeb;
    --profile-border: #e5e7eb;
    --profile-hover: #f3f4f6;
    --profile-shadow: rgba(0, 0, 0, 0.05);
    --profile-shadow-hover: rgba(0, 0, 0, 0.1);
    --profile-modal-overlay: rgba(0, 0, 0, 0.5);
    --profile-gradient-start: #667eea;
    --profile-gradient-end: #764ba2;
}

/* ==============================================
   ПЕРЕМЕННЫЕ ДЛЯ ТЕМНОЙ ТЕМЫ
   ============================================== */
[data-theme="dark"] {
    --profile-bg: #0b0d14;
    --profile-card-bg: #181b26;
    --profile-card-border: #282c3d;
    --profile-text-primary: #e3e6ee;
    --profile-text-secondary: #e3e6ee;
    --profile-text-muted: #8e95ab;
    --profile-accent: #a78bfa;
    --profile-accent-hover: #a78bfa;
    --profile-success: #6ee7b7;
    --profile-success-bg: #0b1a13;
    --profile-danger: #fb7185;
    --profile-danger-bg: #2a1418;
    --profile-warning: #fbbf24;
    --profile-warning-bg: #2a1f0f;
    --profile-border: #282c3d;
    --profile-hover: #31364a;
    --profile-shadow: rgba(0, 0, 0, 0.40);
    --profile-shadow-hover: rgba(0, 0, 0, 0.45);
    --profile-modal-overlay: rgba(0, 0, 0, 0.70);
    --profile-gradient-start: #a78bfa;
    --profile-gradient-end: #a78bfa;
}


/* ==============================================
   КОНТЕЙНЕР СТРАНИЦЫ
   ============================================== */
.profile-page {
    padding: 24px;
    background: var(--profile-bg);
    min-height: calc(100vh - 80px);
}

/* ==============================================
   ЗАГОЛОВОК ПРОФИЛЯ
   ============================================== */
.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--profile-border);
}

.profile-header-content h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--profile-text-primary);
    margin: 0 0 8px 0;
}

.profile-subtitle {
    font-size: 16px;
    color: var(--profile-text-secondary);
    margin: 0;
}

.profile-header-actions {
    display: flex;
    gap: 12px;
}

/* ==============================================
   СЕТКА ПРОФИЛЯ
   ============================================== */
.profile-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    max-width: 1400px;
}

/* ==============================================
   КАРТОЧКИ
   ============================================== */
.profile-card {
    background: var(--profile-card-bg);
    border: 1px solid var(--profile-card-border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 1px 3px var(--profile-shadow);
    transition: all 0.3s ease;
    margin-bottom: 24px;
}

.profile-card:hover {
    box-shadow: 0 4px 12px var(--profile-shadow-hover);
}

/* Убрать отступ у последнего блока */
.profile-card:last-child {
    margin-bottom: 0;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    color: var(--profile-text-primary);
    margin: 0 0 20px 0;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--profile-border);
}

.card-title svg {
    color: var(--profile-accent);
    flex-shrink: 0;
}

/* ==============================================
   КАРТОЧКА АВАТАРКИ
   ============================================== */
.profile-avatar-card {
    text-align: center;
    padding: 32px 24px;
}

.avatar-container {
    width: 180px;
    height: 180px;
    margin: 0 auto 20px;
    position: relative;
}

.avatar-image {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--profile-border);
    box-shadow: 0 4px 16px var(--profile-shadow);
    transition: all 0.3s ease;
}

.avatar-image:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px var(--profile-shadow-hover);
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--profile-gradient-start), var(--profile-gradient-end));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 56px;
    font-weight: 700;
    color: white;
    border: 4px solid var(--profile-border);
    box-shadow: 0 4px 16px var(--profile-shadow);
    transition: all 0.3s ease;
}

.avatar-placeholder:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px var(--profile-shadow-hover);
}

.profile-name {
    font-size: 24px;
    font-weight: 700;
    color: var(--profile-text-primary);
    margin: 16px 0 8px 0;
}

.profile-nickname {
    font-size: 16px;
    color: var(--profile-text-secondary);
    margin-bottom: 20px;
}

.btn-upload-avatar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--profile-accent);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    justify-content: center;
}

.btn-upload-avatar:hover {
    background: var(--profile-accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--profile-shadow-hover);
}

/* Контейнер кнопок аватарки */
.avatar-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

/* Кнопка удаления аватарки */
.btn-delete-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--profile-danger);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.btn-delete-avatar:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* ==============================================
   ИНФОРМАЦИЯ
   ============================================== */
.info-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.info-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    color: var(--profile-text-secondary);
}

.info-value {
    font-size: 15px;
    color: var(--profile-text-primary);
    font-weight: 500;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.text-muted {
    color: var(--profile-text-muted);
    font-style: italic;
}

/* ==============================================
   БЕЙДЖИ
   ============================================== */
.role-badge {
    display: inline-block;
    padding: 6px 12px;
    background: var(--profile-accent);
    color: white;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
}

.badge-level {
    display: inline-block;
    padding: 4px 10px;
    background: var(--profile-success);
    color: white;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
}

/* ==============================================
   СТАТИСТИКА
   ============================================== */
.stats-section {
    margin-bottom: 24px;
}

.stats-section:last-child {
    margin-bottom: 0;
}

.stats-header {
    font-size: 14px;
    font-weight: 600;
    color: var(--profile-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}

.stats-grid-compact {
    grid-template-columns: repeat(3, 1fr);
}

.stat-card {
    background: var(--profile-hover);
    border: 1px solid var(--profile-border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.2s ease;
}

.stat-card:hover {
    border-color: var(--profile-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--profile-shadow);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--profile-accent);
    margin-bottom: 8px;
    line-height: 1;
}

.stat-value-small {
    font-size: 24px;
}

.stat-label {
    font-size: 12px;
    color: var(--profile-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.stat-card-dual {
    padding: 16px;
}

.stat-dual-row {
    display: flex;
    justify-content: space-around;
    gap: 16px;
}

.stat-dual-item {
    flex: 1;
}

/* ==============================================
   ДИСЦИПЛИНАРНЫЕ ВЗЫСКАНИЯ
   ============================================== */
.no-data {
    text-align: center;
    padding: 48px 24px;
    color: var(--profile-text-secondary);
}

.no-data svg {
    color: var(--profile-success);
    margin-bottom: 16px;
}

.no-data p {
    font-size: 16px;
    margin: 0;
}

.disciplinary-group {
    margin-bottom: 24px;
}

.disciplinary-group:last-child {
    margin-bottom: 0;
}

.disciplinary-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--profile-border);
}

.disciplinary-group-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--profile-text-primary);
}

.disciplinary-count {
    background: var(--profile-hover);
    color: var(--profile-text-primary);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.disciplinary-item {
    background: var(--profile-hover);
    border: 1px solid var(--profile-border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
    transition: all 0.2s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.disciplinary-item:last-child {
    margin-bottom: 0;
}

.disciplinary-item:hover {
    box-shadow: 0 2px 8px var(--profile-shadow);
}

.disciplinary-active {
    border-left: 4px solid var(--profile-danger);
    background: var(--profile-danger-bg);
}

.disciplinary-removed {
    opacity: 0.7;
}

/* Заголовок взыскания */
.disciplinary-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* Бейджи типа */
.disciplinary-badge {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.disciplinary-badge-warning {
    background: var(--profile-danger);
    color: white;
}

.disciplinary-badge-verbal_warning {
    background: var(--profile-warning);
    color: white;
}

/* Статусный бейдж */
.disciplinary-status-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    background: var(--profile-success-bg);
    color: var(--profile-success);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Дата */
.disciplinary-date {
    font-size: 13px;
    color: var(--profile-text-secondary);
    margin-left: auto;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Тело карточки */
.disciplinary-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Поля информации */
.disciplinary-field {
    font-size: 14px;
}

.disciplinary-field strong {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--profile-text-secondary);
    font-weight: 600;
}

.disciplinary-field p {
    margin: 0;
    color: var(--profile-text-primary);
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

/* Метаинформация внизу */
.disciplinary-meta {
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: var(--profile-text-secondary);
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid var(--profile-border);
}

/* ==============================================
   КНОПКИ
   ============================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn svg {
    flex-shrink: 0;
}

.btn-primary {
    background: var(--profile-accent);
    color: white;
}

.btn-primary:hover {
    background: var(--profile-accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--profile-shadow-hover);
}

.btn-secondary {
    background: var(--profile-hover);
    color: var(--profile-text-primary);
    border: 1px solid var(--profile-border);
}

.btn-secondary:hover {
    background: var(--profile-border);
}

.btn-danger {
    background: var(--profile-danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* ==============================================
   АЛЕРТЫ
   ============================================== */
.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 500;
}

.alert svg {
    flex-shrink: 0;
}

.alert-success {
    background: var(--profile-success-bg);
    color: var(--profile-success);
    border: 1px solid var(--profile-success);
}

.alert-error {
    background: var(--profile-danger-bg);
    color: var(--profile-danger);
    border: 1px solid var(--profile-danger);
}

/* ==============================================
   МОДАЛЬНОЕ ОКНО
   ============================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--profile-modal-overlay);
    backdrop-filter: blur(4px);
}

.modal-container {
    position: relative;
    background: var(--profile-card-bg);
    border-radius: 20px;
    box-shadow: 0 20px 60px var(--profile-shadow-hover);
    max-width: 500px;
    width: 100%;
    animation: modalSlideIn 0.3s ease;
    overflow: hidden;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px) scale(0.9);
        opacity: 0;
    }

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    border-bottom: 1px solid var(--profile-border);
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--profile-text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--profile-text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-body {
    padding: 28px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 20px 28px;
    border-top: 1px solid var(--profile-border);
    background: var(--profile-hover);
}

/* ==============================================
   ОБЛАСТЬ ЗАГРУЗКИ
   ============================================== */
.upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    border: 2px dashed var(--profile-border);
    border-radius: 16px;
    background: var(--profile-hover);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--profile-accent);
    background: var(--profile-card-bg);
}

.upload-area svg {
    color: var(--profile-text-secondary);
    margin-bottom: 16px;
}

.upload-area p {
    font-size: 16px;
    font-weight: 600;
    color: var(--profile-text-primary);
    margin: 0 0 8px 0;
}

.upload-area small {
    font-size: 13px;
    color: var(--profile-text-secondary);
}

.upload-area input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

#previewArea {
    text-align: center;
}

#previewImage {
    max-width: 100%;
    max-height: 300px;
    border-radius: 16px;
    box-shadow: 0 4px 16px var(--profile-shadow);
}

.upload-error {
    padding: 12px 16px;
    background: var(--profile-danger-bg);
    color: var(--profile-danger);
    border: 1px solid var(--profile-danger);
    border-radius: 10px;
    margin-top: 16px;
    font-size: 14px;
}

/* ==============================================
   ОШИБКА ПРОФИЛЯ
   ============================================== */
.profile-error {
    text-align: center;
    padding: 80px 24px;
    max-width: 500px;
    margin: 0 auto;
}

.profile-error svg {
    color: var(--profile-danger);
    margin-bottom: 24px;
}

.profile-error h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--profile-text-primary);
    margin: 0 0 12px 0;
}

.profile-error p {
    font-size: 16px;
    color: var(--profile-text-secondary);
    margin: 0 0 24px 0;
}

/* ==============================================
   СТИЛИ ДЛЯ БОКОВОГО МЕНЮ
   ============================================== */
.profile-divider {
    margin: 16px 0;
    border: none;
    border-top: 1px solid var(--profile-border);
}

.profile-section {
    margin-top: 16px;
}

.profile-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--profile-hover);
    border: 2px solid var(--profile-border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--profile-text-primary);
    font-weight: 600;
    transition: all 0.2s ease;
}

.profile-link:hover {
    background: var(--profile-accent);
    color: white;
    border-color: var(--profile-accent);
    transform: translateX(4px);
}

.profile-link.active {
    background: var(--profile-accent);
    color: white;
    border-color: var(--profile-accent);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.profile-icon {
    font-size: 20px;
}

.profile-label {
    font-size: 15px;
}

/* ==============================================
   АДАПТИВНОСТЬ
   ============================================== */
@media (max-width: 1024px) {
    .profile-grid {
        grid-template-columns: 280px 1fr;
        gap: 20px;
    }

    .avatar-container {
        width: 140px;
        height: 140px;
    }

    .avatar-placeholder {
        font-size: 48px;
    }
}

@media (max-width: 768px) {
    .profile-page {
        padding: 16px;
    }

    .profile-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .profile-header-content h1 {
        font-size: 24px;
    }

    .profile-header-actions {
        width: 100%;
        flex-direction: column;
    }

    .profile-header-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .profile-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-grid-compact {
        grid-template-columns: 1fr;
    }

    .disciplinary-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .disciplinary-date {
        margin-left: 0;
        width: 100%;
    }

    .disciplinary-meta {
        flex-direction: column;
        gap: 8px;
    }

    .disciplinary-item {
        padding: 20px 16px;
    }
}

@media (max-width: 480px) {
    .profile-card {
        padding: 16px;
    }

    .avatar-container {
        width: 120px;
        height: 120px;
    }

    .avatar-placeholder {
        font-size: 40px;
    }

    .profile-name {
        font-size: 20px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-value {
        font-size: 28px;
    }

    .modal-container {
        max-width: 100%;
        border-radius: 16px;
    }
}

/* ==============================================
   СТИЛИ ДЛЯ ФОРМЫ ОПИСАНИЯ ВЕДУЩЕГО
   ============================================== */
.bio-content {
    padding: 16px;
    background: var(--profile-hover);
    border-radius: 8px;
    color: var(--profile-text-primary);
    line-height: 1.6;
    word-wrap: break-word;
    text-align: left;
}

.bio-textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--profile-border);
    border-radius: 8px;
    background: var(--profile-card-bg);
    color: var(--profile-text-primary);
    font-size: 14px;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    min-height: 120px;
    transition: border-color 0.2s;
}

.bio-textarea:focus {
    outline: none;
    border-color: var(--profile-accent);
}

.bio-textarea::placeholder {
    color: var(--profile-text-muted);
}

.bio-actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.btn-edit-bio {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--profile-border);
    border-radius: 6px;
    color: var(--profile-text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-edit-bio:hover {
    background: var(--profile-hover);
    border-color: var(--profile-accent);
    color: var(--profile-accent);
}

.btn-edit-bio svg {
    width: 14px;
    height: 14px;
}
