/* ===================================================================
   ЯНДЕКС СТИЛИ - Единый файл стилей для всех шаблонов
   Источник: cabinet.html
   =================================================================== */

/* ===================================================================
   1. ШРИФТЫ
   =================================================================== */
@font-face {
    font-family: "YS Text";
    font-weight: 400;
    font-style: normal;
    src: url("/static/fonts/text-regular-DQhldXLT.woff2") format("woff2");
    font-display: swap;
}

@font-face {
    font-family: "YS Text";
    font-weight: 500;
    font-style: normal;
    src: url("/static/fonts/text-medium-DT-vLnUa.woff2") format("woff2");
    font-display: swap;
}

/* ===================================================================
   2. ПЕРЕМЕННЫЕ ЯНДЕКСА
   =================================================================== */
:root {
    --bg-body: rgb(245, 244, 242);
    --bg-white: rgb(255, 255, 255);
    --bg-hover: rgba(0, 0, 0, 0.05);
    --bg-gray-btn: rgba(92, 90, 87, 0.1);

    --text-main: rgb(33, 32, 31);
    --text-muted: rgb(158, 155, 152);
    --text-red: rgb(255, 0, 0);

    --border-light: rgba(138, 135, 132, 0.2);
    --border-dark: rgba(33, 32, 31, 0.5);

    --color-yellow: rgb(252, 224, 0);
    --status-green: rgb(0, 202, 80);
    --status-yellow: rgb(255, 215, 0);
    --status-gray: rgb(128, 128, 128);

    --shadow-card: 0px 8px 20px 0px rgba(0, 0, 0, 0.12);
}

/* ===================================================================
   3. БАЗОВЫЕ СТИЛИ
   =================================================================== */
body {
    margin: 0;
    padding: 0;
    font-family: "YS Text", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

* {
    box-sizing: border-box;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: transparent;
    color: inherit;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ===================================================================
   4. БОКОВОЕ МЕНЮ (SIDEBAR)
   =================================================================== */
.sidebar {
    width: 64px;
    height: 100vh;
    background-color: var(--bg-body);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    flex-shrink: 0;
    z-index: 100;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    align-items: center;
}

.nav-list.bottom {
    margin-top: auto;
}

.nav-item {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 13px;
    color: var(--text-muted);
    text-decoration: none;
    position: relative;
    transition: background 0.2s;
}

.nav-item:hover, .nav-item.active {
    background-color: var(--bg-hover);
    color: var(--text-main);
}

.nav-item img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: rgb(252, 82, 48);
    color: white;
    font-size: 11px;
    font-weight: 500;
    height: 19px;
    min-width: 19px;
    border-radius: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-body);
}

/* ===================================================================
   5. ОСНОВНОЙ КОНТЕНТ (MAIN LAYOUT)
   =================================================================== */
.main-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 12px 32px 24px;
}

/* Шапка */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title {
    font-size: 28px;
    font-weight: 500;
    letter-spacing: -0.015em;
    line-height: 24px;
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.btn-action {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-main);
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
}

.btn-action:hover {
    background-color: var(--bg-hover);
}

/* Табы и фильтры */
.controls-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 24px;
}

.tabs {
    display: flex;
    gap: 48px;
    border-bottom: 1px solid transparent;
    overflow-x: auto;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    padding-bottom: 8px;
    white-space: nowrap;
}

.tab.active {
    color: var(--text-main);
}

.filters-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.filters-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-chip {
    background-color: var(--bg-gray-btn);
    height: 32px;
    border-radius: 100px;
    padding: 0 16px;
    font-size: 13px;
    font-weight: 500;
    gap: 4px;
}

.filter-chip svg {
    width: 16px;
    height: 16px;
}

/* ===================================================================
   6. ТАБЛИЦА
   =================================================================== */
.table-card {
    background-color: var(--bg-white);
    border-radius: 24px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.table-scroll {
    overflow-x: auto;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1100px;
}

th, td {
    text-align: left;
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
}

th {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    padding-top: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-dark);
    white-space: nowrap;
}

td {
    font-size: 16px;
    font-weight: 400;
}

tr:hover td {
    background-color: var(--bg-hover);
    cursor: pointer;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
}

.dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
}

.dot.created { background-color: var(--status-green); }
.dot.not-lead { background-color: var(--status-gray); }
.dot.active { background-color: var(--status-yellow); }

.text-red { color: var(--text-red); }

