/* ===================================================================
   Components Styles - Buttons, Modals, Notifications, Dropdowns
   =================================================================== */

/* === Sidebar Navigation Components === */
.sidebar-menu-item {
    margin: 1px 0;
}

/* Button to toggle the submenu */
.sidebar-menu-toggle {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    color: var(--text-color, #3c4043);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    border-radius: var(--border-radius-lg, 12px);
    position: relative;
    transition: background-color 0.15s ease;
    min-height: 36px;
    gap: 12px;
    font-family: 'Google Sans', sans-serif;
}

.sidebar-menu-toggle:hover {
    background-color: var(--color-v3-hover, #f1f3f4);
}

/* Style for the chevron icon */
.menu-chevron {
    width: 20px;
    height: 20px;
    margin-left: auto; /* Pushes icon to the right */
    transition: transform 0.15s ease;
}

/* Rotation for the chevron when open */
.sidebar-menu-item.is-open > .sidebar-menu-toggle .menu-chevron {
    transform: rotate(180deg);
}

/* Submenu container */
.sidebar-submenu {
    max-height: none;
    overflow: visible;
    display: none;
}

.sidebar-menu-item.is-open > .sidebar-submenu {
    display: block;
}

/* === Navigation Items === */
.sidebar-tab-link {
    width: 100%;
    border: none;
    display: flex;
    align-items: center;
    padding: 8px 12px;
    color: var(--text-color, #3c4043);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    border-radius: var(--border-radius-lg, 15px);
    position: relative;
    transition: background-color 0.15s ease;
    min-height: 36px;
    gap: 12px;
    font-family: 'Google Sans', sans-serif;
    margin: 3px 0;
}

.sidebar-tab-link:active {
    background-color: #e8eaed;
}

.sidebar-tab-link.active {
    background-color: var(--sidebar-active-bg);
    color: var(--text-color);
    font-weight: 600;
    border: none;
    width: 100%;
}

/* === Classification group: no frame or alternate background === */
.menu-classification > .sidebar-menu-toggle,
.menu-classification.is-open > .sidebar-menu-toggle,
.menu-classification.is-active > .sidebar-menu-toggle {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.menu-classification > .sidebar-menu-toggle:hover {
    background: transparent !important;
}

/* Use hover var for general hover */
.sidebar-tab-link:hover {
    background-color: var(--sidebar-hover-bg);
}

.sidebar-sub-link {
    padding-left: 24px !important;
}

/* === Sidebar Footer Components === */
/* Unified footer button style for Settings and Account */
.sidebar-footer {
    --footer-icon-size: 28px;
}

.sidebar-footer .footer-action {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    min-height: 36px;
    width: 100%;
    border: none;
    background: transparent;
    border-radius: var(--border-radius-lg, 15px);
    cursor: pointer;
    transition: background-color 0.15s ease;
    color: var(--text-color, #3c4043);
    font-weight: 500; /* более жирный текст */
    line-height: 20px;
    text-align: left;
    font-family: 'Google Sans', sans-serif;
}

.sidebar-footer .footer-action:hover {
    background-color: var(--color-v3-hover, #f1f3f4);
    text-decoration: none;
}

.sidebar-footer .footer-icon {
    width: var(--footer-icon-size);
    height: var(--footer-icon-size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    flex: 0 0 var(--footer-icon-size);
}

.sidebar-footer .footer-icon .material-symbols-outlined,
.sidebar-footer .material-symbols-outlined.footer-icon {
    font-size: var(--footer-icon-size);
    line-height: 1;
}

.sidebar-footer .footer-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer .footer-icon .user-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.category-attributes {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    pointer-events: none;
}

.attribute-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    min-width: 88px;
    padding: 6px 12px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    color: var(--secondary-text-color);
    background-color: var(--color-v3-button-container);
    border: 1px solid var(--border-color);
    cursor: pointer;
    pointer-events: auto;
    user-select: none;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.attribute-icon:hover {
    background-color: var(--color-v3-button-container-high);
    transform: translateY(-1px);
}

.attribute-icon.active {
    color: var(--color-v3-text-on-button-reverse);
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transform: none;
}


/* --- Buttons --- */
.login-btn {
    display: inline-block;
    background-color: var(--primary-color);
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 24px;
    border-radius: 100px;
    text-decoration: none;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.login-btn:hover {
    background-color: var(--primary-color-hover);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    text-decoration: none;
}

[ms-button] {
    --ms-button-height: 32px;
    font-family: "Inter", sans-serif;
    font-optical-sizing: auto;
    font-size: 14px;
    font-weight: 500;
    line-height: 16px;
    align-items: center;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 0 12px;
    transition: background-color .15s ease-in-out, border-color .15s ease-in-out, color .15s ease-in-out, box-shadow .1s ease-in-out;
    user-select: none;
    white-space: nowrap;
    height: var(--ms-button-height);
    border: 1px solid transparent;
    background-color: transparent;
}

[ms-button].ms-button-icon {
    aspect-ratio: 1 / 1;
    padding: 0;
}

[ms-button].ms-button-primary {
    background-color: var(--color-v3-button-container);
    border-color: var(--color-v3-outline);
    color: var(--color-v3-text-on-button);
}

.sidebar-toggle-button:hover {
    background-color: var(--color-v3-hover);
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

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

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

.btn-secondary {
    background-color: var(--card-bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--color-v3-hover);
}

.btn-danger {
    background-color: var(--color-error);
    color: white;
}

.btn-danger:hover {
    background-color: #b0261e;
}

.btn-common {
    background: var(--card-bg-color);
    border: 1px solid var(--border-color);
    color: var(--secondary-text-color);
    padding: 8px 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-common:hover {
    background-color: var(--color-v3-hover);
    border-color: var(--secondary-text-color);
    color: var(--text-color);
}

.btn-common:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--bg-color);
}

.delete-button {
    position: absolute; /* Изменяем на absolute для правильного позиционирования */
    top: 8px; /* Позиционируем в правом верхнем углу */
    right: 8px;
    background: rgba(0, 0, 0, 0.7); /* Полупрозрачный темный фон */
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    color: white;
    transition: all 0.2s ease;
    pointer-events: auto; /* Make it clickable */
    z-index: 10; /* Обеспечиваем отображение поверх других элементов */
}

.delete-button:hover {
    background: rgba(255, 0, 0, 0.8); /* Красный фон при наведении */
}


/* === Модальные окна === */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(32, 33, 36, 0.6);
    display: none;
    cursor: pointer;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
    /* Центрирование контента */
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: var(--card-bg-color);
    margin: 0;
    padding: 0;
    border-radius: var(--border-radius);
    box-shadow: var(--v3-shadow-lg);
    animation: modalFadeIn 0.2s ease;
    cursor: default;
    max-width: 95vw;
    max-height: 95vh;
    width: auto;
    display: flex;
    flex-direction: column;
}

/* Специальные стили для модального окна изображения */
#imageModal {
    display: none;
    align-items: center;
    justify-content: center;
}

#imageModal.show {
    display: flex;
}

#imageModal .modal-content {
    width: auto;
    max-width: 90vw;
    max-height: 90vh;
    background: transparent;
    box-shadow: none;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
}

#imageModal .modal-header {
    background-color: var(--card-bg-color);
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#imageModal .modal-body {
    padding: 0;
    text-align: center;
    background: #000;
    border-radius: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
    min-height: clamp(0px, 200px, 100%);
}

#imageModal .modal-body img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

#imageModal .modal-footer {
    background-color: var(--card-bg-color);
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    display: flex;
    flex-direction: column;
    gap: 2px;
    /* Единая ширина колонки меток (можно подстроить) */
    --modal-label-width: 160px;
}

#imageModal .modal-info-item {
    /* Единый шаблон строк: метка → значение */
    display: grid;
    grid-template-columns: var(--modal-label-width) 1fr;
    align-items: center;
    column-gap: 12px;
    font-size: 14px;
    color: var(--secondary-text-color);
    padding: 4px 0;
}

#imageModal .modal-info-item:last-child {
    border-bottom: none;
}

