/*  ОСТРОВНОЙ-КОНТЕНТ (MAIN CONTENT)*/
.content-area {
    padding: 25px;
    flex: 1;
}

.content-section {
    display: none;
}

/* Все секции скрыты по умолчанию */
.content-section.active {
    display: block;
}

/* ГЛАВНАЯ СЕТКА (MAIN GRID LAYOUT */
.main-content-grid {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-areas: "sidebar right-column";
    gap: 12px ;
    max-width: var(--max-width);
    width: 100%;
    margin: 12px auto 0 auto;
    padding: 0 3px;
    flex: 1;
}

.right-column-wrapper {
    grid-area: right-column;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* САЙДБАР-ОСТРОВ (NAVIGATION)*/
.nav-link {
    text-decoration: none;
    color: var(--text-gray);
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-link:hover:not(.active) {
    background: var(--bg-page);
    color: var(--primary);
}

.nav-link.active {
    background: var(--primary);
    color: white;
}

.nav-icon-img {
    width: 12px;
    height: 12px;
    margin-right: 5px;
    vertical-align: baseline;
}

.nav-link:hover .nav-icon-img {
    filter: brightness(1.2);
    transform: scale(1.1)
}

.nav-link.active .nav-icon-img {
    filter: grayscale(1) invert(1) brightness(2);
}

@media (max-width: 992px) {
    .nav-link {
        white-space: nowrap;
    }
}

/* ====================== PROFILE HERO ====================== */
.profile-hero {
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    height: 250px;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.profile-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='30' cy='30' r='2' fill='white' fill-opacity='0.1'/%3E%3C/svg%3E");
    pointer-events: none;
}

.hero-content-horizontal {
    display: flex;
    align-items: center;
    gap: 25px;
    padding: 0 60px;
    z-index: 2;
    width: 100%;
}

/* По умолчанию скрываем шапку на всех вкладках */
.profile-hero {
    display: none !important;
}

/* Показываем её, если секция профиля НЕ скрыта (у неё нет display: none) */
.main-content-grid:has(#candidate-profile-section:not([style*="display: none"]):not([style*="display:none"])) .profile-hero,
.main-content-grid:has(#candidate-profile-section.active) .profile-hero {
    display: flex !important;
}

/* ПОКАЗЫВАЕМ ШАПКУ, ЕСЛИ АКТИВНЫ СЛЕДУЮЩИЕ СЕКЦИИ: */

/* 1. Секция профиля кандидата */
.main-content-grid:has(#candidate-profile-section:not([style*="display: none"]):not([style*="display:none"])) .profile-hero,
.main-content-grid:has(#candidate-profile-section.active) .profile-hero,

    /* 2. Секция "Мои публикации" работодателя (НОВОЕ УСЛОВИЕ) */
.main-content-grid:has(#my-publications-section:not([style*="display: none"]):not([style*="display:none"])) .profile-hero,
.main-content-grid:has(#my-publications-section.active) .profile-hero {
    display: flex !important;
}

/* --- АВАТАР --- */
.avatar-container-hero {
    width: 130px;
    height: 130px;
    border-radius: 24px;
    border: 3px solid rgba(255, 255, 255, 0.25);
    background: #ffffff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.avatar-text-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--primary);
    font-weight: 700;
    font-size: 3rem;
    letter-spacing: -1px;
    user-select: none;
    line-height: 1;
    z-index: 1;
}

/* Оверлей при наведении (Камера) */
.avatar-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 2;
}

.camera-icon {
    width: 28px;
    height: 28px;
    filter: brightness(0) invert(1);
    transform: translateY(15px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.avatar-container-hero:hover .avatar-overlay {
    opacity: 1;
}

.avatar-container-hero:hover .camera-icon {
    transform: translateY(0);
}

.avatar-container-hero.is-uploading .avatar-overlay {
    opacity: 1;
    background: rgba(0, 0, 0, 0.6);
}

.avatar-container-hero.is-uploading .camera-icon {
    animation: cameraPulse 1.5s infinite ease-in-out;
}

@keyframes cameraPulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.15);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0.8;
    }
}

/* Изображение аватара */
.avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* CROPPER MODAL (Интерфейс обрезки) */
.cropper-overlay {
    position: fixed;
    inset: 0;
    background: #000000;
    z-index: 10000;
    display: flex;
    flex-direction: column;
}

.cropper-container-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.cropper-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #111111;
    color: white;
    border-bottom: 1px solid #222;
}

.cropper-cancel,
.cropper-confirm {
    background: none;
    border: none;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.2s;
}

.cropper-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
}

.cropper-confirm:hover {
    background: rgba(59, 130, 246, 0.1);
}

.cropper-title {
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}

.cropper-confirm {
    color: #3B82F6;
    font-weight: 700;
}

.cropper-body {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #000;
}

/* Область обрезки (настройки библиотеки) */
.cropper-view-box,
.cropper-face {
    border-radius: 14px;
    outline: none !important;
}

.cropper-footer {
    flex-shrink: 0;
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 0.85rem;
    background: #111111;
    border-top: 1px solid #222;
}

/*  ИНФО-КОЛОНКА (Имя, Позиция, Статус) */
.info-column {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    min-width: 0;
}

.name-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 4px;
}

.user-name {
    font-size: 1.6rem;
    font-weight: 650;
    color: white;
    margin: 0;
}

.user-position {
    font-size: 1.11rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 18px;
    font-weight: 500;
}

.status-pulsing-dot {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    z-index: 20;
    border: 2px solid #fff;
    transition: background-color 0.4s ease, box-shadow 0.4s ease;
}

/* Состояние: В активном поиске */
.status-pulsing-dot.open-to-work {
    background-color: #10B981;
}

/* Состояние: Не ищу работу */
.status-pulsing-dot.not-looking {
    background-color: #94a3b8;
}

/* САЙДБАР-ОСТРОВ (NAVIGATION)*/
.sidebar {
    grid-area: sidebar;
    padding: 30px 15px;
    align-self: start;
    position: sticky;
    top: 82px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* (ИНЛАЙН-РЕДАКТИРОВАНИЕ) */
.editable-card.island-inner {
    padding: 1.5rem;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #f1f5f9;
    transition: all 0.25s ease;
    cursor: pointer;
    position: relative;
    margin-bottom: 24px;
}

.editable-card.island-inner:hover {
    background: #f8faff;
    border-color: var(--primary, #4f46e5);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.block-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    font-weight: 700;
}

.edit-hint {
    font-size: 0.75rem;
    color: var(--primary);
    opacity: 0;
    transition: opacity 0.2s;
}

.editable-card.island-inner:hover .edit-hint {
    opacity: 1;
    transform: translateX(0);
}

.inline-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Кнопки управления */
.edit-actions-inline {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 10px;
    padding-top: 20px;
    border-top: 1px solid #f1f5f9;
}

.btn-save,
.btn-cancel {
    padding: 6px 16px;
    border-radius: 10px;
    font-weight: 550;
    font-size: 0.9rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

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

.btn-save:hover {
    border: 1px solid rgba(37, 99, 235, 0.08);
    box-shadow: 0 0 3px 1px var(--primary, #2563eb);
}

.btn-cancel {
    background: #f1f5f9;
    color: #64748b;
}

.btn-cancel:hover {
    background: #e2e8f0;
    color: #1e293b;
    border: 1px solid rgba(148, 163, 184, 0.12);
    box-shadow: 0 0 4px 1px rgba(148, 163, 184, 0.3);
}

/* Активное нажатие */
.btn-save:active,
.btn-cancel:active {
    transform: scale(0.96);
}

.btn-delete {
    background: none;
    border: none;
    padding: 0;
    margin-right: auto;
    color: #94a3b8;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;

    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-delete:hover {
    color: #ef4444;
}

.btn-delete::before {
    content: '✕';
    font-size: 0.9rem;
}

/* Кнопка (+Добавить)*/
.btn-add-inline {
    border: none;
    background: none;
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-add-inline:hover {
    background: rgba(var(--primary), 0.1);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 400;
    color: #94a3b8;
}

/* Поля ввода (Inputs, Selects, Textareas) */
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #e2e8f0;
    font-size: 0.85rem;
    border-radius: 12px;
    font-family: inherit;
    color: #1e293b;
    background-color: #ffffff;
    outline: none;
    cursor: pointer;
    box-shadow: 0 0 8px 3px rgba(59, 130, 246, 0),
    0 4px 20px rgba(59, 130, 246, 0);
    transition: border-color 0.45s cubic-bezier(0.25, 0.8, 0.25, 1),
    box-shadow 0.45s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Для браузера Safari */
.form-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Стилизация текстовых областей (Textarea) */
.form-textarea {
    font-size: 0.90rem;
    min-height: 250px;
    width: 100%;
    resize: vertical;
    line-height: 1.6;
    margin-bottom: 8px;
    overflow-y: auto;
    font-weight: 400;
}

.form-textarea::placeholder,
.form-input::placeholder {
    font-size: 0.85rem;
    color: #94a3b8;
    font-weight: 400;
    opacity: 0.8;
}

.form-textarea:focus::placeholder {
    opacity: 0.4;
    transition: opacity 0.2s ease;
}

/* Состояния фокуса */
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: rgba(59, 130, 246, 0.5);
    background-color: #ffffff;
    box-shadow: 0 0 8px 2px rgba(59, 130, 246, 0.3),
    0 4px 15px rgba(59, 130, 246, 0.1);
}

/* Группа зарплаты: Инпут + Валюта */
.salary-inline-group {
    display: grid;
    grid-template-columns: 1fr 85px;
    gap: 10px;
}

.char-counter {
    text-align: right;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 4px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--primary-light);
}

.search-filter-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

/* Контейнер строки поиска */
.search-bar-container {
    position: relative;
    margin-bottom: 19px;
    flex: 1;
}

.search-bar-container .form-input {
    width: 100%;
    padding: 0 16px 0 45px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    background-color: #ffffff;
    outline: none;
    height: 40px;
    line-height: 44px;
    box-sizing: border-box;
}

.search-bar-container .form-input:focus {
    border-color: #3b82f6;
}

/* Иконка лупы внутри контейнера */
.search-bar-container::before {
    content: "";
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background-color: #94a3b8;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'%3E%3C/path%3E%3C/svg%3E") no-repeat center;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'%3E%3C/path%3E%3C/svg%3E") no-repeat center;
    z-index: 1;
    pointer-events: none;
}

/* Изменяем цвет иконки при фокусе на инпуте */
.search-bar-container:focus-within::before {
    background-color: #3b82f6;
}


/* ====================== АДАПТИВНОСТЬ ====================== */
@media (max-width: 992px) {
    .main-content-grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "sidebar"
            "right-column";
        gap: 8px;
        margin-top: 0;
        padding: 0 8px;
        box-sizing: border-box;
    }

    .sidebar {
        position: static;
        padding: 12px 8px;
        width: 100%;
        box-sizing: border-box;
    }

    .sidebar-nav {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 8px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-nav::-webkit-scrollbar {
        display: none;
    }

    .nav-link {
        white-space: nowrap;
        padding: 10px 14px;
        font-size: 14px;
    }

    .hero-content-horizontal {
        padding: 0 20px;
        gap: 20px;
        box-sizing: border-box;
        width: 100%;
        min-width: 0;
    }

    .profile-hero {
        height: auto;
        padding: 30px 0;
        box-sizing: border-box;
    }

    .content-area {
        padding: 16px;
        box-sizing: border-box;
        width: 100%;
        min-width: 0;
    }

    .right-column-wrapper {

        display: flex;
        flex-direction: column;
        flex: 1;
    }
}

@media (max-width: 680px) {
    .profile-hero {
        padding: 24px 12px;
        box-sizing: border-box;
    }

    .hero-content-horizontal {
        flex-direction: column;
        text-align: center;
        padding: 0;
        gap: 12px;
        width: 100%;
    }

    .avatar-container-hero {
        width: 110px;
        height: 110px;
        max-width: 100%;
        border-radius: 20px;
        flex-shrink: 0;
    }

    .avatar-text-placeholder {
        font-size: 2rem;
    }

    .info-column {
        align-items: center;
        width: 100%;
        min-width: 0;
    }

    .name-row {
        justify-content: center;
        flex-direction: column;
        gap: 6px;
        width: 100%;
    }

    .user-name {
        font-size: 1.25rem;
        line-height: 1.3;
        word-break: break-word;
        text-align: center;
    }

    .user-position {
        font-size: 0.95rem;
        margin-bottom: 0;
        text-align: center;
    }

    .editable-card.island-inner {
        padding: 12px;
        margin-bottom: 12px;
        box-sizing: border-box;
        width: 100%;
    }

    .form-row,
    .salary-inline-group {
        grid-template-columns: 1fr;
        gap: 12px;
        width: 100%;
    }

    .form-group {
        width: 100%;
        box-sizing: border-box;
    }

    .form-input,
    .form-select,
    .form-textarea {
        width: 100%;
        max-width: 100%;
        padding: 10px 12px;
        font-size: 14px;
        box-sizing: border-box;
    }

    .edit-actions-inline {
        flex-direction: column-reverse;
        gap: 8px;
        padding-top: 12px;
        width: 100%;
    }

    .btn-save,
    .btn-cancel {
        width: 100%;
        padding: 12px;
        text-align: center;
        font-size: 14px;
        box-sizing: border-box;
        margin: 0;
    }

    .btn-delete {
        margin: 0;
        justify-content: center;
        padding: 8px 0;
        width: 100%;
    }

    .search-filter-row {
        display: block;
    }

    .cropper-header {
        padding: 10px 14px;
    }
    .cropper-title {
        font-size: 0.95rem;
    }
}