/* ============================================================
   Авито — вакансии и отклики
   Стили согласованы с requests.css / shifts.css / styles.css
   ============================================================ */

.container { max-width: none; width: 100%; }

/* ========== СТАТ-КАРТОЧКИ ========== */
.avito-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 28px 0;
    flex-shrink: 0;
}
.avito-stats .widget-card {
    background: var(--surface);
    border-radius: 14px;
    padding: 14px 18px;
    box-shadow: 0 2px 12px rgba(15,23,42,0.06);
    border: 1px solid var(--border);
    min-width: 150px;
    flex: 1 1 150px;
    max-width: 240px;
    transition: transform 0.15s, box-shadow 0.15s;
}
.avito-stats .widget-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(15,23,42,0.10);
}
.avito-stats .widget-title {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.avito-stats .widget-title i { font-size: 12px; }
.avito-stats .widget-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.15;
}
.avito-stats .widget-value.primary { color: var(--accent); }

/* ========== ТАБЛИЦА ========== */
.table-wrapper {
    margin: 14px 28px 20px 28px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.table-container {
    flex: 1;
    overflow: auto;
    border-radius: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 4px 16px rgba(0,0,0,0.05);
}
.table-container::-webkit-scrollbar { width: 8px; height: 8px; }
.table-container::-webkit-scrollbar-track { background: var(--surface-2); margin-top: 46px; }
.table-container::-webkit-scrollbar-thumb { background: var(--text-faint); border-radius: 4px; }

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
    min-width: 1000px;
}
th {
    position: sticky;
    top: 0;
    background: var(--primary);
    color: #ffffff;
    font-weight: 600;
    padding: 12px 10px;
    border-bottom: 2px solid rgba(255,255,255,0.1);
    z-index: 10;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    text-align: center;
    vertical-align: middle;
    font-size: 0.78rem;
    letter-spacing: 0.3px;
    transition: background 0.2s;
}
th:hover { background: var(--primary-dark); }
th.sorted-asc::after {
    content: "\f0dd";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.75rem;
    margin-left: 6px;
}
th.sorted-desc::after {
    content: "\f0de";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.75rem;
    margin-left: 6px;
}
td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--surface-2);
    vertical-align: middle;
    white-space: nowrap;
    color: var(--text);
    font-size: 0.82rem;
    transition: background 0.15s;
}
tbody tr:nth-child(even) { background-color: var(--surface-2); }
tbody tr:nth-child(odd) { background-color: var(--surface); }
tbody tr:hover td { background: rgba(var(--accent-rgb),0.06) !important; }
tbody tr td:first-child { border-left: 3px solid transparent; }
tbody tr:hover td:first-child { border-left-color: var(--accent); }
tbody tr.av-row { cursor: pointer; }

