/* =========================================
   Ютроникс — Единая дизайн-система (MVP)
   ========================================= */

/* 1. Сброс и базовые настройки */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f7fa;
    color: #1a202c;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

/* 2. Шапка и Логотип (по центру) */
.header {
    background: #ffffff;
    border-bottom: 1px solid #e1e5eb;
    padding: 24px 20px;
    text-align: center;
    position: relative;
}

.logo-link {
    display: inline-block;
}

.logo-img {
    height: 60px;
    width: auto;
    display: block;
    margin: 0 auto;
}

/* Контейнер для имени и кнопки выхода */
.user-actions {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-name {
    color: #4a5568;
    font-size: 14px;
}

/* 3. Основной контент */
.main-content {
    flex: 1;
    padding: 40px 20px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* 4. Карточки и контейнеры */
.card {
    background: #ffffff;
    border: 1px solid #e1e5eb;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    padding: 32px;
    margin-bottom: 24px;
}

.card h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 8px;
}

.subtitle {
    color: #718096;
    font-size: 15px;
    margin-bottom: 24px;
}

/* 5. Кнопки */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 24px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-align: center;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: #fc3f1d;
    color: #ffffff;
}
.btn-primary:hover { background: #e63517; }

.btn-secondary {
    background: #4a5568;
    color: #ffffff;
}
.btn-secondary:hover { background: #2d3748; }

.btn-outline {
    background: transparent;
    border: 1px solid #e1e5eb;
    color: #4a5568;
}
.btn-outline:hover {
    border-color: #4a5568;
    color: #1a202c;
}

/* 6. Формы */
.form-group {
    margin-bottom: 16px;
}
.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
    color: #1a202c;
}
.form-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e1e5eb;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.2s;
}
.form-input:focus {
    outline: none;
    border-color: #4c6ef5;
    box-shadow: 0 0 0 3px rgba(76, 110, 245, 0.1);
}

/* 7. Футер (единый для всех страниц) */
.footer {
    background: #ffffff;
    border-top: 1px solid #e1e5eb;
    padding: 32px 20px;
    text-align: center;
    margin-top: auto;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.footer-links a {
    color: #718096;
    font-size: 14px;
}

.footer-links a:hover {
    color: #4c6ef5;
    text-decoration: underline;
}

.footer-copy {
    color: #a0aec0;
    font-size: 13px;
}

/* 8. Утилиты для продукта "Дело" */
.watermark-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-30deg);
    font-size: 72px;
    font-weight: 900;
    color: rgba(252, 63, 29, 0.08);
    pointer-events: none;
    z-index: 9999;
    white-space: nowrap;
    user-select: none;
}

.alert-info {
    background: #ebf8ff;
    border: 1px solid #bee3f8;
    color: #2b6cb0;
    padding: 16px;
    border-radius: 10px;
    margin-bottom: 24px;
    font-size: 14px;
}

/* === COOKIE-БАННЕР === */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1a202c;
    color: white;
    padding: 20px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    z-index: 10000;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.cookie-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.cookie-banner-text {
    flex: 1;
    min-width: 300px;
}

.cookie-banner-text strong {
    display: block;
    margin-bottom: 8px;
    font-size: 16px;
}

.cookie-banner-text p {
    margin: 0;
    font-size: 14px;
    color: #e2e8f0;
    line-height: 1.5;
}

.cookie-banner-text a {
    color: #fc3f1d;
    text-decoration: underline;
}

