/* ===== DASHBOARD LAYOUT ===== */
.dashboard {
    padding: 2rem 0;
    background: var(--gray-50);
    /* Хедер компенсируется через body.has-fixed-header (см. main.css). */
    min-height: calc(100vh - var(--header-height, 80px));
}

@media (max-width: 767px) {
    .dashboard {
        padding-top: 1rem;
    }
    .sidebar {
        position: static;
        top: auto;
    }
}

.dashboard .container {
    display: flex;
    gap: 2rem;
    padding-top: 1rem;
    padding-bottom: 2rem;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 280px;
    flex-shrink: 0;
    background: white;
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    height: fit-content;
    position: sticky;
    top: 100px;
    border: 1px solid var(--gray-200);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.98);
}

.sidebar-header {
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
}

/* Резервируем место под имя/email, чтобы при их подгрузке сайдбар не «дёргался» */
.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 56px;
}

.user-details {
    min-width: 0;
    height: 44px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.user-details h3,
.user-details p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0;
}

.user-details h3 {
    line-height: 1.2;
}

.user-details p {
    line-height: 1.2;
    margin-top: 0.2rem;
}

.user-avatar {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    line-height: 1;
    background-size: cover;
    background-position: center;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-details h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--gray-900);
}

.user-details p {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    color: var(--gray-700);
    text-decoration: none;
    border-radius: var(--radius);
    transition: all var(--transition-fast);
    position: relative;
}

.nav-item:hover {
    background: var(--gray-100);
    color: var(--primary-600);
}

.nav-item.active {
    background: var(--primary-50);
    color: var(--primary-600);
    font-weight: 500;
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.nav-item .badge {
    margin-left: auto;
    background: var(--primary-600);
    color: white;
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 1rem;
    font-weight: 500;
}

.nav-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 1rem 0;
}

/* Кнопка выхода в сайдбаре — как пункт меню, но в цвет ошибки */
.nav-logout {
    background: none;
    border: none;
    font-family: inherit;
    font-size: inherit;
    width: 100%;
    cursor: pointer;
    color: #b91c1c;
    text-align: left;
}

.nav-logout:hover {
    background: rgba(239, 68, 68, 0.08);
    color: #991b1b;
}

.nav-logout i {
    width: 20px;
    text-align: center;
}

/* ===== DASHBOARD CONTENT ===== */
.dashboard-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: transparent;
}

/* Welcome Card */
.welcome-card {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    border-radius: var(--radius-xl);
    padding: 3rem;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.welcome-card[hidden] {
    display: none !important;
}

.welcome-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at top right,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 50%);
    pointer-events: none;
}



.welcome-content h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.welcome-content p {
    font-size: 1.125rem;
    opacity: 0.9;
    margin-bottom: 2rem;
    max-width: 500px;
}

.welcome-image {
    font-size: 6rem;
    opacity: 0.2;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: all var(--transition);
    border: 1px solid var(--gray-200);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-300);
}

.stat-icon {
    width: 56px;
    height: 56px;
    background: var(--primary-50);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-600);
    font-size: 1.5rem;
}

.stat-info h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-info p {
    font-size: 0.875rem;
    color: var(--gray-600);
}

/* Activity Section */
.activity-section {
    background: white;
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.98);
}

.activity-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--gray-900);
}

body.dashboard-page {
    background: var(--gray-50);
    background-image:
            radial-gradient(circle at 15% 50%, rgba(14, 165, 233, 0.05) 0%, transparent 25%),
            radial-gradient(circle at 85% 30%, rgba(124, 58, 237, 0.05) 0%, transparent 25%);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--gray-500);
    text-align: center;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .dashboard .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        position: static;
    }

    .welcome-card {
        flex-direction: column;
        text-align: center;
        padding: 2rem;
    }

    .welcome-image {
        display: none;
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .welcome-content h1 {
        font-size: 1.5rem;
    }

    .welcome-content p {
        font-size: 1rem;
    }
}

/* Activity Items */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 36px;
    height: 36px;
    background: var(--primary-50);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-600);
    font-size: 0.875rem;
}

.activity-content p {
    margin-bottom: 0.25rem;
    color: var(--gray-800);
}

.activity-content small {
    color: var(--gray-500);
    font-size: 0.75rem;
}

/* ===== SETTINGS ===== */
.settings-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.settings-card .panel-title {
    margin: 0 0 0.25rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
}

.avatar-edit {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.avatar-edit-preview {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-md);
}

.avatar-edit-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-edit-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
}

.avatar-upload-btn {
    cursor: pointer;
}

.avatar-edit-compact {
    gap: 1rem;
}

.avatar-edit-compact .avatar-edit-preview {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
    border-radius: 12px;
}

.avatar-edit-compact .avatar-edit-controls {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.settings-list {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.settings-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-row dt {
    color: var(--gray-500);
    font-weight: 500;
}

.settings-row dd {
    margin: 0;
    color: var(--gray-900);
    font-weight: 500;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-ghost:hover {
    background: var(--gray-100);
}

.btn-danger {
    background: #ef4444;
    color: white;
    border: none;
}

.btn-danger:hover {
    background: #dc2626;
}