#imageModal .modal-info-item strong {
    color: var(--text-color);
    font-weight: 500;
    margin: 0; /* грид сам даёт отступы */
    min-width: 0; /* чтобы не ломать сетку на узких экранах */
    text-align: left;
}

#imageModal .modal-info-item span {
    color: var(--text-color);
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left; /* единое выравнивание значений */
}

/* Внутренний блок атрибутов персоны ведёт себя как тот же список строк */
#imageModal .modal-person-attributes {
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
    padding-top: 0;
}

.modal-person-attributes__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    padding: 12px 0;
    user-select: none;
}

.modal-person-attributes__summary::-webkit-details-marker {
    display: none;
}

.modal-person-attributes__summary::after {
    content: '';
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--secondary-text-color);
    border-bottom: 2px solid var(--secondary-text-color);
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.modal-person-attributes[open] .modal-person-attributes__summary::after {
    transform: rotate(-135deg);
}

.modal-person-attributes__summary:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.modal-person-attributes__content {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-top: 1px solid var(--border-color);
    padding-top: 8px;
    margin-top: 4px;
}

#imageModal .modal-footer > .modal-info-item:last-child,
#imageModal .modal-person-attributes .modal-info-item:last-child {
    border-bottom: none;
}

/* Мобильная адаптация для модального окна изображения */
@media (max-width: 768px) {
    #imageModal {
        padding: 0;
    }

    #imageModal .modal-content {
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
        width: 100vw;
        height: 100vh;
    }

    #imageModal .modal-header {
        border-radius: 0;
        padding: 12px 16px;
    }

    #imageModal .modal-body {
        flex: 1 1 auto;
        border-radius: 0;
        min-height: min(200px, 100%);
    }

    #imageModal .modal-body img {
        max-height: 100%;
    }

    #imageModal .modal-footer {
        border-radius: 0;
        padding: 12px 16px;
        gap: 8px;
    }

    #imageModal .modal-info-item {
        padding: 6px 0;
    }

    /* Уже на мобильном — колонка метки чуть уже */
    #imageModal .modal-footer {
        --modal-label-width: 120px;
    }

    #imageModal .modal-info-item strong {
        font-size: 13px;
    }

    #imageModal .modal-info-item span {
        font-size: 13px;
    }
}

