/**
 * Стили для кастомной страницы входа
 * @package    local_customlogin
 * @copyright  2026 saturneg <saturn.ilya@gmail.com>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */

:root {
    --cl-header-height: 82px;
    --cl-footer-height: 48px;
}

/* =====================================================================
   Все правила строго привязаны к body#page-local-customlogin-index,
   чтобы ничего не «утекало» на остальные страницы сайта.
   ===================================================================== */

/* ===== Снимаем белый фон со всех обёрток темы — только на нашей странице ===== */
body#page-local-customlogin-index,
body#page-local-customlogin-index #page-wrapper,
body#page-local-customlogin-index #page,
body#page-local-customlogin-index #page-content,
body#page-local-customlogin-index #region-main-box,
body#page-local-customlogin-index #region-main,
body#page-local-customlogin-index #region-main .main-inner,
body#page-local-customlogin-index #page.drawers,
body#page-local-customlogin-index #page.drawers .main-inner,
body#page-local-customlogin-index .pagelayout-login,
body#page-local-customlogin-index .pagelayout-login #page {
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
    border: 0 !important;
}

/* ===== Прячем стандартную шапку/подвал Moodle — только здесь ===== */
body#page-local-customlogin-index #page-header,
body#page-local-customlogin-index header.navbar,
body#page-local-customlogin-index .navbar,
body#page-local-customlogin-index .logo,
body#page-local-customlogin-index .navbar-brand,
body#page-local-customlogin-index #page-footer {
    display: none !important;
}

/* ===== Убираем отступы у обёрток ===== */
body#page-local-customlogin-index #page,
body#page-local-customlogin-index #page-content,
body#page-local-customlogin-index #region-main {
    padding: 0 !important;
    margin: 0 !important;
    min-height: 0 !important;
    height: auto !important;
}

/* =====================================================================
   Убираем двухколоночную раскладку темы Boost на странице логина.
   Левая панель .login-layout-left перекрывала наш фон своим фоном.
   ===================================================================== */

/* Левая «маркетинговая» панель темы — убираем совсем */
body#page-local-customlogin-index .login-layout-left,
body#page-local-customlogin-index aside.login-layout-left {
    display: none !important;
    background: transparent !important;
    background-image: none !important;
    width: 0 !important;
    flex: 0 0 0 !important;
    max-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Правая колонка — на всю ширину, без своих фонов и отступов */
body#page-local-customlogin-index .login-layout-right,
body#page-local-customlogin-index #region-main.login-layout-right {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    border: 0 !important;
}

body#page-local-customlogin-index .login-layout-right-content,
body#page-local-customlogin-index .login-container,
body#page-local-customlogin-index .login-container .loginform,
body#page-local-customlogin-index .login-container #maincontent,
body#page-local-customlogin-index .login-container [role="main"] {
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    border: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
}

/* Сетка темы */
body#page-local-customlogin-index #page-content.row,
body#page-local-customlogin-index #page-content {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
}

/* ===== Фон страницы через псевдоэлемент ===== */
body#page-local-customlogin-index {
    overflow: hidden;
}

body#page-local-customlogin-index::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
}

body#page-local-customlogin-index.cl-bg-morning::before {
    background-image: url('/local/customlogin/pix/morning.jpg');
}
body#page-local-customlogin-index.cl-bg-afternoon::before {
    background-image: url('/local/customlogin/pix/afternoon.jpg');
}
body#page-local-customlogin-index.cl-bg-evening::before {
    background-image: url('/local/customlogin/pix/evening.jpg');
}
body#page-local-customlogin-index.cl-bg-night::before {
    background-image: url('/local/customlogin/pix/night.jpg');
}

/* =====================================================================
   ЦЕНТРАЛЬНЫЙ КОНТЕЙНЕР
   Занимает всю область между шапкой и футером.
   OAuth2 и аккордеон лежат внутри и центрируются вместе.
   При нехватке высоты — вертикальный скролл, верх не обрезается.
   ===================================================================== */
body#page-local-customlogin-index #cl-login-container {
    position: fixed;
    top: var(--cl-header-height);
    left: 0;
    right: 0;
    bottom: var(--cl-footer-height);
    z-index: 10;

    display: flex;
    flex-direction: column;
    align-items: center;

    gap: 15px;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
}

/*
 * Приём «safe centering»:
 *   — margin-top: auto у первого ребёнка толкает вниз,
 *   — margin-bottom: auto у последнего — вверх.
 * Когда высоты хватает — блок центрируется.
 * Когда не хватает — auto-маргиналы схлопываются в 0, и скролл
 * идёт с самого верха, ничего не обрезается.
 */
body#page-local-customlogin-index #cl-login-container > *:first-child {
    margin-top: auto;
}
body#page-local-customlogin-index #cl-login-container > *:last-child {
    margin-bottom: auto;
}

/* =====================================================================
   КАРТОЧКА OAuth2 (основной способ входа — сверху)
   ===================================================================== */
body#page-local-customlogin-index #oauth2-buttons {
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
    flex: 0 0 auto;

    background: rgba(255, 255, 255, 0.9);
    padding: 22px 25px 25px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(4px);
    text-align: center;
}

