@import url('shared_tokens.css');


body { 
    font-family: 'Inter', system-ui, sans-serif; 
    background: var(--bg); 
    color: var(--text); 
    margin: 0; 
    padding-top: 80px; /* Отступ от хедера */
    display: block;    /* Убираем flex */
    min-height: 100vh; 
    text-align: center; /* Центрируем содержимое горизонтально */
}

.reg-card {
    display: inline-block; /* Позволяет центрировать карточку через text-align: center родителя */
    vertical-align: top;
    background: var(--card); 
    padding: 20px; 
    border-radius: 16px; 
    width: 90%; 
    max-width: 450px; 
    border: 1px solid var(--border);
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    margin-top: 40px; 
    text-align: left; /* Возвращаем текст влево внутри карточки */
}

/* Каркас: flex-колонка на весь экран */
.auth-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Минимальная высота - весь экран */
}

/* Контентная часть "выталкивает" футер вниз */
.content {
    flex: 1; /* ВАЖНО: растягивается, заполняя всё пространство */
    display: flex;
    justify-content: center;
    align-items: flex-start; 
}

/* --- 2. Gate Header --- */
.gate-header {
    position: fixed; top: 0; left: 0; width: 100%; z-index: 1000;
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    display: flex; justify-content: center;
}

.header-container {
    display: grid; grid-template-columns: 1fr 1fr 1fr;
    width: 100%; max-width: 1100px; padding: 0 40px; align-items: center; box-sizing: border-box;
}

.logo { font-weight: 800; font-size: 16px; letter-spacing: 2px; color: var(--accent); text-transform: uppercase; }
.logo a { 
    text-decoration: none; 
    color: inherit; 
    cursor: pointer; 
}

.logo a:hover, 
.logo a:active, 
.logo a:focus { 
    text-decoration: none; 
    color: var(--accent); /* Фиксируем цвет accent, чтобы он не менялся */
}

.grid-cell { display: flex; align-items: center; }
.logo-cell { justify-content: start; }
.lang-cell { justify-content: end; }

h2 { text-align: center; margin-bottom: 25px; font-weight: 500; color: var(--accent); }

.form-group { margin-bottom: 20px; text-align: left; }
label { display: block; margin-bottom: 8px; font-size: 11px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; }

.form-control { 
    width: 100%; padding: 12px; border: 1px solid var(--border); 
    background: rgba(0,0,0,0.3); border-radius: 10px; color: white; 
    font-size: 16px; outline: none; box-sizing: border-box; 
}
.form-control:focus { border-color: var(--accent); }

/* --- 4. Passport & Buttons --- */
.passport-area {
    border: 1px dashed var(--accent);
    padding: 15px; border-radius: 8px;
    margin-bottom: 15px; display: flex; flex-direction: column; gap: 8px;
}
.passport-label { color: var(--text-dim); font-size: 11px; text-transform: uppercase; }
.passport-value { font-family: monospace; font-size: 16px; color: #fff; }

.btn-reg { 
    width: auto !important;
    font-weight: bold; 
    cursor: pointer; 
    margin-top: 10px; 
    font-size: 16px;
    background: var(--accent); 
    color: var(--bg);
    min-width: 300px;
    max-width: 450px;
    padding: 12px 40px !important;
    margin: 20px auto 0 auto;
    display: block;
    
    /* Возвращаем скругление углов */
    border-radius: 8px; 
    
    /* Дополнительно для идеального центрирования текста */
    text-align: center;
    border: none; /* Убедимся, что нет стандартной рамки */
}

/* Состояние кнопки, когда она заблокирована */
.btn-reg:disabled {
    background: #64748b !important; /* Серый цвет для неактивного состояния */
    cursor: not-allowed;
    opacity: 0.6;
}

/* Эффект при наведении на заблокированную кнопку */
.btn-reg:disabled:hover {
    background: #64748b;
}

.notice-box { font-size: 16px; color: var(--text-dim); text-align: center; margin: 15px 0; font-style: bold; }
.disclaimer-box { font-size: 16px; color: #ffffff; line-height: 1.4; text-align: center; }

.lang-selector {
    background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border);
    color: var(--accent); padding: 8px 16px; border-radius: 6px; cursor: pointer;
}

.reg-link { 
    margin-top: 25px; font-size: 14px; color: var(--text-dim); text-align: center; 
}
.reg-link a { 
    color: var(--accent); text-decoration: none; font-weight: 600; 
}
.reg-link a:hover { text-decoration: underline; }

/* Кнопка генерации пароля */
.btn-gen {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: 10px;
    padding: 0 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-gen:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(56, 189, 248, 0.1);
}

/* Добавьте в pre_auth.css */
.btn-gen i {
    pointer-events: none;
}

.content-text {
    margin-bottom: 20px;
    line-height: 1.6;
}

.content-image {
    text-align: center;
    margin: 30px 0;
}

.content-image img {
    max-width: 100%;       /* Картинка не вылезет за границы .content-box */
    height: auto;
    border-radius: 8px;    /* Единый стиль для всех иллюстраций */
}

/* --- Стили для pre_reg.php --- */

.content-box {
    width: 90%;
    max-width: 1100px;
    background: #ffffff !important;
    color: var(--card);
    border-radius: 16px;
    padding: 40px;
    margin: 40px auto;
    
    /* АГРЕССИВНЫЙ ТЕСТ: если это не увидите, значит CSS не подключен */
    border: 5px solid #ff00ff !important; 
    box-shadow: 0 0 100px 20px rgba(56, 189, 248, 0.8) !important;
}

.checkbox-area {
    margin: 0 auto 40px auto;
    text-align: center;
    color: var(--text);
    max-width: 500px; /* Чтобы кнопка не растягивалась на всю ширину страницы */
    padding: 0 20px;
}

/* Выравнивание чекбокса и текста в одну линию */
.checkbox-area label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    text-transform: none; /* Убираем верхний регистр для текста согласия */
    font-size: 14px;
    color: var(--text);
}