.cookie-banner-buttons {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.cookie-banner .btn {
    padding: 10px 20px;
    font-size: 14px;
}

/* === BETA-ЗНАЧОК === */
.beta-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: linear-gradient(135deg, #fc3f1d 0%, #e63517 100%);
    color: white;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-radius: 12px;
    margin-left: 12px;
    vertical-align: middle;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(252, 63, 29, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.beta-badge:hover {
    background: linear-gradient(135deg, #e63517 0%, #c92a12 100%);
    cursor: help;
}

/* === ССЫЛКА "НАЗАД" === */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #718096;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    margin-bottom: 16px;
    transition: all 0.2s;
}

.back-link:hover {
    color: #4c6ef5;
    transform: translateX(-2px);
}

.back-link svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s;
}

.back-link:hover svg {
    transform: translateX(-2px);
}

/* === СТРАНИЦА АВТОРИЗАЦИИ === */
.login-card {
    background: white;
    border: 1px solid #e1e5eb;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    padding: 40px;
    width: 100%;
    max-width: 440px;
    text-align: center;
    margin: 0 auto;
}

.login-card h1 {
    font-size: 28px;
    color: #1a202c;
    margin-bottom: 8px;
}

.login-card .subtitle {
    color: #718096;
    font-size: 15px;
    margin-bottom: 32px;
}

.oauth-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.btn-oauth {
    display: block;
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: white;
    text-align: center;
}

.btn-oauth:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-yandex { background: #fc3f1d; }
.btn-yandex:hover { background: #e63517; }

.btn-vk { background: #0077ff; }
.btn-vk:hover { background: #0066dd; }

.divider {
    position: relative;
    margin: 24px 0;
    text-align: center;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e1e5eb;
}

.divider span {
    position: relative;
    background: white;
    padding: 0 16px;
    color: #718096;
    font-size: 14px;
}

.email-form { text-align: left; }

.spam-hint {
    margin: 12px 0 0 0;
    color: #718096;
    font-size: 13px;
    text-align: center;
}

/* =========================================
   АДАПТИВНЫЕ СТИЛИ (МОБИЛЬНАЯ ВЕРСИЯ)
   ========================================= */

@media (max-width: 768px) {
    /* Шапка на мобильных — переопределяем инлайновые стили! */
    .header {
        padding: 16px 12px !important;
        position: relative !important;
    }
    
    .logo-img {
        height: 48px !important;
    }
    
    .beta-badge {
        font-size: 9px !important;
        padding: 3px 8px !important;
        margin-left: 8px !important;
    }
    
    /*  ГЛАВНОЕ ИСПРАВЛЕНИЕ: Блок с именем и кнопкой — под логотипом */
    .header > div[style*="position: absolute"] {
        position: static !important;
        transform: none !important;
        flex-direction: column !important;
        gap: 8px !important;
        margin-top: 12px !important;
        width: 100% !important;
        right: auto !important;
        top: auto !important;
    }
    
    .header > div[style*="position: absolute"] > span {
        font-size: 13px !important;
        order: 1 !important;
    }
    
    .header > div[style*="position: absolute"] > .btn-outline {
        padding: 8px 16px !important;
        font-size: 13px !important;
        order: 2 !important;
        width: 100% !important;
        max-width: 200px !important;
        margin: 0 auto !important;
    }
    
    /* Основной контент */
    .main-content {
        padding: 24px 16px !important;
    }
    
    /* Карточки */
    .card {
        padding: 24px 20px !important;
    }
    
    .card h1 {
        font-size: 24px !important;
    }
    
    /* Кнопки */
    .btn {
        padding: 12px 20px !important;
        font-size: 14px !important;
        width: 100% !important;
    }
    
    /* Футер */
    .footer {
        padding: 24px 16px !important;
    }
    
    .footer-links {
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    /* Cookie-баннер */
    .cookie-banner {
        padding: 16px 12px !important;
    }
    
    .cookie-banner-content {
        flex-direction: column !important;
        text-align: center !important;
    }
    
    .cookie-banner-text {
        min-width: auto !important;
        width: 100% !important;
    }
    
    .cookie-banner-buttons {
        width: 100% !important;
        justify-content: center !important;
    }
    
    /* Водяной знак */
    .watermark-overlay {
        font-size: 36px !important;
    }
}

/* Очень маленькие экраны (до 480px) */
@media (max-width: 480px) {
    .header {
        padding: 12px 8px !important;
    }
    
    .logo-img {
        height: 40px !important;
    }
    
    .main-content {
        padding: 16px 12px !important;
    }
    
    .card {
        padding: 20px 16px !important;
    }
    
    .login-card {
        padding: 24px 16px !important;
    }
    
    .login-card h1 {
        font-size: 22px !important;
    }
}