/* ===== KTG1 SHARED LAYOUT ===== */
/* Общие стили шапки и подвала. Подключаются на каждой странице ktg1.ru. */

:root {
    --ktg1-color-black: #0a0a0a;
    --ktg1-color-dark: #1a1a1a;
    --ktg1-color-gray: #2a2a2a;
    --ktg1-color-light-gray: #888;
    --ktg1-color-white: #ffffff;
    --ktg1-color-accent: #CE7762;
    --ktg1-max-width: 1200px;
}

/* Scoped vars: our header/footer/modal стили используют var(--color-*).
 * На страницах с собственным :root (главная ktg1.ru) этих переменных
 * нет → значения undefined → прозрачные элементы. Перекрываем тут. */
.ktg1-header,
.ktg1-footer,
.ktg1-auth,
.ktg1-auth-toast {
    --color-black: #0a0a0a;
    --color-dark: #1a1a1a;
    --color-text: #2a2a2a;
    --color-muted: #6a6a6a;
    --color-border: #e5e5e5;
    --color-bg: #fafafa;
    --color-white: #ffffff;
    --color-accent: #CE7762;
}

/* ===== HEADER ===== */
.ktg1-header {
    background: var(--ktg1-color-black);
    color: var(--ktg1-color-white);
    position: sticky;
    top: 0;
    z-index: 1000;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.ktg1-header *,
.ktg1-header *::before,
.ktg1-header *::after {
    box-sizing: border-box;
}

.ktg1-header__container {
    max-width: var(--ktg1-max-width);
    margin: 0 auto;
    padding: 0 24px;
}

.ktg1-header__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 0;
}

.ktg1-header__logo-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.ktg1-header__logo-img {
    height: 40px;
    width: auto;
}

.ktg1-header__logo-text {
    font-size: 26px;
    font-weight: 700;
    color: var(--ktg1-color-accent);
}

.ktg1-header__nav {
    display: flex;
    gap: 32px;
}

.ktg1-header__nav a {
    color: var(--ktg1-color-white);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: color 0.2s;
    position: relative;
}

.ktg1-header__nav a:hover {
    color: var(--ktg1-color-accent);
}

.ktg1-header__nav a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--ktg1-color-accent);
    transition: width 0.2s;
}

.ktg1-header__nav a:hover::after {
    width: 100%;
}

.ktg1-header__nav a.ktg1-header__nav-accent {
    color: var(--ktg1-color-accent);
}

.ktg1-header__nav a.ktg1-header__nav-accent:hover {
    color: var(--ktg1-color-white);
}

.ktg1-header__tg {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--ktg1-color-accent);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.ktg1-header__tg:hover {
    color: var(--ktg1-color-white);
}

.ktg1-header__tg svg {
    flex-shrink: 0;
}

/* ===== FOOTER ===== */
.ktg1-footer {
    background: var(--ktg1-color-black);
    color: var(--ktg1-color-white);
    padding: 60px 0 30px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.ktg1-footer *,
.ktg1-footer *::before,
.ktg1-footer *::after {
    box-sizing: border-box;
}

.ktg1-footer__container {
    max-width: var(--ktg1-max-width);
    margin: 0 auto;
    padding: 0 24px;
}

.ktg1-footer__content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 60px;
    margin-bottom: 40px;
}

.ktg1-footer__brand {
    color: var(--ktg1-color-accent);
}

.ktg1-footer__about h4 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.ktg1-footer__about p {
    font-size: 14px;
    color: var(--ktg1-color-light-gray);
    line-height: 1.7;
}

.ktg1-footer__links h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.ktg1-footer__links ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ktg1-footer__links li {
    margin-bottom: 10px;
}

.ktg1-footer__links a {
    color: var(--ktg1-color-light-gray);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.ktg1-footer__links a:hover {
    color: var(--ktg1-color-accent);
}

.ktg1-footer__highlight {
    display: inline-block;
    background: var(--ktg1-color-accent);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    margin-top: 8px;
}

.ktg1-footer__bottom {
    border-top: 1px solid var(--ktg1-color-gray);
    padding-top: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: var(--ktg1-color-light-gray);
}

.ktg1-footer__bottom a {
    color: var(--ktg1-color-accent);
    text-decoration: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 968px) {
    .ktg1-footer__content {
        grid-template-columns: 1fr;
        gap: 40px;
    }
}

@media (max-width: 640px) {
    .ktg1-header__tg-text { display: none; }

    .ktg1-footer__bottom {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}

/* ===== HEADER: HAMBURGER + MENU ===== */

.ktg1-header {
    position: relative;
}

.ktg1-header__actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Auth icon */
.ktg1-header__auth {
    display: inline-flex;
    align-items: center;
    color: var(--color-text);
    padding: 6px;
    border-radius: 50%;
    transition: color 0.2s;
}
.ktg1-header__auth:hover { color: var(--color-accent); text-decoration: none; }
.ktg1-header__auth--active { color: #3bb554; }
.ktg1-header__auth--active:hover { color: #2ea045; }

/* Hamburger button */
.ktg1-header__hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    width: 36px;
    height: 36px;
    border-radius: 6px;
}
.ktg1-header__hamburger:hover { background: var(--color-bg); }
.ktg1-header__hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--color-text);
    transition: transform 0.25s ease, opacity 0.25s ease;
    transform-origin: center;
}
.ktg1-header__hamburger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.ktg1-header__hamburger.is-open span:nth-child(2) { opacity: 0; }
.ktg1-header__hamburger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Dropdown menu */
.ktg1-header__menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--color-white);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 8px 32px rgba(0,0,0,0.10);
    z-index: 200;
}
.ktg1-header__menu.is-open { display: block; }
.ktg1-header__menu-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 8px 20px 16px;
}
.ktg1-header__menu a {
    display: block;
    padding: 10px 0;
    color: var(--color-text);
    font-weight: 500;
    border-bottom: 1px solid var(--color-border);
    text-decoration: none;
}
.ktg1-header__menu a:last-child { border-bottom: none; }
.ktg1-header__menu a:hover { color: var(--color-accent); }
.ktg1-header__menu-divider {
    border: none;
    margin: 4px 0;
    height: 0;
}