/* Заголовок «Войти через» */
body#page-local-customlogin-index #oauth2-buttons .oauth2-title {
    font-size: 1em;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    letter-spacing: 0.3px;
}

/* Кнопка OAuth2 — основная, акцентная */
body#page-local-customlogin-index #oauth2-buttons .oauth2-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-bottom: 10px;
    padding: 12px 15px;
    background-color: #0f6cbf;
    border: 1px solid #0f6cbf;
    border-radius: 6px;
    color: #fff;
    font-size: 1em;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

body#page-local-customlogin-index #oauth2-buttons .oauth2-login-btn:last-child {
    margin-bottom: 0;
}

body#page-local-customlogin-index #oauth2-buttons .oauth2-login-btn:hover {
    background-color: #0a4f8c;
    border-color: #0a4f8c;
    color: #fff;
    text-decoration: none;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
}

/* =====================================================================
   АККОРДЕОН С ФОРМОЙ ЛОГИН/ПАРОЛЬ
   ===================================================================== */
body#page-local-customlogin-index #cl-manual-login {
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
    flex: 0 0 auto;

    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(4px);
    overflow: hidden;
}

body#page-local-customlogin-index #cl-manual-login > summary.cl-accordion-summary {
    list-style: none;
    cursor: pointer;
    padding: 16px 22px;
    font-size: 0.95em;
    font-weight: 500;
    color: #0f6cbf;
    text-align: center;
    user-select: none;
    position: relative;
    transition: background-color 0.2s ease;
}

body#page-local-customlogin-index #cl-manual-login > summary.cl-accordion-summary::-webkit-details-marker {
    display: none;
}

body#page-local-customlogin-index #cl-manual-login > summary.cl-accordion-summary::after {
    content: "▾";
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9em;
    color: #0f6cbf;
    transition: transform 0.25s ease;
}

body#page-local-customlogin-index #cl-manual-login[open] > summary.cl-accordion-summary::after {
    transform: translateY(-50%) rotate(180deg);
}

body#page-local-customlogin-index #cl-manual-login > summary.cl-accordion-summary:hover {
    background-color: rgba(15, 108, 191, 0.06);
}

/* Форма внутри аккордеона — без отдельной «карточки» */
body#page-local-customlogin-index #cl-manual-login #loginform {
    width: auto;
    max-width: none;
    margin: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    border-radius: 0;
    padding: 0 25px 25px;
}

/* =====================================================================
   НАША ШАПКА
   ===================================================================== */
body#page-local-customlogin-index #custom-header-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 12px 20px;
    z-index: 1000;
    backdrop-filter: blur(6px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    box-sizing: border-box;
}

body#page-local-customlogin-index #custom-header-bar .header-left  { flex: 0 0 auto; order: 1; }
body#page-local-customlogin-index #custom-header-bar .header-right { flex: 0 0 auto; order: 3; }

body#page-local-customlogin-index #custom-header-bar .header-center {
    flex: 1;
    order: 2;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    line-height: 1.25;
}

body#page-local-customlogin-index #custom-header-bar .header-title {
    font-size: 1.4em;
    font-weight: bold;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

body#page-local-customlogin-index #custom-header-bar .header-greeting {
    font-size: 1em;
    font-weight: normal;
    opacity: 0.9;
    margin-top: 2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    min-height: 1.2em;
}

/* Языковое меню */
body#page-local-customlogin-index #custom-header-bar .lang-selector select,
body#page-local-customlogin-index #custom-footer-bar .lang-selector select {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
}
body#page-local-customlogin-index #custom-header-bar .lang-selector select:hover,
body#page-local-customlogin-index #custom-footer-bar .lang-selector select:hover {
    background: rgba(255, 255, 255, 0.25);
}
body#page-local-customlogin-index #custom-header-bar .lang-selector select option,
body#page-local-customlogin-index #custom-footer-bar .lang-selector select option {
    background: #333;
    color: #fff;
}

/* =====================================================================
   НИЖНИЙ БАР
   ===================================================================== */
body#page-local-customlogin-index #custom-footer-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 10px 20px;
    text-align: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    box-sizing: border-box;
}

/* =====================================================================
   ЭЛЕМЕНТЫ ФОРМЫ
   ===================================================================== */
body#page-local-customlogin-index #loginbtn {
    display: block;
    margin: 20px auto 0;
}

/* Чекбокс «Запомнить имя пользователя» */
body#page-local-customlogin-index #loginform .remember-item {
    margin-top: 14px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
}

body#page-local-customlogin-index #loginform .remember-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    margin: 0;
    font-size: 0.95em;
    color: #333;
    font-weight: normal;
}

body#page-local-customlogin-index #loginform .remember-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    accent-color: #0f6cbf;
    flex: 0 0 auto;
    vertical-align: middle;
}

/* Метки полей */
body#page-local-customlogin-index #loginform label.fitem {
    display: block;
    margin-top: 10px;
    margin-bottom: 4px;
    font-weight: 500;
    color: #333;
}