/* === CSS стили для отображения атрибутов персоны в модальном окне === */

/* Контейнер для атрибутов персоны в модальном окне */
.modal-person-attributes {
    border-top: 1px solid var(--border-color);
    margin-top: 12px;
    padding-top: 0;
}

/* Стили для списка атрибутов */
.modal-person-attributes .person-attributes {
    color: var(--text-color);
    font-weight: 400;
}

/* Стили для имени файла с обрезкой */
#modalFilename {
    font-family: monospace;
    font-size: 13px;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: help; /* Показывает, что есть tooltip */
}

/* Адаптация для мобильных устройств */
@media (max-width: 768px) {
    #modalFilename {
        max-width: 200px;
        font-size: 12px;
    }

    .modal-person-attributes .person-name {
        font-size: 13px;
        padding: 1px 6px;
    }

    .modal-person-attributes .person-attributes {
        font-size: 13px;
    }
}

/* FIX: удален ошибочно вставленный JS-код внутри CSS */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: var(--text-color);
    font-size: 18px;
    font-weight: 600;
}

.modal .close {
    color: var(--secondary-text-color);
    font-size: 28px; /* Унифицируем размер крестика в модальных окнах */
    font-weight: 400;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s ease;
    border: none;
    background: none;
    width: 36px; /* Делаем размер консистентным */
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.modal .close:hover {
    color: var(--text-color);
    background-color: var(--color-v3-hover);
}

.modal-body {
    padding: 24px;
}

.modal-body .form-item {
    display: flex;
    flex-direction: column;
}

.modal-body .form-item:not(:first-child) {
    margin-top: 15px;
}

.modal-body .form-item label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--secondary-text-color);
}

