/* ===== CSS VARIABLES ===== */
:root {
    /* Основные оттенки зелёного */
    --green-primary: #2e7d32;
    --green-primary-dark: #1b5e20;
    --green-primary-light: #4caf50;
    --green-accent: #66bb6a;
    --green-light: #c8e6c9;
    --green-bg-light: #f1f8e9;
    
    /* Оранжевый акцент (для совместимости) */
    --orange-accent: #ff6b35;
    --orange-light: #ff8c5a;
    
    /* Нейтральные цвета */
    --gray-dark: #1e2b3c;
    --gray-medium: #666;
    --gray-light: #e1e5e9;
    --gray-bg: #f5f7fa;
    --white: #ffffff;
    --white-transparent: rgba(255, 255, 255, 0.95);
    
    /* Тени */
    --shadow-sm: 0 2px 20px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-primary: 0 4px 15px rgba(46, 125, 50, 0.3);
    
    /* Бордеры */
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 24px;
    --border-radius-xl: 40px;
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 80%;
    min-height: 80vh;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--gray-bg);
    color: var(--gray-dark);
}

/* Фон для главной страницы */
body.main-page {
    background: url('/local/templates/hf_egpu_flow/images/background.png') no-repeat center center fixed;
    background-size: cover;
}

body.main-page::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: lightsteelblue;
    z-index: -1;
}

/* ===== HEADER ===== */
.site-header {
    background: var(--white);
    box-shadow: var(--shadow-sm);
    border-bottom: 3px solid var(--green-primary);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.site-header-transparent {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(46, 125, 50, 0.3);
    box-shadow: var(--shadow-md);
}

.site-header-transparent .header-title h1 {
    color: var(--white);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.site-header-unauthorized {
    background: rgba(0, 0, 0, 0.2) !important;
    border-bottom: 1px solid rgba(46, 125, 50, 0.3);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

/* Логотип */
.header-logo {
    flex: 0 0 auto;
}

.header-logo img {
    height: 50px;
    width: auto;
    transition: transform 0.2s;
}

.header-logo img:hover {
    transform: scale(1.05);
}

/* Заголовок страницы */
.header-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    white-space: nowrap;
}

.header-title h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-dark);
    letter-spacing: 0.5px;
}

/* Меню под шапкой */
.header-menu {
    background: #f8f9fa;
    border-top: 1px solid rgba(46, 125, 50, 0.1);
}

.header-menu-transparent {
    background: rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.header-menu-transparent .menu-item a {
    color: var(--white);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.header-menu-transparent .menu-item a i {
    color: var(--green-primary);
}

.header-menu-transparent .menu-item.active a {
    color: var(--green-primary);
    border-bottom-color: var(--green-primary);
}

.menu-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Стили меню */
.menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 30px;
}

.menu-item {
    position: relative;
}

.menu-item a {
    display: block;
    padding: 15px 0;
    color: var(--gray-dark);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.menu-item a i {
    margin-right: 8px;
    color: var(--green-primary);
    font-size: 14px;
}

.menu-item:hover a {
    color: var(--green-primary);
}

.menu-item.active a {
    color: var(--green-primary);
    border-bottom-color: var(--green-primary);
}

/* Блок пользователя */
.user-menu-item {
    margin-left: auto !important;
}

.menu-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}

.logout-link {
    color: #a0a0a0 !important;
}

.logout-link:hover {
    color: var(--green-primary) !important;
}

/* ===== USER BLOCK ===== */
.header-user {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #f8f9fa;
    padding: 5px 15px 5px 5px;
    border-radius: var(--border-radius-xl);
    border: 1px solid rgba(46, 125, 50, 0.2);
    transition: all 0.2s;
}

.header-user:hover {
    border-color: var(--green-primary);
    box-shadow: 0 2px 10px rgba(46, 125, 50, 0.1);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--green-primary);
    background: var(--white);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-name {
    font-weight: 500;
    color: var(--gray-dark);
    font-size: 14px;
}

.logout-btn {
    color: #a0a0a0;
    font-size: 16px;
    transition: all 0.2s;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--white);
}

.logout-btn:hover {
    color: var(--green-primary);
    background: var(--green-light);
    transform: rotate(90deg);
}

/* ===== AUTH FORM ===== */
.auth-wrapper {
    min-height: calc(100vh - 315px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    width: 100%;
    max-width: 450px;
    margin: 0 auto;
}

.auth-card {
    background: var(--white-transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--border-radius-lg);
    padding: 40px 35px;
    width: 100%;
    max-width: 450px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin: auto;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo {
    height: 60px;
    width: auto;
    margin-bottom: 25px;
}

.auth-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--gray-dark);
    margin: 0 0 8px 0;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--gray-medium);
    margin: 0;
}

.auth-body {
    margin-bottom: 20px;
}

.auth-error {
    background: #fee2e2;
    border-left: 3px solid #ef4444;
    padding: 12px 15px;
    margin-bottom: 20px;
    border-radius: var(--border-radius-sm);
    color: #b91c1c;
    font-size: 14px;
}

.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
    color: var(--gray-dark);
}

