/**
 * Стили личного кабинета Erudia.
 * Использует CSS-переменные из styles.css.
 */

/* Высота шапки как на главной: padding 20px 0 + высота контента */
.header {
    padding: 20px 0;
    min-height: 72px;
    box-sizing: border-box;
}
.header .nav {
    align-items: center;
    min-height: 32px;
}

/* Основной блок: фон как на главной — градиент + декоративный паттерн */
.cabinet-main {
    padding: 40px 0 80px;
    min-height: calc(100vh - 80px);
    position: relative;
    overflow: hidden;
}
.cabinet-main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='44' height='44' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 11h44M0 22h44M0 33h44' stroke='%234F46E5' stroke-opacity='0.08' stroke-width='1' fill='none'/%3E%3C/svg%3E");
    background-size: 44px 44px;
    mask-image: linear-gradient(180deg, transparent 0%, black 15%, black 85%, transparent 100%);
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, black 15%, black 85%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}
.cabinet-main::after {
    content: '';
    position: absolute;
    top: 10%;
    right: 5%;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}
.cabinet-main .container {
    position: relative;
    z-index: 1;
}

.cabinet-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    gap: 16px;
    color: var(--text-gray);
}

.cabinet-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: cabinet-spin 0.8s linear infinite;
}

@keyframes cabinet-spin {
    to { transform: rotate(360deg); }
}

.cabinet-guest {
    display: flex;
    justify-content: center;
    padding: 80px 20px;
}

.cabinet-guest-card {
    background: linear-gradient(165deg, #ffffff 0%, #fafbff 100%);
    border-radius: 20px;
    padding: 40px;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(79, 70, 229, 0.08);
    border: 1px solid rgba(79, 70, 229, 0.12);
}

.cabinet-guest-card h2 {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.cabinet-guest-card p {
    color: var(--text-gray);
    margin-bottom: 24px;
    line-height: 1.6;
}

.cabinet-title {
    font-family: var(--font-heading);
    font-size: 36px;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 40px;
    line-height: 1.2;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.7s cubic-bezier(0.32, 0.72, 0.2, 1), transform 0.7s cubic-bezier(0.32, 0.72, 0.2, 1);
}
.cabinet-content.cabinet-visible .cabinet-title {
    opacity: 1;
    transform: translateY(0);
}
.cabinet-title .accent {
    background: linear-gradient(135deg, #4F46E5 0%, #6366F1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.cabinet-section {
    margin-bottom: 48px;
}
.cabinet-section-anim {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s cubic-bezier(0.32, 0.72, 0.2, 1), transform 0.6s cubic-bezier(0.32, 0.72, 0.2, 1);
}
.cabinet-content.cabinet-visible .cabinet-section-anim {
    opacity: 1;
    transform: translateY(0);
}
.cabinet-content.cabinet-visible .cabinet-profile { transition-delay: 0.1s; }
.cabinet-content.cabinet-visible .cabinet-stats { transition-delay: 0.2s; }
.cabinet-content.cabinet-visible .cabinet-projects { transition-delay: 0.25s; }

.cabinet-section-title {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 20px;
}
.cabinet-section-title .accent {
    color: var(--primary-blue);
}

.cabinet-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.cabinet-section-header .cabinet-section-title {
    margin-bottom: 0;
}

/* Профиль — карточка в стиле step-card с градиентом и верхней полосой */
.cabinet-profile .profile-card {
    display: flex;
    align-items: center;
    gap: 28px;
    background: linear-gradient(165deg, #ffffff 0%, #fafbff 50%, #f8faff 100%);
    border-radius: 20px;
    padding: 32px 28px;
    border: 1px solid rgba(79, 70, 229, 0.12);
    box-shadow: 0 4px 20px rgba(79, 70, 229, 0.06);
    position: relative;
    overflow: hidden;
}
.cabinet-profile .profile-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--primary), #818CF8, transparent);
}
.profile-card .profile-avatar {
    margin-top: 4px;
}

.profile-avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: linear-gradient(145deg, #EEF2FF 0%, #E0E7FF 100%);
    color: var(--primary-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 34px;
    font-weight: 700;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    border: 2px solid rgba(79, 70, 229, 0.15);
}

.profile-avatar.has-image {
    color: transparent;
}

.profile-info {
    flex: 1;
    min-width: 0;
}

.profile-name {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.profile-email {
    font-size: 15px;
    color: var(--text-gray);
    margin-bottom: 4px;
}

.profile-meta {
    font-size: 13px;
    color: var(--text-gray);
    margin-bottom: 8px;
}

.profile-subscription {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    margin-bottom: 16px;
}

.btn-profile-logout {
    margin-top: 8px;
}

.sub-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: linear-gradient(145deg, #EEF2FF 0%, #E0E7FF 100%);
    color: var(--primary-blue);
    border: 1px solid rgba(79, 70, 229, 0.15);
}

.sub-badge.sub-free {
    background: var(--border-color);
    color: var(--text-gray);
}

/* Статистика — карточки как stat-card на главной */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.stats-card-item {
    background: linear-gradient(165deg, #ffffff 0%, #fafbff 50%, #f8faff 100%);
    border-radius: 20px;
    padding: 28px 20px;
    border: 1px solid rgba(79, 70, 229, 0.12);
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.stats-card-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(79, 70, 229, 0.4), #818CF8, transparent);
}
.stats-card-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(79, 70, 229, 0.1);
}

.stats-card-value {
    display: block;
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(135deg, #4F46E5 0%, #6366F1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.stats-card-label {
    font-size: 14px;
    color: var(--text-gray);
    font-weight: 500;
}

/* Проекты */
.projects-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.form-select-sm {
    padding: 10px 14px;
    font-size: 14px;
    max-width: 200px;
}

.projects-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.project-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: linear-gradient(165deg, #ffffff 0%, #fafbff 50%, #f8faff 100%);
    border-radius: 16px;
    padding: 22px 26px;
    border: 1px solid rgba(79, 70, 229, 0.12);
    transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s ease;
    position: relative;
    overflow: hidden;
}
.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(79, 70, 229, 0.35), transparent);
}
.project-card:hover {
    border-color: rgba(79, 70, 229, 0.25);
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.1);
    transform: translateY(-2px);
}

.project-card-main {
    flex: 1;
    min-width: 0;
}

.project-card-title {
    font-family: var(--font-heading);
    font-size: 17px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.project-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: var(--text-gray);
    margin-bottom: 8px;
}

.project-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
}

.project-status.status-done {
    background: rgba(34, 197, 94, 0.15);
    color: #15803d;
}

.project-status.status-fail {
    background: rgba(239, 68, 68, 0.15);
    color: #b91c1c;
}

.project-status.status-progress {
    background: var(--primary-light);
    color: var(--primary-blue);
}

.project-card-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.project-btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    font-family: inherit;
}

