/**
 * ИИ-ассистент: канонический каскад — docs/css-cascade-order.md · ур.4 layout (footer после header).
 * Не менять порядок подключения в legacy-styles-*.blade.php / PHP head без регрессии специфичности.
 *
 * ════════════════════════════════════════════════════════════════════════════════
 * 📁 СТИЛИ ДЛЯ ФУТЕРА (FOOTER.PHP)
 * ════════════════════════════════════════════════════════════════════════════════
 * 
 * Этот файл содержит стили для футера админ-панели:
 * - Раскладка блока выхода (.footer-logout, form); внешний вид кнопки — styles/buttons.css
 * - Копирайт и информация
 * - Переключатель языков
 * - Toast уведомления
 * 
 * ⚠️ ВАЖНО: Использует CSS переменные из `base-uni.css`.
 * 🤖 Для ИИ-ассистента: хранить здесь только footer/logout/toast ownership;
 *    не выносить page-specific student styles в отдельный `student.css`.
 */

/* ═══════════════════════════════════════════════════════════════════════════════
 * КНОПКА ВЫХОДА
 * ═══════════════════════════════════════════════════════════════════════════════ */

/* По умолчанию справа; на ≤767px mobile.css задаёт text-align: center и form/button на всю ширину */
.footer-logout {
    margin: var(--space-6) 0;
    text-align: right;
}