/* ===== FOOTER: PRIVACY POLICY LINK ===== */

.ktg1-footer__privacy {
    color: #888;
    font-size: 13px;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.ktg1-footer__privacy:hover { color: #cfcfcf; }

/* ===== AUTH MODAL ===== */

.ktg1-auth { display: none; }
.ktg1-auth.is-open { display: block; }
.ktg1-auth__backdrop {
    position: fixed; inset: 0;
    background: rgba(10,10,10,0.55);
    z-index: 1000;
}
.ktg1-auth__window {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    width: calc(100% - 40px);
    max-width: 420px;
    padding: 28px 24px 24px;
    z-index: 1001;
    color: #2a2a2a;
}
.ktg1-auth__close {
    position: absolute; top: 8px; right: 12px;
    background: none; border: none;
    font-size: 28px; line-height: 1; cursor: pointer;
    color: #999;
    padding: 4px 10px;
}
.ktg1-auth__close:hover { color: #333; }
.ktg1-auth__title {
    font-size: 20px; font-weight: 700;
    margin-bottom: 18px;
    color: #0a0a0a;
}
.ktg1-auth__view { display: flex; flex-direction: column; gap: 12px; }
.ktg1-auth__view[hidden] { display: none; }
.ktg1-auth__label {
    display: flex; flex-direction: column; gap: 6px;
    font-size: 13px; color: #6a6a6a; font-weight: 500;
}
.ktg1-auth__input {
    padding: 11px 14px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    font: inherit;
    font-size: 16px;
    color: #2a2a2a;
    background: #fff;
}
.ktg1-auth__input:focus {
    outline: 2px solid #CE7762;
    outline-offset: -1px;
}
.ktg1-auth__input--code {
    letter-spacing: 8px;
    text-align: center;
    font-size: 22px;
    font-weight: 600;
}
.ktg1-auth__check {
    display: flex; gap: 8px; align-items: flex-start;
    font-size: 13px; color: #555;
    cursor: pointer;
    line-height: 1.4;
}
.ktg1-auth__check input { margin-top: 3px; flex-shrink: 0; }
.ktg1-auth__check a { color: #CE7762; }
.ktg1-auth__error {
    color: #9a1f1f;
    font-size: 13px;
    min-height: 16px;
}
.ktg1-auth__btn {
    padding: 12px 18px;
    background: #CE7762;
    color: #fff;
    border: none;
    border-radius: 8px;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.ktg1-auth__btn:hover:not(:disabled) { filter: brightness(0.95); }
.ktg1-auth__btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ktg1-auth__callnum {
    font-size: 26px;
    font-weight: 700;
    text-align: center;
    color: #0a0a0a;
    padding: 14px 0;
    letter-spacing: 1px;
}
.ktg1-auth__hint { font-size: 13px; color: #6a6a6a; }
.ktg1-auth__status {
    text-align: center;
    font-weight: 500;
    color: #1e3a8a;
    background: #eef4ff;
    padding: 10px;
    border-radius: 8px;
}
.ktg1-auth__fallback {
    text-align: center;
    font-size: 14px;
    color: #6a6a6a;
    margin-top: 4px;
}
.ktg1-auth__fallback a { color: #CE7762; }
.ktg1-auth__optional {
    color: #aaa;
    font-weight: 400;
}

/* ===== AUTH WELCOME TOAST ===== */
.ktg1-auth-toast {
    position: fixed;
    top: 24px; right: 24px;
    background: #3bb554;
    color: #fff;
    padding: 12px 18px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    font-weight: 500;
    z-index: 1100;
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity 0.25s, transform 0.25s;
}
.ktg1-auth-toast.is-show { opacity: 1; transform: translateY(0); }
@media (max-width: 640px) {
    .ktg1-auth-toast { left: 16px; right: 16px; top: 12px; text-align: center; }
}
