/* style.css – единые стили для всех страниц Nova vision */
/* Используются CSS-переменные, чтобы админ мог менять цветовую схему (Трек 29) */

:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #60a5fa;
    --header-bg: #0f172a;
    --body-bg: #f9fafc;
    --button-hover: #2563eb;
    --text-color: #1e2a3a;
    --text-light: #475569;
    --border-color: #cbd5e1;
    --card-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--body-bg);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ----- ШАПКА (единая) ----- */
.header {
    background: var(--header-bg);
    color: white;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.header .container {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
}
.logo {
    font-size: 1.6rem;
    font-weight: bold;
    flex-shrink: 0;
    white-space: nowrap;
    margin-right: 2rem;   /* фиксированный отступ */
}
.logo span:first-child { color: var(--primary-color); }
.logo span:last-child { color: white; }

.nav {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}
.nav a {
    color: #e2e8f0;
    text-decoration: none;
    transition: 0.3s;
}
.nav a:hover,
.nav a.active {
    color: var(--primary-color);
}

.right-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
    flex-shrink: 0;
}
.cart-icon {
    position: relative;
    cursor: pointer;
    font-size: 1.3rem;
}
.cart-count {
    position: absolute;
    top: -10px;
    right: -12px;
    background: #ef4444;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.language-switcher {
    display: flex;
    gap: 0.5rem;
}
.lang-flag {
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.6;
    transition: 0.2s;
}
.lang-flag.active {
    opacity: 1;
    transform: scale(1.1);
}
.user-icon {
    color: white;
    text-decoration: none;
    font-size: 1.3rem;
}
.mobile-menu-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
}
#authButtonPlace a,
#logoutButtonPlace button {
    background: var(--primary-color);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 40px;
    text-decoration: none;
    font-size: 0.9rem;
    white-space: nowrap;
    border: none;
    cursor: pointer;
}
#logoutButtonPlace button {
    background: #ef4444;
}
#logoutButtonPlace button:hover {
    background: #dc2626;
}
#authButtonPlace a:hover {
    background: var(--button-hover);
}

/* ----- ОСНОВНЫЕ КОМПОНЕНТЫ ----- */
.btn {
    display: inline-block;
    padding: 0.8rem 1.8rem;
    border-radius: 40px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: 0.2s;
}
.btn-primary {
    background: var(--primary-color);
    color: white;
}
.btn-primary:hover {
    background: var(--button-hover);
    transform: translateY(-2px);
}
.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}
.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

/* Сетки и карточки */
.products-grid,
.projects-grid,
.videos-grid,
.certificates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.product-card,
.project-card,
.video-card,
.cert-item {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: 0.3s;
}
.product-card:hover,
.project-card:hover,
.video-card:hover,
.cert-item:hover {
    transform: translateY(-5px);
}

/* Область изображения товара (важно для позиционирования сердечка) */
.product-img {
    background: #f1f5f9;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    position: relative;
}
.product-img img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}
.product-img i {
    font-size: 4rem;
    color: var(--primary-color);
}

/* Кнопка "Избранное" – маленькое сердечко в правом верхнем углу */
.favorite-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 2;
    transition: 0.2s;
}
.favorite-btn i {
    font-size: 1.1rem;
    color: #cbd5e1;
    transition: 0.2s;
}
.favorite-btn.active i {
    color: #ef4444;
}
.favorite-btn:hover i {
    transform: scale(1.1);
}

/* Чекбокс сравнения (левый верхний угол) */
.compare-checkbox {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(255,255,255,0.85);
    border-radius: 20px;
    padding: 4px 8px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    z-index: 2;
}
.compare-checkbox input {
    margin: 0;
    cursor: pointer;
}

