/* src/main/resources/META-INF/resources/css/custom.css */

/* ============================================
   АНИМАЦИЯ БЕГУЩЕЙ СТРОКИ
   ============================================ */
@keyframes marquee {
    0%   { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}
.animate-marquee {
    display: inline-block;
    animation: marquee 30s linear infinite;
}
.animate-marquee:hover {
    animation-play-state: paused;
}

/* ============================================
   БАЗОВЫЕ СТИЛИ
   ============================================ */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ============================================
   КАСТОМНЫЙ СКРОЛЛБАР
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #f5f5f5;
}
::-webkit-scrollbar-thumb {
    background: #002f6c;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #003d82;
}

/* ============================================
   СПИННЕР ЗАГРУЗКИ
   ============================================ */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   ПЕЧАТЬ
   ============================================ */
@media print {
    header, footer, nav { display: none !important; }
}

/* ============================================
   АНИМАЦИЯ DROPDOWN (десктоп)
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.animate-fadeIn {
    animation: fadeIn 0.15s ease-out;
}

/* ============================================
   АНИМАЦИЯ ПОДМЕНЮ 2-ГО УРОВНЯ (десктоп)
   ============================================ */
@keyframes fadeInSubmenu {
    from {
        opacity: 0;
        transform: translateX(-8px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
.animate-fadeInSubmenu {
    animation: fadeInSubmenu 0.2s ease-out;
}

/* Подсветка пункта при открытом подменю */
.group\/submenu:has([id^="submenu"]:not(.hidden)) > button {
    background-color: #002f6c;
    color: white;
}

.group\/submenu:has([id^="submenu"]:not(.hidden)) > button .text-gray-400 {
    color: rgba(255, 255, 255, 0.7);
}

.group\/submenu:has([id^="submenu"]:not(.hidden)) > button .bg-rst-blue\/10 {
    background-color: rgba(255, 255, 255, 0.2);
}

.group\/submenu:has([id^="submenu"]:not(.hidden)) > button .text-rst-blue {
    color: white;
}

/* ============================================
   МОБИЛЬНОЕ МЕНЮ — анимация слайда
   ============================================ */
@keyframes slideIn {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}
@keyframes slideOut {
    from { transform: translateX(0); }
    to   { transform: translateX(100%); }
}

#mobileMenu {
    transition: visibility 0s linear 0.3s;
}
#mobileMenu.open {
    visibility: visible !important;
    transition-delay: 0s;
}
#mobileMenu.open #mobileMenuPanel {
    animation: slideIn 0.3s ease-out forwards;
}
#mobileMenu.closing #mobileMenuPanel {
    animation: slideOut 0.3s ease-in forwards;
}

/* Оверлей затемнения */
#mobileMenuOverlay {
    transition: opacity 0.3s ease;
}
#mobileMenu.open #mobileMenuOverlay {
    opacity: 1;
}

/* ============================================
   МОБИЛЬНЫЙ АККОРДЕОН — плавное раскрытие
   ============================================ */
[id^="mobileSub"] {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease;
    opacity: 0;
}

[id^="mobileSub"]:not(.hidden) {
    max-height: 1000px;
    opacity: 1;
}

/* ============================================
   САЙДБАР — сворачиваемый на мобильных
   ============================================ */
@keyframes slideSidebarIn {
    from { max-height: 0; opacity: 0; }
    to   { max-height: 2000px; opacity: 1; }
}

.sidebar-collapsible {
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease;
}

/* ============================================
   МОБИЛЬНЫЙ КАРТОЧНЫЙ ВИД ТАБЛИЦЫ (<640px)
   ============================================ */
@media (max-width: 639px) {
    .mobile-card-table thead {
        display: none;
    }
    .mobile-card-table tbody tr {
        display: block;
        border: 1px solid #dce1e7;
        border-radius: 8px;
        margin-bottom: 12px;
        padding: 12px;
        background: #fff;
    }
    .mobile-card-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 6px 0;
        border: none;
        text-align: right;
    }
    .mobile-card-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #002f6c;
        text-align: left;
        margin-right: 12px;
        flex-shrink: 0;
        font-size: 0.75rem;
        text-transform: uppercase;
    }
    .mobile-card-table tbody td:first-child {
        display: none;
    }
}

/* ============================================
   МОБИЛЬНЫЕ УТИЛИТЫ
   ============================================ */
@media (max-width: 767px) {
    .mobile-px {
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* ============================================
   СКРЫТИЕ СКРОЛЛБАРА (горизонтальная прокрутка)
   ============================================ */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* ============================================
   КНОПКА «НАВЕРХ»
   ============================================ */
#scrollTopBtn {
    transition: opacity 0.3s ease, transform 0.3s ease;
}
#scrollTopBtn.show {
    opacity: 1;
    transform: translateY(0);
}
#scrollTopBtn.hide {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}