.footer-logout form {
    display: inline-block;
    margin: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════════
 * КОПИРАЙТ И ИНФОРМАЦИЯ
 * ═══════════════════════════════════════════════════════════════════════════════ */

.footer-copyright {
    text-align: center;
    padding: var(--space-3) 0;
    margin: var(--space-6) 0;
    color: var(--text-dark);
    font-size: var(--text-sm);
    border-top: 1px solid var(--border);
}

.footer-copyright i {
    color: var(--primary);
    margin-right: var(--space-1);
}

.footer-copyright a {
    color: var(--primary);
    text-decoration: none;
    transition: all var(--transition-base);
    margin-left: var(--space-1);
}

.footer-copyright a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.footer-version {
    color: var(--text-light);
    font-size: var(--text-xs);
}

/* Ссылка на политику конфиденциальности */
.footer-privacy-link {
    color: var(--primary);
    text-decoration: none;
    transition: all var(--transition-base);
    font-weight: 500;
}

.footer-privacy-link:hover {
    color: var(--success);
    text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════════════════════════════
 * TOAST КОПИРОВАНИЯ (единый контракт + j-script/ui/copy-text.js)
 *
 * sessionStorage ключ: copyToastModeNext — '1' или '2' = какой вариант показать СЛЕДУЮЩИМ.
 * Атрибут: data-copy-toast-variant="1" | "2" (режим 1 — вход справа, режим 2 — снизу).
 * @keyframes: copy-toast-enter-x | copy-toast-enter-y
 *
 * DOM: #copyNotification.copy-toast | #copy-toast.footer-copy-toast | .toast-notification (динам. Teams)
 * ═══════════════════════════════════════════════════════════════════════════════ */

.footer-copy-toast,
.copy-toast,
.toast-notification {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    left: auto;
    display: none;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    color: var(--text-white);
    line-height: 1.5;
    box-sizing: border-box;
    width: max-content;
    max-width: min(320px, calc(100vw - (2 * var(--space-4))));
    text-align: center;
    white-space: normal;
    word-break: break-word;
    z-index: 10100;
    padding: var(--space-3) var(--space-5);
    gap: var(--space-2);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    font-family: var(--font-primary);
    font-size: var(--text-base);
    opacity: 1;
    pointer-events: none;
    /* ⚠️ min-width в адаптивных: desktop.css / tablet.css / mobile.css / mobile-small.css; *-uni: common-uni */
}

/* Never paint the idle hint bar unless JS adds .show (hover/copy). */
#copy-toast.footer-copy-toast:not(.show),
.footer-copy-toast:not(.show),
.copy-toast:not(.show),
.toast-notification:not(.show) {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.footer-copy-toast,
.copy-toast {
    background: linear-gradient(135deg, var(--success), #059669);
}

.toast-notification.success {
    background: linear-gradient(135deg, var(--success), #059669);
}

.toast-notification.error {
    background: linear-gradient(135deg, #dc3545, #b91c1c);
}

.toast-notification.info {
    background: linear-gradient(135deg, #17a2b8, #0e7490);
}

.toast-notification.warning {
    background: linear-gradient(135deg, #ffc107, #ca8a04);
    color: #212529;
}

/* Режимы появления (ставит JS перед .show) */
.footer-copy-toast[data-copy-toast-variant="1"],
.copy-toast[data-copy-toast-variant="1"],
.toast-notification[data-copy-toast-variant="1"] {
    animation: copy-toast-enter-x 0.3s ease-out;
}

.footer-copy-toast[data-copy-toast-variant="2"],
.copy-toast[data-copy-toast-variant="2"],
.toast-notification[data-copy-toast-variant="2"] {
    animation: copy-toast-enter-y 0.3s ease-out;
}

/* Fallback, если тост показан без JS-атрибута (старый код / порядок скриптов) */
.footer-copy-toast.show:not([data-copy-toast-variant]),
.copy-toast.show:not([data-copy-toast-variant]),
.toast-notification.show:not([data-copy-toast-variant]) {
    animation: copy-toast-enter-x 0.3s ease-out;
}

.footer-copy-toast.show,
.copy-toast.show,
.toast-notification.show,
#copyNotification.copy-toast.show {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: none;
}

.copy-toast.show.hidden,
.copy-toast.hidden.show,
#copyNotification.copy-toast.show {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* admin/curator_list.php: Bootstrap .d-none — .show должен перебить */
#copyNotification.copy-toast.show.d-none {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

@keyframes copy-toast-enter-x {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes copy-toast-enter-y {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
 * ПЕРЕКЛЮЧАТЕЛЬ ЯЗЫКОВ (ТАБЛИЦА)
 * ═══════════════════════════════════════════════════════════════════════════════ */

.footer-lang-table {
    border-collapse: collapse;
    background: none;
    padding: 0;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.footer-lang-cell {
    padding: var(--space-1);
    width: 25%;
    text-align: center;
}

.footer-lang-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    transition: all var(--transition-base);
    border-radius: var(--radius-full);
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* ⚠️ ВАЖНО: Фиксированные размеры (width, height) определены в адаптивных файлах:
     * - desktop.css (≥1024px): 50px
     * - tablet.css (768px-1023px): 45px
     * - mobile.css (≤767px): 40px
     * - mobile-small.css (≤480px): 35px
     */
}

.footer-lang-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    background: rgba(59, 130, 246, 0.1);
    opacity: 0;
    transition: all var(--transition-base);
    z-index: 0;
}

.footer-lang-btn:hover::before {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
}

.footer-lang-btn img {
    width: 100%;
    height: 100%;
    display: block;
    margin: 0;
    object-fit: cover;
    border-radius: var(--radius-full);
    position: relative;
    z-index: 1;
    transition: transform var(--transition-base);
}

.footer-lang-btn:hover img {
    transform: scale(1.1);
}

.footer-lang-btn:focus {
    outline: none;
}

.footer-lang-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.footer-lang-btn:active {
    transform: scale(0.95);
}

.footer-lang-btn:active img {
    transform: scale(1.05);
}

/* Модификатор для флагов без теней */
.footer-lang-no-shadow {
    box-shadow: none !important;
}

.footer-lang-no-shadow,
.footer-lang-no-shadow * {
    box-shadow: none !important;
    filter: none !important;
    border: 0 !important;
}

.footer-lang-no-shadow:hover,
.footer-lang-no-shadow:hover * {
    box-shadow: none !important;
    border: 0 !important;
}

.footer-lang-no-shadow:active,
.footer-lang-no-shadow:active * {
    box-shadow: none !important;
    border: 0 !important;
}

.footer-lang-no-shadow:focus,
.footer-lang-no-shadow:focus * {
    box-shadow: none !important;
    border: 0 !important;
}

.footer-lang-no-shadow.active,
.footer-lang-no-shadow.active * {
    box-shadow: none !important;
    border: 0 !important;
}

/* ⚠️ КАСКАД: mobile.css (загружается ПОСЛЕ) задаёт метрики .footer-lang-btn и
 * переопределяет width/max-width через !important. Здесь только display-переключение
 * и flex-структура для tbody/tr. Конфликт width: 100% устранён → теперь width: auto
 * согласовано с mobile.css (width: auto !important). */
@media (max-width: 767px) {
    .footer-lang-table {
        display: block;
        width: auto;      /* было 100%; mobile.css перебивало через !important → устранён конфликт */
        max-width: none;  /* было 100%; mobile.css перебивало через !important → устранён конфликт */
        margin: 0 auto;
        padding: var(--space-2) 0;
        text-align: center;
    }

    .footer-lang-table tbody,
    .footer-lang-table tr {
        display: inline-flex;
        flex-wrap: nowrap;
        justify-content: center;
        align-items: center;
        gap: 6px;
        width: auto;
        margin: 0 auto;
    }

    .footer-lang-cell {
        display: block;
        width: auto;
        padding: 0;
        text-align: center;
        flex: 0 0 auto;
    }

    .footer-lang-form {
        margin: 0;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
 * СОВРЕМЕННЫЙ ПЕРЕКЛЮЧАТЕЛЬ ЯЗЫКОВ (КАРТОЧКА)
 * ═══════════════════════════════════════════════════════════════════════════════ */

.footer-lang-switcher {
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    margin: var(--space-6) 0;
    border: 1px solid var(--border);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.footer-lang-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: var(--space-4);
    font-size: var(--text-base);
    text-align: center;
    justify-content: center;
}

.footer-lang-title i {
    color: var(--accent-blue);
    font-size: var(--text-xl);
}

.footer-lang-container {
    display: flex;
    justify-content: center;
    gap: var(--space-4);
    flex-wrap: wrap;
    align-items: center;
}

.footer-lang-form {
    margin: 0;
}

/* Стили для современного варианта кнопок флагов */
.footer-lang-switcher .footer-lang-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2);
    background: var(--bg-primary);
    border: 2px solid var(--border);
    border-radius: var(--radius-full);
    position: relative;
    overflow: hidden;
    /* ⚠️ ВАЖНО: Фиксированные размеры (width, height) определены в адаптивных файлах:
     * - desktop.css (≥1024px): 70px
     * - tablet.css (768px-1023px): 65px
     * - mobile.css (≤767px): 60px
     * - mobile-small.css (≤480px): 55px
     */
}

.footer-lang-switcher .footer-lang-btn img {
    border: 2px solid var(--border);
    /* ⚠️ ВАЖНО: Фиксированные размеры (width, height) определены в адаптивных файлах:
     * - desktop.css (≥1024px): 40px
     * - tablet.css (768px-1023px): 36px
     * - mobile.css (≤767px): 32px
     * - mobile-small.css (≤480px): 28px
     */
}

.footer-lang-switcher .footer-lang-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.1), transparent);
    transition: all var(--transition-base);
}

.footer-lang-switcher .footer-lang-btn:hover::before {
    left: 100%;
}

.footer-lang-switcher .footer-lang-btn:hover {
    border-color: var(--accent-blue);
    transform: translateY(-3px) scale(1.05);
    background: linear-gradient(135deg, var(--bg-primary), var(--info-light));
}

.footer-lang-switcher .footer-lang-btn:hover img {
    transform: scale(1.1);
    border-color: var(--accent-blue);
}

.footer-lang-switcher .footer-lang-btn.active {
    border-color: var(--accent-blue);
    background: var(--bg-primary);
    transform: scale(1.05);
}

.footer-lang-switcher .footer-lang-btn.active img {
    border-color: var(--accent-blue);
}

.footer-lang-switcher .footer-lang-btn.active::after {
    content: '✓';
    position: absolute;
    top: -3px;
    right: -3px;
    background: var(--success);
    color: var(--text-white);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: bold;
    border: 2px solid var(--bg-primary);
    /* ⚠️ ВАЖНО: Фиксированные размеры (width, height) определены в адаптивных файлах:
     * - desktop.css (≥1024px): 18px
     * - tablet.css (768px-1023px): 16px
     * - mobile.css (≤767px): 14px
     * - mobile-small.css (≤480px): 12px
     */
}

.footer-lang-switcher .footer-lang-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.footer-lang-switcher .footer-lang-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    border: 2px solid var(--border);
    border-top: 2px solid var(--accent-blue);
    border-radius: var(--radius-full);
    animation: footer-lang-spin 1s linear infinite;
    /* ⚠️ ВАЖНО: Фиксированные размеры (width, height) определены в адаптивных файлах:
     * - desktop.css (≥1024px): 16px
     * - tablet.css (768px-1023px): 14px
     * - mobile.css (≤767px): 12px
     * - mobile-small.css (≤480px): 10px
     */
}

@keyframes footer-lang-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Специальные стили для флагов */
.footer-lang-btn img[alt*="Ukraine"],
.footer-lang-btn img[alt*="Україна"] {
    border: 2px solid #0057B7;
}

.footer-lang-btn img[alt*="Azerbaijan"],
.footer-lang-btn img[alt*="Азербайджан"] {
    border: 2px solid #009639;
}

.footer-lang-btn img[alt*="United Kingdom"],
.footer-lang-btn img[alt*="Великобритания"] {
    border: 2px solid #012169;
}

.footer-lang-btn img[alt*="Russia"],
.footer-lang-btn img[alt*="Россия"] {
    border: 2px solid #0039A6;
}

/* Улучшенные hover эффекты для флагов */
.footer-lang-btn:hover img[alt*="Ukraine"] {
    border-color: #FFD700;
}

.footer-lang-btn:hover img[alt*="Azerbaijan"] {
    border-color: #F00;
}

.footer-lang-btn:hover img[alt*="United Kingdom"] {
    border-color: #C8102E;
}

.footer-lang-btn:hover img[alt*="Russia"] {
    border-color: #FFF;
}