/* ===================================================================
   7. МОДАЛЬНОЕ ОКНО
   =================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    justify-content: flex-end;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal-panel {
    background-color: var(--bg-white);
    width: 448px;
    max-width: 100%;
    height: 100%;
    box-shadow: var(--shadow-card);
    border-top-left-radius: 24px;
    border-bottom-left-radius: 24px;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.modal-overlay.open .modal-panel {
    transform: translateX(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    min-height: 60px;
}

.modal-header h2 {
    font-size: 24px;
    font-weight: 500;
    letter-spacing: -0.01em;
    margin: 0;
}

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

.info-block h3 {
    font-size: 20px;
    font-weight: 500;
    margin: 0 0 16px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-row {
    display: grid;
    grid-template-columns: auto auto;
    column-gap: 12px;
    align-items: center;
    justify-content: space-between;
    min-height: 54px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 16px;
}

.info-row span:first-child {
    color: var(--text-muted);
}

.info-row span:last-child {
    text-align: right;
    font-weight: 500;
}

/* Форма внутри модалки */
.form-group {
    margin-bottom: 16px;
    position: relative;
}

.form-label {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: block;
}

.form-input, .form-textarea {
    width: 100%;
    background-color: var(--bg-gray-btn);
    border: 2px solid transparent;
    border-radius: 16px;
    padding: 16px;
    font-size: 16px;
    font-family: inherit;
    color: var(--text-main);
    outline: none;
    transition: border 0.2s;
}

.form-input:focus, .form-textarea:focus {
    border-color: var(--text-main);
}

.form-textarea {
    resize: none;
    min-height: 140px;
}

.btn-submit {
    background-color: var(--color-yellow);
    color: var(--text-main);
    width: 100%;
    height: 56px;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 500;
    margin-top: 10px;
}

.btn-submit:hover {
    background-color: #f3d700;
}

/* ===================================================================
   9. INFO BLOCK (для модалок деталей)
   =================================================================== */
.info-block {
    margin-bottom: 24px;
}

.info-block h3 {
    font-size: 20px;
    font-weight: 500;
    margin: 0 0 16px 0;
    color: var(--text-main);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-row {
    display: grid;
    grid-template-columns: auto auto;
    column-gap: 12px;
    align-items: center;
    justify-content: space-between;
    min-height: 54px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 16px;
}

.info-row span:first-child {
    color: var(--text-muted);
}

.info-row span:last-child {
    text-align: right;
    font-weight: 500;
    color: var(--text-main);
}

/* ===================================================================
   10. PROGRESS BAR (Яндекс стиль)
   =================================================================== */
.progress-container {
    margin: 16px 0;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.progress-bar {
    height: 8px;
    background-color: var(--bg-gray-btn);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--color-yellow);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* ===================================================================
   11. DETAIL MODAL SPECIFIC
   =================================================================== */
.detail-value {
    font-weight: 500;
    color: var(--text-main);
}

.detail-label {
    color: var(--text-muted);
    font-size: 14px;
}

/* ===================================================================
   12. АДАПТАЦИЯ ПОД МОБИЛЬНЫЕ УСТРОЙСТВА
   =================================================================== */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    /* Сайдбар превращается в нижнее меню */
    .sidebar {
        width: 100%;
        height: 64px;
        flex-direction: row;
        border-right: none;
        border-top: 1px solid var(--border-light);
        position: fixed;
        bottom: 0;
        padding: 0 16px;
        background-color: var(--bg-white);
        z-index: 100;
    }

    .nav-list {
        flex-direction: row;
        justify-content: space-between;
        gap: 0;
    }

    .nav-list.bottom {
        display: none;
    }

    /* Основной контент */
    .main-layout {
        padding: 16px 16px 80px 16px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-actions {
        width: 100%;
        flex-direction: column;
    }

    .header-actions .btn-action {
        width: 100%;
        background-color: var(--bg-white);
        border: 1px solid var(--border-light);
    }

    .filters-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .filters-group {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 8px;
        flex-wrap: nowrap;
    }

    /* Модальное окно (BottomSheet) */
    .modal-overlay {
        justify-content: center;
        align-items: flex-end;
    }

    .modal-panel {
        width: 100%;
        height: 90vh;
        border-radius: 24px 24px 0 0;
        transform: translateY(100%);
    }

    .modal-overlay.open .modal-panel {
        transform: translateY(0);
    }

    .modal-body {
        padding: 16px;
    }
}
