/* =============================================
   VACANCY DETAIL PANEL — просмотр и редактирование вакансии (HR)
   Дизайн-система: #3F3FE6, #ECEEFF, #B7BEFF,
   Manrope, CenturyGothicBold, radius 15px
   ============================================= */

/* Панель поверх hr-vacancies-panel (z-index: 100) */
.vd-panel {
    display: flex;
    flex-direction: column;
    z-index: 101;
}

/* ---- Header ---- */

.vd-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 32px 16px;
    flex-shrink: 0;
}

.vd-back {
    width: 45px;
    height: 27px;
    border: 2.5px solid #ECEEFF;
    background: #FFFFFF;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3F3FE6;
    transition: border-color 0.2s, background 0.2s;
    flex-shrink: 0;
    margin-top: 4px;
    padding: 0;
}

.vd-back:hover {
    border-color: #B7BEFF;
    background: #F8F9FC;
}

.vd-title-wrap {
    flex: 1;
    min-width: 0;
}

.vd-title {
    font-family: 'CenturyGothicBold', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #000;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- Body (scrollable) ---- */

.vd-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.vd-body::-webkit-scrollbar { width: 6px; }
.vd-body::-webkit-scrollbar-track { background: #ECEEFF; border-radius: 10px; margin: 8px 0; }
.vd-body::-webkit-scrollbar-thumb { background: #B8B9F7; border-radius: 10px; }

/* ---- Info fields (каждое поле — отдельная карточка) ---- */

.vd-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.vd-field {
    background: #FFFFFF;
    border: 2px solid #ECEEFF;
    border-radius: 15px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    transition: border-color 0.2s;
}

.vd-field:hover {
    border-color: #B7BEFF;
}

.vd-field-label {
    font-family: 'Manrope', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #8E8E93;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.vd-field-value {
    font-family: 'Manrope', sans-serif;
    font-size: 15px;
    font-weight: 500;
    color: #2D2D2D;
    min-height: 22px;
}

.vd-field-value.vd-empty {
    opacity: 0.35;
}

/* Salary — full width */
.vd-field.vd-field-salary {
    grid-column: 1 / -1;
}

/* ---- Section card ---- */

.vd-section {
    background: #FFFFFF;
    border: 2px solid #ECEEFF;
    border-radius: 15px;
    padding: 16px 24px;
}

.vd-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #ECEEFF;
}

.vd-section-title {
    font-family: 'CenturyGothicBold', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #2D2D2D;
    margin: 0;
}

.vd-section-edit-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #B7BEFF;
    padding: 2px;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.vd-section-edit-btn:hover {
    color: #3F3FE6;
}

.vd-section-text {
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    color: #444;
    line-height: 1.6;
    margin: 0;
    white-space: pre-line;
}

.vd-section-text.vd-empty {
    opacity: 0.35;
}

/* ---- Skills (tags) ---- */

.vd-skills-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.vd-skill-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 10px;
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    font-weight: 500;
    background: #B7BEFF;
    color: #FFFFFF;
}

.vd-skill-tag .vd-skill-remove {
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    opacity: 0.7;
    margin-left: 2px;
}

.vd-skill-tag .vd-skill-remove:hover {
    opacity: 1;
}

.vd-skill-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 10px;
    border: 2px dashed #B7BEFF;
    background: none;
    color: #3F3FE6;
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.vd-skill-add-btn:hover {
    background: #F8F9FC;
}

/* ---- Edit mode ---- */

.vd-editing {
    border-color: #B7BEFF;
}

.vd-edit-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.vd-edit-wrap .vd-edit-input,
.vd-edit-wrap .vd-edit-select {
    flex: 1;
}

.vd-edit-input {
    width: 100%;
    padding: 6px 10px;
    border: 2px solid #ECEEFF;
    border-radius: 8px;
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    color: #2D2D2D;
    background: #FFFFFF;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.vd-edit-input:focus {
    outline: none;
    border-color: #B7BEFF;
    box-shadow: 0 0 0 3px rgba(63, 63, 230, 0.08);
}

.vd-edit-textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px 14px;
    border: 2px solid #ECEEFF;
    border-radius: 10px;
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    color: #2D2D2D;
    line-height: 1.5;
    resize: vertical;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.vd-edit-textarea:focus {
    outline: none;
    border-color: #B7BEFF;
    box-shadow: 0 0 0 3px rgba(63, 63, 230, 0.08);
}

.vd-edit-select {
    width: 100%;
    padding: 6px 10px;
    border: 2px solid #ECEEFF;
    border-radius: 8px;
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    color: #2D2D2D;
    background: #FFFFFF;
    cursor: pointer;
}

/* ---- Footer ---- */

.vd-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 32px 16px;
    flex-shrink: 0;
    border-top: 2px solid #ECEEFF;
}

.vd-cancel-btn {
    padding: 8px 24px;
    background: #FFFFFF;
    color: #3F3FE6;
    border: 2px solid #ECEEFF;
    border-radius: 10px;
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.vd-cancel-btn:hover {
    background: #F8F9FC;
    border-color: #B7BEFF;
}

.vd-save-btn {
    padding: 8px 28px;
    background: #3F3FE6;
    color: #FFFFFF;
    border: none;
    border-radius: 10px;
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
}

.vd-save-btn:hover {
    background: #3333C0;
    box-shadow: 0 4px 12px rgba(63, 63, 230, 0.25);
}

.vd-save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ---- Edit actions (✓ / ✕) ---- */

.vd-edit-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    justify-content: flex-end;
}

.vd-edit-accept,
.vd-edit-reject {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    transition: background 0.15s;
}

.vd-edit-accept {
    background: #E8F5E9;
    color: #2E7D32;
}

.vd-edit-accept:hover {
    background: #C8E6C9;
}

.vd-edit-reject {
    background: #FFEBEE;
    color: #C62828;
}

.vd-edit-reject:hover {
    background: #FFCDD2;
}

/* ---- Field row with pencil ---- */

.vd-field-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.vd-field-row .vd-field-value {
    flex: 1;
}

.vd-field-pencil {
    background: none;
    border: none;
    cursor: pointer;
    color: #B7BEFF;
    padding: 2px;
    display: flex;
    align-items: center;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}

.vd-field:hover .vd-field-pencil {
    opacity: 1;
}

.vd-field-pencil:hover {
    color: #3F3FE6;
}

/* ---- Spinner (LLM loading) ---- */

.vd-edit-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2.5px solid #ECEEFF;
    border-top-color: #3F3FE6;
    border-radius: 50%;
    animation: vd-spin 0.6s linear infinite;
}

@keyframes vd-spin {
    to { transform: rotate(360deg); }
}

/* ---- Readonly mode (для кандидатов, просмотр чужой вакансии) ---- */

.vd-readonly .vd-field-pencil,
.vd-readonly .vd-section-edit-btn,
.vd-readonly .vd-skill-add-btn,
.vd-readonly .vd-skill-remove {
    display: none !important;
}

.vd-readonly .vd-field-value,
.vd-readonly .vd-section-text {
    pointer-events: none;
}

/* ---- Save flash ---- */

.vd-field.save-success .vd-field-value {
    animation: vd-flash-green 0.8s ease;
}

@keyframes vd-flash-green {
    0% { background: #E8F5E9; }
    100% { background: transparent; }
}

/* Mobile */
@media (max-width: 768px) {
    .vd-panel {
        left: 0;
        right: 0;
    }
    .vd-grid-2col {
        grid-template-columns: 1fr;
    }
    .vd-content {
        padding: 16px;
    }
}