.modal-body .car-details-container {
    margin-top: 12px;
}

.modal-body .car-details-container p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--secondary-text-color);
}

.modal-body fieldset {
    border: none;
    padding: 0;
    margin: 24px 0 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-body fieldset legend {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--secondary-text-color);
}

.modal-body .form-item input[type="text"] {
    width: 100%;
    border: none;
    border-bottom: 2px solid var(--border-color);
    padding: 8px 0;
    font-size: 1.4rem;
    font-family: inherit;
    color: var(--text-color);
    background-color: transparent;
    transition: border-color 0.2s ease;
    font-weight: 600;
}

.modal-body .form-item input[type="text"]:focus {
    outline: none;
    border-bottom-color: var(--primary-color);
}

.modal-body .form-item input[type="text"]::placeholder {
    color: var(--secondary-text-color);
    opacity: 0.75;
}

.modal-body .form-item input[type="text"]:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.modal-body .attribute-item {
    display: flex;
}

.modal-body .attribute-item label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: var(--text-color);
}

.modal-body input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    accent-color: var(--primary-color);
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--card-bg-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    margin: 0;
    flex-shrink: 0;
}

.modal-body input[type="checkbox"]::after {
    content: '';
    position: absolute;
    width: 7px;
    height: 12px;
    border: solid transparent;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modal-body input[type="checkbox"]:hover {
    border-color: var(--primary-color);
}

.modal-body input[type="checkbox"]:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.modal-body input[type="checkbox"]:checked::after {
    border-color: var(--color-v3-text-on-button-reverse, #ffffff);
    opacity: 1;
}

.modal-body input[type="checkbox"]:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.modal-body input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.modal-body input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-color);
}

#confirmModal .modal-content {
    text-align: center;
    padding: 24px;
}

#attributesModal .modal-footer {
    justify-content: space-between;
}

#attributesModal fieldset {
    border: none; /* Убираем браузерную рамку */
    padding: 0;
    margin: 0;
}

/* Styles for New Category Modal */
#newCategoryModal .form-item {
    margin-bottom: 24px;
}

#newCategoryModal #newCategoryName {
    width: 100%;
    border: none;
    border-bottom: 2px solid var(--border-color);
    padding: 8px 0;
    font-size: 16px;
    background-color: transparent;
    transition: border-color 0.2s ease;
    color: var(--text-color);
}

#newCategoryModal #newCategoryName:focus {
    outline: none;
    border-color: var(--primary-color);
}

#newCategoryModal fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

#newCategoryModal .attribute-item {
    padding: 4px 0;
}

/* === Dropdowns === */
.category-dropdown {
    background: var(--card-bg-color);
    border: 1px solid var(--border-color);
    position: absolute;
    box-shadow: var(--v3-shadow-md);
    max-height: 200px;
    overflow-y: auto;
    z-index: 3000;
    display: none;
    min-width: 200px;
    border-radius: var(--border-radius);
}

.category-dropdown-item {
    padding: 6px 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    transition: background-color 0.2s ease;
    border-bottom: none;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    position: relative;
}

.category-dropdown-item:hover {
    background-color: var(--color-v3-hover);
}

/* Стили для предлагаемой категории на основе similarity */
.category-dropdown-item.suggested-category {
    background-color: #e8f2ff; /* Серо-голубоватый фон */
    border-left: 3px solid var(--primary-color); /* Синяя полоска слева */
}

.category-dropdown-item.suggested-category:hover {
    background-color: #d6ebff; /* Более насыщенный голубой при hover */
}

/* Контейнер для названия категории и процента */
.category-dropdown-item .category-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 8px;
}

