/* ========================================
   BASSHIM — Custom Styles & Animations
   ======================================== */

/* ---- Базовые стили ---- */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 212, 255, 0.3) transparent;
}

*::-webkit-scrollbar {
    width: 8px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.3);
    border-radius: 4px;
}

html,
body {
    scroll-behavior: smooth;
    overflow-x: hidden;
    max-width: 100vw;
}

::selection {
    background: rgba(0, 212, 255, 0.3);
    color: #fff;
}

/* ---- Навигация ---- */
#navbar {
    background: transparent;
}

#navbar.scrolled {
    background: rgba(6, 13, 27, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

/* Мобильное меню */
.mobile-menu-closed {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.mobile-menu-open {
    max-height: 400px;
    transition: max-height 0.4s ease;
}

/* Бургер анимация */
.burger-active .burger-line:nth-child(1) {
    transform: translateY(4px) rotate(45deg);
}

.burger-active .burger-line:nth-child(2) {
    opacity: 0;
}

.burger-active .burger-line:nth-child(3) {
    width: 1.5rem;
    transform: translateY(-4px) rotate(-45deg);
}

/* ---- Кнопки ---- */
.btn-primary {
    background: linear-gradient(135deg, #00D4FF 0%, #3B82F6 100%);
    color: white;
    position: relative;
    overflow: hidden;
    transition: all 0.4s ease;
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.3);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 212, 255, 0.4);
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    transition: all 0.4s ease;
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.3);
    transform: translateY(-2px);
}

/* ---- Hero фон ---- */
.hero-bg {
    background: radial-gradient(ellipse at 30% 20%, rgba(0, 212, 255, 0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 70% 80%, rgba(59, 130, 246, 0.06) 0%, transparent 50%),
                radial-gradient(ellipse at 50% 50%, rgba(139, 92, 246, 0.04) 0%, transparent 50%);
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.15) 0%, transparent 70%);
    top: -15%;
    left: -10%;
    animation: float-orb 20s ease-in-out infinite;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.12) 0%, transparent 70%);
    bottom: -10%;
    right: -10%;
    animation: float-orb 25s ease-in-out infinite reverse;
}

.orb-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: float-orb 18s ease-in-out infinite 3s;
}

@keyframes float-orb {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -40px) scale(1.1); }
    50% { transform: translate(-20px, 20px) scale(0.9); }
    75% { transform: translate(40px, 30px) scale(1.05); }
}

/* Сетка на фоне */
.bg-grid {
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 60px 60px;
}

/* ---- Анимации появления ---- */
@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    opacity: 0;
    animation: fade-in-up 0.8s ease forwards;
}

/* Скролл-точка */
@keyframes scroll-dot {
    0%, 100% { transform: translateY(0); opacity: 1; }
    50% { transform: translateY(8px); opacity: 0.3; }
}

.animate-scroll-dot {
    animation: scroll-dot 2s ease-in-out infinite;
}

/* ---- Reveal on scroll ---- */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Калькулятор ---- */
.calc-card {
    position: relative;
}

.calc-card::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 20%;
    right: 20%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00D4FF, transparent);
    border-radius: 2px;
}

.calc-type-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #9CA3AF;
    cursor: pointer;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    word-break: break-word;
    line-height: 1.2;
}

.calc-type-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #D1D5DB;
}

.calc-type-btn.active {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15) 0%, rgba(59, 130, 246, 0.15) 100%);
    border-color: rgba(0, 212, 255, 0.4);
    color: #00D4FF;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.1);
}

/* Select стиль */
select option {
    background: #0A1628;
    color: white;
}

/* ---- Карточки продуктов — выравнивание высоты ---- */
.product-card {
    display: flex;
}

.product-card > div {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.product-card > div > p {
    flex: 1;
}

/* ---- Карточки продуктов — hover линия сверху ---- */
.product-card > div::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, currentColor, transparent);
    transition: all 0.5s ease;
    transform: translateX(-50%);
    border-radius: 2px;
}

.product-card:nth-child(1) > div::before { color: #00D4FF; }
.product-card:nth-child(2) > div::before { color: #FB923C; }
.product-card:nth-child(3) > div::before { color: #A78BFA; }
.product-card:nth-child(4) > div::before { color: #38BDF8; }
.product-card:nth-child(5) > div::before { color: #34D399; }
.product-card:nth-child(6) > div::before { color: #FB7185; }

.product-card:hover > div::before {
    width: 60%;
}

/* ---- Форма — успешная отправка ---- */
.form-success {
    animation: success-pulse 0.5s ease;
}

@keyframes success-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* ---- Плавающие частицы (дополнительно к canvas) ---- */
@keyframes float-particle {
    0%, 100% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% { opacity: 0.6; }
    90% { opacity: 0.6; }
    50% {
        transform: translateY(-200px) translateX(30px);
    }
}

/* ---- Анимация волны на баннере ---- */
@keyframes wave-move {
    0% { transform: translateX(0); }
    50% { transform: translateX(-5%); }
    100% { transform: translateX(0); }
}

.animate-wave {
    animation: wave-move 6s ease-in-out infinite;
}

/* ---- Glassmorphism утилита ---- */
.glass {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ---- Gradient text shimmer ---- */
@keyframes text-shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.shimmer-text {
    background: linear-gradient(90deg, #00D4FF, #3B82F6, #8B5CF6, #00D4FF);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: text-shimmer 4s linear infinite;
}

/* ---- Glow эффект для карточек ---- */
.glow-hover {
    transition: box-shadow 0.5s ease;
}

.glow-hover:hover {
    box-shadow:
        0 0 20px rgba(0, 212, 255, 0.1),
        0 0 40px rgba(0, 212, 255, 0.05),
        inset 0 0 20px rgba(0, 212, 255, 0.03);
}

/* ---- Адаптивность ---- */
@media (max-width: 640px) {
    .gradient-orb {
        filter: blur(60px);
        opacity: 0.3;
    }

    .orb-1 { width: 300px; height: 300px; }
    .orb-2 { width: 250px; height: 250px; }
    .orb-3 { width: 200px; height: 200px; }

    /* Калькулятор результат — уменьшить для мобильных */
    #calc-result {
        font-size: 2rem;
    }

    /* Калькулятор кнопки — компактнее на мобильных */
    .calc-type-btn {
        padding: 0.5rem 0.25rem;
        font-size: 0.7rem;
    }

    /* Площадки ЭТП — компактнее */
    .grid [class*="px-5"][class*="py-3"][class*="rounded-xl"][class*="cursor-default"] {
        padding: 0.5rem 0.75rem;
    }

    /* Футер — не выходит за экран */
    footer {
        overflow-x: hidden;
    }

    footer .flex {
        max-width: 100%;
    }

    footer .flex > * {
        max-width: 100%;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}

/* iOS Safari: убрать zoom на input focus (font-size < 16px) */
@media screen and (max-width: 768px) {
    select, input[type="number"] {
        font-size: 16px !important;
    }
}

/* iOS Safari: fix для безопасной зоны (notch) */
@supports (padding: env(safe-area-inset-bottom)) {
    footer {
        padding-bottom: calc(3rem + env(safe-area-inset-bottom));
    }

    #navbar {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* ---- Accessibility: уменьшение анимаций ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }

    html {
        scroll-behavior: auto;
    }
}

/* ---- Focus стили для доступности ---- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #00D4FF;
    outline-offset: 2px;
}