.cell-strong { font-weight: 700; color: var(--text); }
.cell-muted { color: var(--text-muted); font-size: 0.78rem; }
.cell-clamp {
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    vertical-align: middle;
}
.av-link {
    color: #00aaff;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.av-link:hover { text-decoration: underline; }
.av-actions {
    display: flex;
    gap: 6px;
    justify-content: center;
}
.av-icon-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.av-icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.av-icon-btn.danger:hover { border-color: #dc2626; color: #dc2626; }
.av-icon-btn.primary:hover { border-color: #00aaff; color: #00aaff; }

.av-conv {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
}
.av-conv-bar {
    width: 46px;
    height: 6px;
    border-radius: 4px;
    background: var(--surface-2);
    overflow: hidden;
    display: inline-block;
}
.av-conv-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    border-radius: 4px;
}

/* ========== БЕЙДЖИ ========== */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    gap: 6px;
}
.status-active { background: rgba(34,197,94,0.14); color: #166534; }
.status-archived { background: var(--surface-2); color: var(--text-muted); }
.status-new { background: rgba(59,130,246,0.12); color: #1e40af; }
.status-contacted { background: rgba(217,119,6,0.14); color: #92400e; }
.status-interview { background: rgba(124,58,237,0.14); color: #5b21b6; }
.status-hired { background: rgba(34,197,94,0.16); color: #166534; }
.status-rejected { background: #fce4ec; color: #b71c1c; }

/* ========== ТАБЫ СТАТУСОВ ========== */
.status-tabs-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.status-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.status-tab {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.9);
    height: 32px;
    padding: 0 14px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}
.status-tab:hover { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.15); }
.status-tab.active {
    background: var(--surface);
    border-color: white;
    color: var(--accent);
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.status-tab .count {
    background: rgba(255,255,255,0.2);
    color: white;
    border-radius: 10px;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
    line-height: 14px;
}
.status-tab.active .count { background: var(--primary); color: white; }

/* ========== ВЫПАДАЮЩИЕ ФИЛЬТРЫ ========== */
.filter-group { position: relative; }
.filter-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 6px 0;
    margin-top: 4px;
}
.filter-dropdown.show,
.filter-dropdown.open { display: block; }
.filter-option {
    padding: 8px 14px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.1s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.filter-option:hover { background: var(--surface-2); color: var(--text); }
.filter-option.active { color: var(--accent); font-weight: 700; background: rgba(var(--accent-rgb),0.06); }

/* ========== ПУСТОЕ СОСТОЯНИЕ / ПАГИНАЦИЯ / ЛОАДЕР ========== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 0.9rem; margin: 4px 0; }

.table-loader {
    position: fixed;
    inset: 0;
    background: var(--surface);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    gap: 20px;
}
.table-loader .spinner {
    width: 70px;
    height: 70px;
    border: 6px solid var(--surface-2);
    border-top: 6px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
.table-loader span { font-size: 1.2rem; color: var(--text); font-weight: 600; letter-spacing: 0.5px; }

.pagination {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 300;
    display: flex;
    justify-content: flex-end;
}
.pagination-inner {
    display: flex;
    align-items: center;
    gap: 3px;
    background: var(--surface);
    padding: 5px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    font-size: 12px;
}
.pagination-inner button {
    padding: 4px 9px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.15s;
    color: var(--text-secondary);
    min-width: 28px;
    text-align: center;
    line-height: 1.3;
}
.pagination-inner button:hover { background: var(--surface-2); border-color: var(--border); }
.pagination-inner button.active { background: var(--primary); color: white; border-color: var(--accent); font-weight: 700; }
.pagination-inner button:disabled { opacity: 0.3; cursor: default; background: transparent; }
.pagination-inner .page-dots { color: var(--text-muted); font-size: 11px; letter-spacing: 1px; padding: 0 1px; }
.pagination-inner .page-info { font-size: 11px; color: var(--text-muted); font-weight: 500; margin: 0 2px; white-space: nowrap; }
.pagination-inner .page-size-select {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 4px;
    padding-left: 6px;
    border-left: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-muted);
}
.pagination-inner .page-size-select i { font-size: 10px; }
.pagination-inner .page-size-select select {
    padding: 2px 4px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 11px;
    background: var(--surface);
    cursor: pointer;
    color: var(--text);
    font-weight: 500;
}
.pagination-inner .page-size-select select:focus { outline: none; border-color: var(--accent); }

/* ========== МОДАЛКИ ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 5000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; }
#responseModal { z-index: 5200; }
#confirmModal { z-index: 5300; }
.modal-window {
    background: var(--surface-2);
    border-radius: 16px;
    max-width: 1100px;
    width: 96vw;
    max-height: 96vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 30px 100px rgba(0,0,0,0.4);
    overflow: hidden;
}
.modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    flex-shrink: 0;
}
.modal-header h3 { flex: 1; font-size: 0.92rem; font-weight: 700; margin: 0; letter-spacing: 0.3px; }
.modal-header button {
    background: rgba(255,255,255,0.12);
    border: none;
    color: rgba(255,255,255,0.85);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
    transition: all 0.2s;
}
.modal-header button:hover { background: rgba(255,255,255,0.25); color: white; }
.modal-content { padding: 16px 18px; overflow-y: auto; flex: 1; }
.modal-content::-webkit-scrollbar { width: 6px; }
.modal-content::-webkit-scrollbar-track { background: var(--surface-2); }
.modal-content::-webkit-scrollbar-thumb { background: var(--text-faint); border-radius: 3px; }

/* ========== ФОРМА ========== */
.av-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.av-form-item { display: flex; flex-direction: column; min-width: 0; }
.av-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.av-label i { font-size: 0.72rem; }
.av-form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
@media (max-width: 620px) {
    .av-form-grid { grid-template-columns: 1fr; }
}

/* ========== ПОЛЯ ВВОДА (совместимо с ms-input из shifts.css) ========== */
.ms-input {
    width: 100%;
    height: 36px;
    padding: 0 10px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.82rem;
    background: var(--surface-2);
    transition: all 0.2s;
    box-sizing: border-box;
    font-weight: 500;
    color: var(--text);
    font-family: inherit;
}
.ms-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(var(--accent-rgb),0.12);
    background: var(--surface);
}
.ms-input::placeholder { color: #b0bccd; }
textarea.ms-input { height: auto; padding: 8px 10px; line-height: 1.4; }
select.ms-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* ========== АНАЛИТИКА ========== */
.av-analytics-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(0,170,255,0.10), rgba(0,170,255,0.04));
    border: 1px solid rgba(0,170,255,0.2);
    margin-bottom: 16px;
}
.av-analytics-head .av-analytics-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: #00aaff;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.av-analytics-head h4 { margin: 0 0 3px; font-size: 1.05rem; color: var(--text); }
.av-analytics-head .av-analytics-sub { font-size: 0.78rem; color: var(--text-secondary); display: flex; gap: 10px; flex-wrap: wrap; }
.av-analytics-sub .status-badge { padding: 3px 10px; }
.av-date-edit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}
.av-date-edit .ms-input {
    height: 30px;
    font-size: 0.78rem;
}

.av-analytics-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.av-analytics-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    text-align: center;
}
.av-analytics-card .lbl { font-size: 11px; color: var(--text-muted); font-weight: 600; margin-bottom: 4px; }
.av-analytics-card .val { font-size: 22px; font-weight: 800; color: var(--text); }
.av-analytics-card .val.green { color: #16a34a; }
.av-analytics-card .val.blue { color: #0284c7; }
.av-analytics-card .val.orange { color: #d97706; }

.av-analytics-section-title {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 16px 0 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.av-chart-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    height: 240px;
    position: relative;
}
.av-source-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--surface-2);
}
.av-source-row:last-child { border-bottom: none; }
.av-source-row .name { flex: 1; font-size: 0.85rem; color: var(--text); font-weight: 600; }
.av-source-row .bar {
    flex: 2;
    height: 8px;
    border-radius: 5px;
    background: var(--surface-2);
    overflow: hidden;
}
.av-source-row .bar span { display: block; height: 100%; background: #00aaff; border-radius: 5px; }
.av-source-row .cnt { font-weight: 800; font-size: 0.85rem; min-width: 40px; text-align: right; }
.av-analytics-toolbar {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.av-analytics-toolbar .av-form-item { min-width: 150px; }

/* ========== ОТКЛИКИ В ДЕТАЛИ ВАКАНСИИ ========== */
.av-responses-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}
.av-results-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.av-detail-table-wrap {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: auto;
    max-height: 340px;
}
.av-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    min-width: 640px;
}
.av-detail-table th {
    position: sticky;
    top: 0;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    padding: 9px 12px;
    font-size: 0.74rem;
    text-align: left;
    white-space: nowrap;
    letter-spacing: 0.3px;
}
.av-detail-table td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--surface-2);
    vertical-align: middle;
    white-space: nowrap;
    color: var(--text);
}
.av-detail-table tbody tr:nth-child(even) { background-color: var(--surface-2); }
.av-detail-table tbody tr { cursor: pointer; }
.av-detail-table tbody tr:hover td { background: rgba(var(--accent-rgb),0.06); }

/* ========== УВЕДОМЛЕНИЕ ========== */
.av-chat-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(0,170,255,0.10), rgba(0,170,255,0.04));
    border: 1px solid rgba(0,170,255,0.25);
    margin-bottom: 14px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}
.av-chat-bar a {
    color: #0284c7;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.av-chat-bar a:hover { text-decoration: underline; }
.av-chat-bar .av-chat-phone-hint {
    margin-left: auto;
    font-size: 0.72rem;
    color: var(--text-muted);
}

#exportNotification {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: white;
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 9999;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
#exportNotification.show { opacity: 1; }
#exportNotification.error { background: #dc2626; }

@media (max-width: 900px) {
    .avito-stats { padding: 12px 14px 0; }
    .table-wrapper { margin: 12px 14px 20px 14px; }
    .avito-stats .widget-card { max-width: none; }
}