/* Стиль для отображения процента confidence */
.category-dropdown-item .confidence-percentage {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-color);
    background-color: rgba(36, 131, 226, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

/* Добавляем иконку лица для каждого элемента dropdown */
.category-dropdown-item::before {
    content: "face";
    font-family: 'Material Symbols Outlined';
    font-size: 18px;
    font-weight: 400;
    font-style: normal;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: "liga";
    -webkit-font-smoothing: antialiased;
    font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
    color: var(--secondary-text-color);
    flex-shrink: 0;
}

/* Для предлагаемой категории делаем иконку более яркой */
.category-dropdown-item.suggested-category::before {
    color: var(--primary-color);
}

.category-dropdown-btn {
    background: none;
    border: none;
    color: var(--secondary-text-color);
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.category-dropdown-btn:hover:not(:disabled) {
    background-color: var(--color-v3-hover);
    color: var(--text-color);
}

.category-dropdown-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.category-dropdown-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.category-dropdown-btn .icon-up {
    display: none;
}

.category-dropdown-btn.active .icon-down {
    display: none;
}

.category-dropdown-btn.active .icon-up {
    display: block;
}

.category-dropdown-btn .chevron {
    transition: transform 0.2s ease-in-out;
    transform: rotate(0deg);
}

.category-dropdown-btn.active .chevron,
.category-dropdown-btn[aria-expanded="true"] .chevron {
    transform: rotate(180deg);
}

/* Дополнительные стили для темной темы */
@media (prefers-color-scheme: dark) {
    .category-dropdown {
        background: #303134;
        border-color: #5f6368;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    }

    .category-dropdown-item {
        color: #e8eaed;
    }

    .category-dropdown-item:hover {
        background-color: #424549;
    }

    .category-dropdown-item::before {
        color: #9aa0a6;
    }

    /* Стили для предлагаемой категории в темной теме */
    .category-dropdown-item.suggested-category {
        background-color: #1a2b42; /* Темно-синий фон */
        border-left-color: #8ab4f8; /* Светло-синяя полоска слева */
    }

    .category-dropdown-item.suggested-category:hover {
        background-color: #1e3354; /* Более насыщенный темно-синий при hover */
    }

    .category-dropdown-item.suggested-category::before {
        color: #8ab4f8; /* Светло-синяя иконка */
    }

    .category-dropdown-item .confidence-percentage {
        color: #8ab4f8;
        background-color: rgba(138, 180, 248, 0.15);
    }
}


/* --- Notifications --- */
#notification-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    pointer-events: none;
}

.notification-item {
    background-color: var(--card-bg-color);
    color: var(--text-color);
    padding: 14px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--v3-shadow-md);
    font-weight: 500;
    font-size: 15px;
    pointer-events: auto;
    opacity: 0;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.21, 1.02, 0.73, 1), opacity 0.4s ease;
}

.notification-item.success {
    background-color: var(--color-success);
    color: white;
    border-left: 5px solid rgba(0, 0, 0, 0.2);
}

.notification-item.error {
    background-color: var(--color-error);
    color: white;
    border-left: 5px solid rgba(0, 0, 0, 0.2);
}

.notification-item.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-item.exit {
    animation: fadeOutUp 0.4s forwards cubic-bezier(0.4, -0.2, 0.79, 0);
}

@keyframes fadeOutUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-60px);
    }
}

/* --- Icons --- */
.light-theme .material-symbols-outlined {
    display: inline-block;
    font-size: 20px;
    font-family: "Material Symbols Outlined";
    font-weight: normal;
    font-style: normal;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: "liga";
    -webkit-font-smoothing: antialiased;
    font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 0, "opsz" 24;
}

.ms-400 {
    font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}

.light-theme button {
    font-size: 12px;
    font-weight: 600;
    line-height: 20px;
    font-family: "Inter", sans-serif;
    letter-spacing: normal;
}


/* === DARK THEME ADAPTATIONS === */
@media (prefers-color-scheme: dark) {
    .logo a,
    .sidebar-tab-link,
    .sidebar-menu-toggle,
    .account-switcher-text {
        color: #e8eaed;
    }

    .sidebar-tab-link:hover,
    .sidebar-menu-toggle:hover,
    .account-switcher-button:hover {
        background-color: #303134;
    }

    .sidebar-tab-link:active {
        background-color: #3c4043;
    }

    .sidebar-tab-link.active {
        background-color: var(--sidebar-active-bg);
        color: var(--text-color);
    }

    #newCategoryModal #newCategoryName {
        color: var(--text-color);
    }
}