.checkbox-area input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Кнопка регистрации (фиксируем размер) */
#btn-next {
    margin-top: 20px;
    max-width: 450px; /* Чтобы кнопка была гармоничной */
}

/* Базовая структура каркаса - ОДИН РАЗ */
.auth-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.spacer { height: 80px; flex-shrink: width: 100%; }

.content {
    flex: 1;
    /* Вместо center (который центрирует блок по высоте) используем flex-start */
    align-items: center; 
    align-items: stretch; /* Растягивает контейнер, позволяя блоку начинаться сверху */
    padding-top: 20px;    /* Дополнительный отступ, если нужен */
}

/* --- FOOTER (Синхронизировано с публичной частью) --- */
.aspat-footer {
    width: 100%;
    text-align: center;
    padding: 40px 0;               /* Унифицированный отступ, как на главной */
    color: var(--text-dim);        /* Подключение к системному токену вместо жесткого #475569 */
    font-size: 9px;                /* Мелкий системный шрифт */
    letter-spacing: 1.5px;         /* Разрядка для читаемости верхнего регистра */
    text-transform: uppercase;     /* Строгий формат (ASPAT SINCE...) */
    flex-shrink: 0;                /* Защита от сжатия во flex-контейнерах */
}

body .reg-card {
    padding: 20px !important;
    margin-top: 20px !important;
}

body .reg-card .form-group {
    margin-bottom: 12px !important;
}

body .reg-card .form-control {
    padding: 8px 12px !important;
    font-size: 14px !important;
}

body .reg-card h2 {
    margin-bottom: 15px !important;
}

body .reg-card .btn-reg {
    margin-top: 10px !important;
    padding: 10px 20px !important;
    min-width: 250px !important;
}

/* ПРИНУДИТЕЛЬНОЕ СЖАТИЕ */

/* 1. Убираем flex-растяжение у карточки, если оно есть */
body .reg-card {
    display: inline-block !important; /* Убираем блочное поведение */
    height: auto !important;          /* Высота строго по контенту */
    min-height: auto !important;      /* Никаких минимальных высот */
    padding-bottom: 10px !important;  /* Минимальный отступ снизу */
}

/* 2. Убираем любые отступы у формы внутри карточки */
body .reg-card form {
    margin: 0 !important;
    padding: 0 !important;
}

/* 3. Очищаем область под кнопкой */
body .reg-card .btn-reg {
    margin-top: 10px !important;
    margin-bottom: 10px !important; /* Делаем отступ от кнопки до низа карточки минимальным */
}

/* 4. Если есть блок reg-link (ссылка "Регистрация"), придвигаем его к кнопке */
body .reg-card .reg-link {
    margin-top: 5px !important;
    margin-bottom: 5px !important;
}

/* Финальная очистка структуры */
.auth-layout {
    min-height: auto !important; /* Убираем растяжение на весь экран */
    display: block !important;    /* Убираем flex, чтобы элементы не разлетались */
}

.content {
    flex: none !important;        /* Отключаем растяжение */
    display: block !important;    /* Убираем flex-центрирование */
    padding-top: 20px !important;
}

/* Принудительное удаление отступов у родителя карточки */
body {
    padding-top: 40px !important; /* Немного приподнимаем форму к верху */
    min-height: auto !important;
}

/* =========================================================
   ASPAT GATEWAY: Оптимизированная адаптация кнопок
   ========================================================= */

.btn-group {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 15px !important;
    width: 100%;
    margin-top: 20px;
}

.btn-group .btn-reg {
    flex: 1 1 150px !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 14px 15px !important;
    white-space: normal !important;
    line-height: 1.2 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

@media (max-width: 500px) {
    .btn-group {
        flex-direction: column; 
        gap: 10px !important;   
    }
    
    .btn-group .btn-reg {
        flex: none !important; 
        width: 100% !important;
        padding: 12px 15px !important;
    }
}