.auth-form .form-input {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: 2px solid var(--gray-light);
    border-radius: var(--border-radius-md);
    font-size: 15px;
    transition: all 0.2s;
    background: var(--white);
}

.auth-form .form-input:focus {
    border-color: var(--green-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

.auth-form .form-checkbox {
    display: flex;
    align-items: center;
}

.auth-form .form-checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    cursor: pointer;
    font-weight: normal;
}

.auth-form .form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--green-primary);
}

/* ===== CAPTCHA ===== */
.captcha-group {
    background: #f8f9fa;
    padding: 15px;
    border-radius: var(--border-radius-md);
    margin-bottom: 20px;
}

.captcha-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.captcha-image-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.captcha-image-wrapper img {
    border: 2px solid var(--gray-light);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    max-width: 180px;
    height: auto;
    transition: all 0.2s;
}

.captcha-image-wrapper img:hover {
    border-color: var(--green-primary);
}

.captcha-refresh {
    background: none;
    border: 2px solid var(--gray-light);
    border-radius: var(--border-radius-sm);
    padding: 8px 12px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
    color: var(--gray-medium);
}

.captcha-refresh:hover {
    background: #e9ecef;
    border-color: var(--green-primary);
    color: var(--green-primary);
}

/* ===== PASSWORD FIELD ===== */
.password-input-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: none;
    cursor: pointer;
    font-size: 16px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.password-toggle:hover {
    opacity: 1;
}

.password-toggle.active {
    opacity: 1;
    color: var(--green-primary);
}

/* ===== BUTTONS ===== */
.auth-btn {
    width: 100%;
    height: 52px;
    background: linear-gradient(135deg, var(--green-primary) 0%, var(--green-primary-light) 100%);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--shadow-primary);
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(46, 125, 50, 0.5);
    background: linear-gradient(135deg, var(--green-primary-dark) 0%, var(--green-primary) 100%);
}

.auth-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-primary);
}

.auth-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== AUTH FOOTER ===== */
.auth-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--gray-light);
}

.forgot-link {
    color: var(--gray-medium);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.forgot-link:hover {
    color: var(--green-primary);
    text-decoration: underline;
}

.register-link {
    margin-left: 15px;
    padding-left: 15px;
    border-left: 1px solid #ddd;
    color: var(--green-primary);
    text-decoration: none;
    font-size: 14px;
}

.register-link:hover {
    text-decoration: underline;
}

/* ===== FOOTER ===== */
.site-footer {
    background: var(--gray-dark);
    color: var(--white);
    padding: 20px 0;
    border-top: 3px solid var(--green-primary);
    margin-top: 40px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-contacts-row {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 30px;
    padding: 10px 0;
}

.footer-contacts-row .contact-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #e0e0e0;
    font-size: 14px;
}

.footer-contacts-row .contact-item i {
    color: var(--green-primary-light);
    font-size: 14px;
}

.footer-contacts-row .email-link {
    color: #4a9eff;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s;
}

.footer-contacts-row .email-link:hover {
    border-bottom-color: #4a9eff;
}

.footer-contacts-row .map-link {
    color: var(--white);
    text-decoration: none;
    padding: 5px 12px;
    background: rgba(46, 125, 50, 0.2);
    border-radius: 20px;
    transition: all 0.2s;
}

.footer-contacts-row .map-link:hover {
    background: var(--green-primary);
}

.footer-bottom {
    text-align: center;
    padding-top: 15px;
    margin-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 13px;
    color: #a0b8cc;
}

/* ===== MEDIA QUERIES ===== */
@media (max-width: 768px) {
    /* Header */
    .header-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .header-title {
        position: static;
        transform: none;
        white-space: normal;
    }
    
    .header-title h1 {
        font-size: 18px;
    }
    
    .menu-list {
        flex-wrap: wrap;
        gap: 15px;
        justify-content: center;
    }
    
    .menu-item a {
        padding: 10px 0;
    }
    
    .menu-item:last-child {
        margin-left: 0;
    }
    
    .user-menu-item {
        margin-left: 0 !important;
        width: 100%;
    }
    
    .user-menu-item .header-user {
        width: 100%;
        justify-content: center;
    }
    
    /* Footer */
    .footer-contacts-row {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
        padding-left: 20px;
    }
    
    .footer-map {
        text-align: center;
    }
    
    .map-button {
        width: 100%;
        max-width: 300px;
    }
    
    /* Auth */
    .auth-wrapper {
        min-height: calc(100vh - 400px);
    }
}

@media (max-width: 480px) {
    /* Header */
    .header-user {
        padding: 5px 10px 5px 5px;
    }
    
    .user-name {
        display: none;
    }
    
    .header-logo img {
        height: 40px;
    }
    
    /* Auth */
    .auth-card {
        padding: 30px 20px;
    }
    
    .auth-logo {
        height: 50px;
    }
    
    .auth-title {
        font-size: 22px;
    }
    
    .captcha-image-wrapper {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .captcha-image-wrapper img {
        max-width: 100%;
    }
    
    .register-link {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        display: block;
        margin-top: 10px;
    }
}