/* Plate Management Panel */
.plates-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1rem;
}

.plates-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.plates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.plates-management-panel {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.plates-management-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.plates-management-header h2 {
    margin: 0;
}

.plates-management-subtitle {
    margin: 0;
    color: var(--secondary-text-color);
    font-size: 0.9rem;
}

.plate-card {
    position: relative;
    overflow: hidden;
    --plate-card-snapshot: none;
    --plate-card-overlay: linear-gradient(135deg, rgba(255, 255, 255, 0.92) 0%, rgba(255, 255, 255, 0.72) 55%, rgba(255, 255, 255, 0.45) 100%);
    background-color: var(--card-bg-color, var(--background-color-secondary));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.plate-bg {
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

.plate-card .plate-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    filter: saturate(0.9);
    opacity: 0.9;
    z-index: 0;
    transition: opacity 0.2s ease, transform 0.35s ease;
}

.plate-card.has-snapshot {
    background-color: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.05);
}

.plate-card.has-snapshot::after,
.plate-card.has-snapshot::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.35s ease;
}

.plate-card.has-snapshot::after {
    background-image: var(--plate-card-snapshot);
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    filter: saturate(0.9);
    opacity: 0.9;
    z-index: 0;
}

.plate-card.has-snapshot::before {
    background: var(--plate-card-overlay);
    z-index: 1;
}

.plate-card.has-snapshot > :not(.plate-bg) {
    position: relative;
    z-index: 2;
}

.plate-card.has-snapshot:hover::after {
    transform: scale(1.05);
}

.plate-card.has-snapshot:hover::before {
    opacity: 0.85;
}

.plate-card.has-snapshot:hover .plate-bg,
.plate-card.has-snapshot:focus-within .plate-bg {
    transform: scale(1.05);
}

.plate-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}


.plate-card.seen:is(.has-plate-bg, .has-snapshot):hover,
.plate-card.seen:is(.has-plate-bg, .has-snapshot):focus-within {
    color: #fff;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.65);
}

.plate-card.seen:is(.has-plate-bg, .has-snapshot):hover :is(
        .plate-number,
        .plate-name,
        .plate-detail,
        .plate-status,
        .plate-reason,
        .plate-flags
    ),
.plate-card.seen:is(.has-plate-bg, .has-snapshot):focus-within :is(
        .plate-number,
        .plate-name,
        .plate-detail,
        .plate-status,
        .plate-reason,
        .plate-flags
    ) {
    color: inherit;
    text-shadow: inherit;
}

.plate-card.seen:is(.has-plate-bg, .has-snapshot):hover :is(.plate-visit-info, .plate-visit-info > *),
.plate-card.seen:is(.has-plate-bg, .has-snapshot):focus-within :is(.plate-visit-info, .plate-visit-info > *) {
    color: inherit;
    text-shadow: inherit;
}

.plate-card.seen:is(.has-plate-bg, .has-snapshot):hover,
.plate-card.seen:is(.has-plate-bg, .has-snapshot):focus-within {
    color: #fff;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.65);
}

.plate-card.seen:is(.has-plate-bg, .has-snapshot):hover :is(
        .plate-number,
        .plate-name,
        .plate-detail,
        .plate-status,
        .plate-reason,
        .plate-flags
    ),
.plate-card.seen:is(.has-plate-bg, .has-snapshot):focus-within :is(
        .plate-number,
        .plate-name,
        .plate-detail,
        .plate-status,
        .plate-reason,
        .plate-flags
    ) {
    color: inherit;
    text-shadow: inherit;
}

.plate-card.seen:is(.has-plate-bg, .has-snapshot):hover :is(.plate-visit-info, .plate-visit-info > *),
.plate-card.seen:is(.has-plate-bg, .has-snapshot):focus-within :is(.plate-visit-info, .plate-visit-info > *) {
    color: inherit;
    text-shadow: inherit;
}

.plate-card.seen {
    opacity: 0.65;
    border-style: dashed;
}

.plate-card.seen.has-plate-bg {
    opacity: 1;
}

