/* Общие стили для единого сайта */

:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
}

/* Запрет выделения текста */
* {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Разрешаем выделение для полей ввода и редактируемых элементов */
input,
textarea,
select,
[contenteditable="true"],
[contenteditable="true"] * {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* =============================================
   Общий фон для всего сайта
   ============================================= */
body {
    font-family: 'Roboto', sans-serif;
    min-height: 100vh;
    padding-bottom: 40px;
    /* Единый фон для всех страниц */
    background-image: url('/static/img/sparkles-background.svg'), url('/static/img/Vector.svg');
    background-repeat: no-repeat;
    background-size: contain, cover;
    background-position: 100% 0, 100% 0;
    background-color: #7231FF;
    background-attachment: scroll;
    color: #333;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Дополнительный отступ снизу на мобильных для баннера куки */
@media (max-width: 768px) {
    body {
        padding-bottom: 80px;
    }
}

/* Для страниц с base.html используем flex layout */
body:has(.site-header) {
    display: flex;
    flex-direction: column;
}

body:has(.site-header) > .main-content {
    flex: 1;
}

.main-content {
    flex: 1;
    padding: 0;
    position: relative;
    z-index: 1;
    width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* =============================================
   Шапка сайта
   ============================================= */

/* Bootstrap шапка (для страниц с base.html) */
.site-header {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    z-index: 1;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color) !important;
}

.navbar {
    position: relative;
    z-index: 1;
}

body > .container,
body > header .container {
    position: relative;
    z-index: 1;
}

/* Glassmorphism навигация (для калькулятора, главной и других страниц) */
.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 28px;
    margin-top: 20px;
    margin-bottom: 32px;
    position: relative;
    z-index: 1;
    /* Glassmorphism Effect */
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 2px solid rgba(255, 255, 255, 1);
    border-radius: 50px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 30px;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.nav-link i {
    font-size: 16px;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    border-color: rgba(255, 255, 255, 0.15);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-color: rgba(255, 255, 255, 0.25);
}

/* Стили для иконки корзины - применяются ко всем страницам */
.nav-cart i.fa-shopping-cart,
.nav-cart .fa-shopping-cart,
.nav-cart i,
.nav-actions .nav-cart i,
.nav-actions .nav-cart .fa-shopping-cart,
i.fa-shopping-cart {
    box-sizing: content-box !important;
    margin-top: 2px !important;
    margin-right: 1px !important;
    margin-left: 0 !important;
    margin-bottom: 0 !important;
    display: inline-block !important;
    vertical-align: middle !important;
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    transform: none !important;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Иконка аккаунта - круглая */
.nav-actions .nav-link {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
}

.nav-actions .nav-link span {
    display: none;
}

.nav-actions .nav-link i {
    margin: 0;
    font-size: 18px;
}

/* Аватар в навигации */
.nav-actions .nav-link img {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    object-fit: cover;
    border-radius: 50%;
}

.nav-cart {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 18px;
    border-radius: 50%;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.nav-cart:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    background: #FF4444;
    color: white;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-sizing: border-box;
    line-height: 18px;
    text-align: center;
}

/* =============================================
   Подвал сайта
   ============================================= */

/* Bootstrap подвал (для страниц с base.html) */
.site-footer {
    border-top: 1px solid #dee2e6;
    margin-top: auto;
    position: relative;
    z-index: 1;
}

/* Glassmorphism подвал (для калькулятора, главной и других страниц) */
.footer {
    margin-top: 40px;
    position: relative;
    z-index: 1;
    /* Glass Effect - светлое стекло с blur */
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 2px solid rgba(255, 255, 255, 1);
    border-radius: 30px;
    padding: 28px 32px;
    color: white;
    box-shadow: 
        0 -4px 30px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.18);
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-sizing: border-box;
    max-width: 100%;
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 32px;
    margin-bottom: 20px;
}

.footer-links {
    display: flex;
    gap: 8px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    padding: 10px 16px;
    border-radius: 20px;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.footer-links a:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.footer-social {
    display: flex;
    gap: 10px;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top-color: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 20px;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.social-link:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: white;
    transform: translateY(-2px);
}

.footer-copyright {
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.45);
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
}

/* Шаги формы */
.steps-container {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.step {
    display: flex;
    align-items: center;
    margin: 0 1rem;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--secondary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 0.5rem;
}

.step.active .step-number {
    background: var(--primary-color);
}

.step.completed .step-number {
    background: var(--success-color);
}

.step-label {
    font-weight: 500;
}

.step-connector {
    width: 50px;
    height: 2px;
    background: var(--secondary-color);
    margin: 0 0.5rem;
}

.step.completed + .step-connector {
    background: var(--success-color);
}

/* Формы */
.form-card {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.option-button {
    padding: 1rem;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.option-button:hover {
    border-color: var(--primary-color);
    background: #f8f9ff;
}

.option-button.selected {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

/* Загрузка файлов */
.file-upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.file-upload-area:hover {
    border-color: var(--primary-color);
    background: #f8f9ff;
}

.file-upload-area.dragover {
    border-color: var(--success-color);
    background: #f0fff4;
}

/* =============================================
   Единая система уведомлений
   ============================================= */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 12px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    z-index: 10010;
    animation: slideInNotification 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: fit-content;
    max-width: 400px;
    word-wrap: break-word;
}

/* Успешные операции */
.notification.success {
    background: #4CAF50;
}

/* Ошибки */
.notification.error {
    background: #F44336;
}

/* Предупреждения */
.notification.warning {
    background: #FFC107;
    color: #333;
}

@keyframes slideInNotification {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Кнопки */
.btn {
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
}

/* Адаптивность */
@media (max-width: 768px) {
    .steps-container {
        flex-direction: column;
        align-items: center;
    }
    
    .step-connector {
        width: 2px;
        height: 30px;
        margin: 0.5rem 0;
    }
    
    .option-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    /* Навигация для мобильных - единый стандарт для всех страниц */
    .main-nav {
        padding: 12px 16px !important;
        margin: 12px 0 20px 0 !important;
        border-radius: 30px !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        justify-content: space-between !important;
        align-items: center !important;
        /* Единые визуальные свойства для одинаковой формы шапки */
        background: rgba(255, 255, 255, 0.12) !important;
        backdrop-filter: blur(40px) !important;
        -webkit-backdrop-filter: blur(40px) !important;
        border: 2px solid rgba(255, 255, 255, 1) !important;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
    }
    
    .main-nav::-webkit-scrollbar {
        display: none !important;
    }
    
    .nav-links {
        gap: 4px !important;
        flex-wrap: nowrap !important;
        flex-shrink: 0 !important;
        display: flex !important;
        align-items: center !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        max-width: calc(100% - 100px) !important;
    }
    
    .nav-links::-webkit-scrollbar {
        display: none !important;
    }
    
    .nav-link {
        padding: 8px 12px !important;
        font-size: 13px !important;
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-height: 40px !important;
        min-width: 40px !important;
    }
    
    .nav-link i {
        font-size: 14px !important;
        margin: 0 !important;
    }
    
    .nav-link span {
        display: none !important;
    }
    
    .nav-actions {
        gap: 6px !important;
        flex-shrink: 0 !important;
        margin-left: auto !important;
        display: flex !important;
        align-items: center !important;
        min-width: 90px !important;
    }
    
    .nav-actions .nav-link,
    .nav-cart {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        max-width: 40px !important;
        max-height: 40px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .nav-actions .nav-link i,
    .nav-cart i {
        font-size: 16px !important;
        margin: 0 !important;
    }
    
    .nav-actions .nav-link img {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        max-width: 40px !important;
        max-height: 40px !important;
    }
    
    /* Footer для мобильных */
    .footer {
        padding: 20px 16px;
        margin-top: 32px;
        border-radius: 20px;
        overflow-x: hidden;
        word-wrap: break-word;
        overflow-wrap: break-word;
        box-sizing: border-box;
        max-width: 100%;
    }
    
    .footer-content {
        gap: 20px;
        margin-bottom: 16px;
        flex-wrap: wrap;
    }
    
    .footer-links {
        gap: 8px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .footer-links a {
        padding: 8px 12px;
        font-size: 14px;
        white-space: nowrap;
        word-wrap: normal;
        overflow-wrap: normal;
    }
    
    .footer-social {
        gap: 8px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .social-link {
        width: 40px;
        height: 40px;
        font-size: 18px;
        flex-shrink: 0;
    }
    
    .footer-copyright {
        font-size: 11px;
        padding-top: 16px;
        word-wrap: break-word;
        overflow-wrap: break-word;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    /* Навигация для маленьких мобильных - единый стандарт */
    .main-nav {
        padding: 10px 12px !important;
        margin: 10px 0 16px 0 !important;
        border-radius: 25px !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        justify-content: space-between !important;
        align-items: center !important;
        /* Единые визуальные свойства для одинаковой формы шапки */
        background: rgba(255, 255, 255, 0.12) !important;
        backdrop-filter: blur(40px) !important;
        -webkit-backdrop-filter: blur(40px) !important;
        border: 2px solid rgba(255, 255, 255, 1) !important;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
    }
    
    .nav-links {
        gap: 4px !important;
        flex-wrap: nowrap !important;
        max-width: calc(100% - 90px) !important;
    }
    
    .nav-link {
        padding: 6px 10px !important;
        font-size: 12px !important;
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        min-height: 36px !important;
        min-width: 36px !important;
    }
    
    .nav-link i {
        font-size: 13px !important;
        margin: 0 !important;
    }
    
    .nav-link span {
        display: none !important;
    }
    
    .nav-actions {
        flex-shrink: 0 !important;
        margin-left: auto !important;
        min-width: 80px !important;
    }
    
    .nav-actions .nav-link,
    .nav-cart {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        min-height: 36px !important;
        max-width: 36px !important;
        max-height: 36px !important;
        padding: 0 !important;
    }
    
    .nav-actions .nav-link i,
    .nav-cart i {
        font-size: 15px !important;
        margin: 0 !important;
    }
    
    .nav-actions .nav-link img {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        min-height: 36px !important;
        max-width: 36px !important;
        max-height: 36px !important;
    }
    
    .footer {
        padding: 16px 12px;
        border-radius: 16px;
        overflow-x: hidden;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .footer-links a {
        padding: 6px 10px;
        font-size: 13px;
        white-space: nowrap;
    }
    
    .footer-social {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .social-link {
        width: 36px;
        height: 36px;
        font-size: 16px;
        flex-shrink: 0;
    }
    
    .footer-copyright {
        word-wrap: break-word;
        overflow-wrap: break-word;
        max-width: 100%;
    }
}

/* Предотвращение мигания аватарки */
/* Иконка должна быть видна для неавторизованных пользователей */
#account-link {
    opacity: 1 !important;
    transition: opacity 0.1s ease;
}

/* Показываем когда аватарка загружена */
#account-link.account-link-avatar,
#account-link.account-link-avatar img {
    opacity: 1;
    transition: opacity 0.1s ease;
}

/* =============================================
   Баннер подтверждения куки
   ============================================= */
.cookie-banner {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-width: 100% !important;
    background: white !important;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1) !important;
    z-index: 99999 !important;
    padding: 16px 20px;
    margin: 0 !important;
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
    -webkit-transform: translateY(100%) translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
}

.cookie-banner.show {
    transform: translateY(0) translateZ(0) !important;
    -webkit-transform: translateY(0) translateZ(0) !important;
    opacity: 1 !important;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.cookie-banner.hidden {
    animation: slideDown 0.3s ease-out forwards;
}

@keyframes slideDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100%);
        opacity: 0;
    }
}

.cookie-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.cookie-banner-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cookie-banner-icon svg {
    width: 32px;
    height: 32px;
    display: block;
}

.cookie-banner-text {
    flex: 1;
    min-width: 250px;
}

.cookie-banner-text p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

.cookie-banner-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.cookie-banner-link {
    color: #7231FF;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.cookie-banner-link:hover {
    color: #5a26cc;
    text-decoration: underline;
}

.cookie-banner-button {
    background: #7231FF;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.cookie-banner-button:hover {
    background: #5a26cc;
    transform: translateY(-1px);
}

.cookie-banner-button:active {
    transform: translateY(0);
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .cookie-banner {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        max-width: 100% !important;
        padding: 14px 16px;
        z-index: 99999 !important;
        box-sizing: border-box;
        margin: 0 !important;
        -webkit-transform: translateY(100%) translateZ(0);
        transform: translateY(100%) translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        will-change: transform;
    }

    .cookie-banner.show {
        -webkit-transform: translateY(0) translateZ(0);
        transform: translateY(0) translateZ(0);
    }

    .cookie-banner-content {
        flex-direction: row;
        align-items: flex-start;
        gap: 12px;
        max-width: 100%;
    }

    .cookie-banner-icon {
        flex-shrink: 0;
    }

    .cookie-banner-icon svg {
        width: 28px;
        height: 28px;
    }

    .cookie-banner-text {
        min-width: auto;
        flex: 1;
    }

    .cookie-banner-text p {
        font-size: 13px;
        line-height: 1.6;
        text-align: left;
    }

    .cookie-banner-actions {
        width: 100%;
        display: flex;
        flex-direction: row;
        justify-content: flex-end;
        align-items: center;
        gap: 10px;
        flex-wrap: nowrap;
    }

    .cookie-banner-link {
        font-size: 13px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .cookie-banner-button {
        flex: none;
        width: auto;
        min-width: auto;
        padding: 10px 16px;
        font-size: 13px;
        white-space: nowrap;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
    .cookie-banner {
        padding: 12px 12px;
    }

    .cookie-banner-icon svg {
        width: 24px;
        height: 24px;
    }

    .cookie-banner-text p {
        font-size: 12px;
        line-height: 1.5;
    }

    .cookie-banner-link {
        font-size: 12px;
    }

    .cookie-banner-button {
        padding: 9px 14px;
        font-size: 12px;
    }

    .cookie-banner-actions {
        gap: 8px;
    }
}

