/* ============================================================
   dashboard.css — современные фильтры дашборда
   ============================================================ */

/* ------------------------------------------------------------
   Панель фильтров
   ------------------------------------------------------------ */
.dashboard-filters {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 22px 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px -12px rgba(16, 24, 40, .08);
    overflow: hidden;
}

.dashboard-filters::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), #4a9670, var(--primary));
    opacity: .8;
}

/* ------------------------------------------------------------
   Кнопки-пресеты
   ------------------------------------------------------------ */
.preset-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px dashed var(--border);
}

.preset-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 100px;
    background: var(--bg-subtle);
    border: 1px solid transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    transition: all .22s var(--ease);
    white-space: nowrap;
    user-select: none;
}

.preset-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
    text-decoration: none;
    transform: translateY(-1px);
}

.preset-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 12px rgba(47, 111, 78, .32), inset 0 1px 0 rgba(255,255,255,.15);
    transform: none;
}

.preset-btn.active:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(47, 111, 78, .4);
}

/* ------------------------------------------------------------
   Форма с датами
   ------------------------------------------------------------ */
.date-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 14px;
    align-items: end;
}

/* Если нет селекта сервера — форма всё равно смотрится ок */
.date-form:not(:has(.date-field-server)) {
    grid-template-columns: 1fr 1fr auto;
}

.date-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.date-field-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-muted);
    padding-left: 4px;
}

/* ------------------------------------------------------------
   Input с иконкой слева
   ------------------------------------------------------------ */
.date-input-wrap,
.server-select-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.date-input-wrap .field-icon,
.server-select-wrap .field-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
    width: 16px;
    height: 16px;
    transition: color .2s;
}

.date-input-wrap:focus-within .field-icon,
.server-select-wrap:focus-within .field-icon {
    color: var(--primary);
}

/* ------------------------------------------------------------
   Стилизованный input[type=date]
   ------------------------------------------------------------ */
.date-input {
    width: 100%;
    height: 44px;
    padding: 0 14px 0 40px;
    background: var(--bg-subtle);
    border: 1.5px solid transparent;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    outline: none;
    transition: all .2s var(--ease);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    letter-spacing: .01em;
}

.date-input:hover {
    background: var(--bg-card);
    border-color: var(--border-hover);
}

.date-input:focus {
    background: var(--bg-card);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.date-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0;
    width: 100%;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    padding: 0;
}

.date-input::-webkit-datetime-edit {
    color: var(--text);
}

.date-input::-webkit-datetime-edit-fields-wrapper {
    padding: 0;
}

.date-input::-webkit-inner-spin-button,
.date-input::-webkit-clear-button {
    display: none;
}

/* ------------------------------------------------------------
   Стилизованный select сервера
   ------------------------------------------------------------ */
.server-select {
    width: 100%;
    height: 44px;
    padding: 0 38px 0 40px;
    background: var(--bg-subtle);
    border: 1.5px solid transparent;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    outline: none;
    transition: all .2s var(--ease);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px;
}

[data-theme="dark"] .server-select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b929c' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
}

.server-select:hover {
    background-color: var(--bg-card);
    border-color: var(--border-hover);
}

.server-select:focus {
    background-color: var(--bg-card);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* ------------------------------------------------------------
   Кнопка "Применить"
   ------------------------------------------------------------ */
.btn-apply {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 26px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: all .22s var(--ease);
    box-shadow: 0 4px 12px rgba(47, 111, 78, .25), inset 0 1px 0 rgba(255,255,255,.12);
    white-space: nowrap;
    user-select: none;
}

.btn-apply:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(47, 111, 78, .35), inset 0 1px 0 rgba(255,255,255,.2);
}

.btn-apply:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(47, 111, 78, .3);
}

.btn-apply svg {
    width: 15px;
    height: 15px;
}

/* ------------------------------------------------------------
   Инфо-полоса под фильтрами
   ------------------------------------------------------------ */
.filter-info {
    margin-top: 18px;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--primary-light), transparent 180%);
    border-radius: 10px;
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    line-height: 1.5;
}

.filter-info .fi-label {
    font-weight: 600;
    color: var(--text);
    margin-right: 2px;
}

.filter-info-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    background: var(--bg-card);
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    border: 1px solid var(--border);
    line-height: 1.2;
}

.filter-info-tag.tag-warning {
    background: var(--warning-bg);
    border-color: var(--warning);
    color: var(--warning);
}

.filter-info-tag .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, .18);
}

/* ------------------------------------------------------------
   Мелкие правила для метрик (заголовки секций)
   ------------------------------------------------------------ */
.dashboard-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin: 28px 0 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border), transparent);
}

/* ------------------------------------------------------------
   Адаптив
   ------------------------------------------------------------ */
@media (max-width: 900px) {
    .date-form {
        grid-template-columns: 1fr 1fr;
    }
    .date-form .btn-apply {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .dashboard-filters {
        padding: 18px 16px;
        border-radius: 14px;
    }

    .preset-row {
        gap: 6px;
        padding-bottom: 16px;
        margin-bottom: 16px;
    }

    .preset-btn {
        padding: 8px 14px;
        font-size: 12px;
    }

    .date-form {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .date-input,
    .server-select,
    .btn-apply {
        height: 42px;
    }

    .btn-apply {
        width: 100%;
    }

    .filter-info {
        font-size: 12px;
        padding: 10px 12px;
    }
}