.project-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.project-btn-open {
    background: var(--primary-blue);
    color: var(--white);
}

.project-btn-open:hover {
    background: #4338ca;
}

.project-btn-download {
    background: transparent;
    color: var(--primary-blue);
    border: 2px solid var(--primary-blue);
}

.project-btn-download:hover {
    background: var(--primary-light);
}

.projects-empty {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-gray);
    background: linear-gradient(165deg, rgba(255,255,255,0.9) 0%, rgba(248,250,255,0.95) 100%);
    border-radius: 20px;
    border: 1px dashed rgba(79, 70, 229, 0.2);
}

.projects-empty a {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 600;
}

.projects-empty a:hover {
    text-decoration: underline;
}

.projects-error {
    color: #dc2626;
    padding: 24px;
}

.projects-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
}

.pagination-btn {
    padding: 10px 20px;
    border: 2px solid var(--border-color);
    background: var(--white);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.pagination-btn:hover {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

.pagination-info {
    font-size: 14px;
    color: var(--text-gray);
}

.btn-sm {
    padding: 10px 20px;
    font-size: 14px;
}

/* Без подчёркивания у кнопки «Создать новую» */
.btn-no-underline {
    text-decoration: none;
}
.btn-no-underline:hover {
    text-decoration: none;
}

.nav-active {
    color: var(--primary-blue) !important;
}

/* Логотип в шапке — без подчёркивания (cabinet.css только на странице кабинета) */
.header .logo {
    text-decoration: none;
}
.header .logo:hover {
    text-decoration: none;
}

@media (max-width: 768px) {
    .cabinet-title {
        font-size: 26px;
    }
    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    .cabinet-profile .profile-card {
        flex-direction: column;
        text-align: center;
    }
    .project-card {
        flex-direction: column;
        align-items: flex-start;
    }
    .project-card-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .stats-cards {
        grid-template-columns: 1fr;
    }
}