.plate-card.seen.has-plate-bg .plate-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-color: rgba(255, 255, 255, 0.78);
    background-image: none;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    background-blend-mode: color-burn;
    -webkit-mask: linear-gradient(#000 0 0) 0 0 / 0% 0% no-repeat;
    mask: linear-gradient(#000 0 0) 0 0 / 0% 0% no-repeat;
    animation: v8-reveal-2d 1.2s ease-out forwards;
    will-change: mask-size, -webkit-mask-size;
    transition: background-blend-mode 0.2s ease;
    z-index: 0;
}

.plate-card.seen.has-plate-bg .plate-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, rgba(12, 19, 33, 0.45) 0%, rgba(12, 19, 33, 0.7) 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.plate-card.seen.has-plate-bg:hover .plate-bg::after,
.plate-card.seen.has-plate-bg:focus-within .plate-bg::after {
    opacity: 0.75;
}

.plate-card.seen.has-plate-bg > *:not(.plate-bg) {
    position: relative;
    z-index: 2;
}

.plate-card.seen .plate-name {
    display: none;
}

.plate-card.seen .plate-number {
    padding-left: 5px;
    text-align: left;
}


.plate-card.watched {
    cursor: pointer;
}

.plate-number {
    font-weight: 600;
    font-size: 1.2rem;
    letter-spacing: 1px;
    text-align: center;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

.plate-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.plate-action-icon {
    font-size: 24px;
    line-height: 1;
    border-radius: 999px;
    padding: 6px;
    cursor: pointer;
    color: var(--secondary-text-color);
    transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
    user-select: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
    font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 0, "opsz" 24;
}

.plate-action-icon.fill-toggle.is-active,
.plate-action-icon.fill-toggle[data-active="true"] {
    font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24;
}

.plate-action-icon:hover,
.plate-action-icon:focus-visible {
    background-color: var(--color-v3-hover, rgba(60, 64, 67, 0.08));
    color: var(--primary-color, #1a73e8);
    outline: none;
    transform: translateY(-1px);
}

.plate-action-icon.is-active,
.plate-action-icon[data-active="true"] {
    color: var(--primary-color, #1a73e8);
    background-color: rgba(26, 115, 232, 0.12);
    box-shadow: inset 0 0 0 1px rgba(26, 115, 232, 0.2);
}

.plate-action-icon.is-active:hover,
.plate-action-icon.is-active:focus-visible,
.plate-action-icon[data-active="true"]:hover,
.plate-action-icon[data-active="true"]:focus-visible {
    background-color: rgba(26, 115, 232, 0.18);
    box-shadow: inset 0 0 0 1px rgba(26, 115, 232, 0.35);
}

.plate-visit-info {
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

.plate-status {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--secondary-text-color);
}

.plate-detail {
    text-align: center;
    font-size: 0.9rem;
}

.plate-detail:not(:first-of-type) {
    margin-top: 0.25rem;
}

.plate-name {
    font-weight: 600;
    font-size: 1rem;
    margin: auto;
}

.plate-reason {
    color: var(--secondary-text-color);
    font-size: 0.85rem;
}

.plate-flags {
    color: var(--secondary-text-color);
    font-size: 0.8rem;
}

.plates-empty,
.plates-loading,
.plates-error,
.plates-separator {
    grid-column: 1 / -1;
    text-align: center;
}

.plates-empty,
.plates-loading,
.plates-error {
    margin: 1.5rem 0;
    color: var(--secondary-text-color);
}

.plates-error {
    color: var(--danger-color, #d9534f);
}

.plates-separator {
    height: 1px;
    background-color: var(--border-color);
    margin: 0.5rem 0;
}

@keyframes v8-reveal-2d {
    0% {
        -webkit-mask-size: 0% 0%;
        mask-size: 0% 0%;
    }
    50% {
        -webkit-mask-size: 100% 0%;
        mask-size: 100% 0%;
    }
    100% {
        -webkit-mask-size: 100% 100%;
        mask-size: 100% 100%;
    }
}