/* Остальные стили карточки */
.product-info {
    padding: 1rem;
    flex-grow: 1;
}
.product-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}
.product-desc {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}
.product-price {
    font-weight: bold;
    font-size: 1.2rem;
    margin: 0.5rem 0;
}
.product-rating {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0.5rem 0;
    flex-wrap: wrap;
}
.rating-stars {
    color: #fbbf24;
    font-size: 0.8rem;
}
.rating-count {
    font-size: 0.7rem;
    color: var(--text-light);
}
.product-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}
.add-to-cart,
.quick-order,
.youtube-btn {
    flex: 1;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 40px;
    cursor: pointer;
    font-weight: 600;
}
.quick-order { background: #10b981; }
.youtube-btn { background: #FF0000; }
.share-group {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}
.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #e2e8f0;
    border: none;
    padding: 0.4rem 0.7rem;
    border-radius: 40px;
    cursor: pointer;
    font-size: 0.85rem;
}
.share-btn.whatsapp { background: #25D366; color: white; }
.share-btn.telegram { background: #26A5E4; color: white; }
.share-btn.instagram { background: radial-gradient(circle at 30% 110%, #ffdb8f, #d6246c, #bc1888); color: white; }

/* Панель сравнения */
.compare-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--header-bg);
    color: white;
    padding: 12px 20px;
    border-radius: 40px;
    display: flex;
    gap: 15px;
    z-index: 1000;
}
.compare-bar a {
    background: var(--primary-color);
    padding: 6px 16px;
    border-radius: 40px;
    text-decoration: none;
    color: white;
}
.compare-bar button {
    background: transparent;
    border: none;
    color: #cbd5e1;
    cursor: pointer;
}

/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 32px;
    max-width: 500px;
    width: 90%;
    position: relative;
}
.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
}
.youtube-modal-content {
    max-width: 800px;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
}
.youtube-modal-content iframe {
    width: 100%;
    height: 400px;
    border: none;
}

/* Футер */
.footer {
    background: var(--header-bg);
    color: #cbd5e1;
    padding: 2rem 0 0;
    margin-top: 3rem;
}
.footer .container {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: space-between;
}
.footer-col h4 {
    color: white;
    margin-bottom: 1rem;
}
.footer-bottom {
    text-align: center;
    padding: 1rem;
    border-top: 1px solid #1e293b;
    margin-top: 2rem;
    font-size: 0.8rem;
}

/* Герой-секция, Фичи, Конфигуратор (если есть) */
.hero {
    background: linear-gradient(135deg, var(--header-bg), #1e293b);
    color: white;
    text-align: center;
    padding: 4rem 0;
}
.hero h1 { font-size: 2.5rem; margin-bottom: 1rem; }
.features {
    padding: 3rem 0;
    text-align: center;
}
.features-grid {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 2rem;
}
.feature-card {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    width: 280px;
    box-shadow: var(--card-shadow);
}
.feature-card i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}
.configurator {
    background: white;
    padding: 3rem 0;
}
.config-form {
    max-width: 800px;
    margin: 2rem auto 0;
    background: #f8fafc;
    padding: 2rem;
    border-radius: 32px;
}
.question {
    margin-bottom: 2rem;
    text-align: left;
}
.question label {
    font-weight: 600;
    display: block;
    margin-bottom: 0.75rem;
}
.options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}
.options button {
    background: #e2e8f0;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 40px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: 0.2s;
}
.options button.active {
    background: var(--primary-color);
    color: white;
}
#getRecommendBtn {
    width: 100%;
    margin-top: 0.5rem;
}
.recommend-result {
    margin-top: 2rem;
    background: #eef2ff;
    padding: 1.5rem;
    border-radius: 24px;
    display: none;
    text-align: center;
}

/* Адаптивность */
@media (max-width: 768px) {
    .nav {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 1rem;
        margin-top: 1rem;
        text-align: center;
    }
    .nav.show { display: flex; }
    .mobile-menu-toggle { display: block; }
    .right-section {
        margin-left: 0;
        order: 2;
    }
    .mobile-menu-toggle { order: 1; }
    .nav { order: 3; width: 100%; }
    .hero h1 { font-size: 1.8rem; }
    .products-grid,
    .projects-grid,
    .videos-grid,
    .certificates-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
    .logo {
        margin-right: 1rem;
    }
}