/* =============================================
   Компоненти сайту baza.mastersmeta.pro
   ============================================= */

/* ─── Навігація ─── */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 0 24px;
    height: 72px;
    display: flex;
    align-items: center;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transition: all var(--transition);
}

.navbar-hidden {
    transform: translateY(-100%);
}

[data-theme="light"] .navbar {
    background: rgba(255, 255, 255, 0.85);
}

.navbar.scrolled {
    box-shadow: var(--shadow-md);
}

.navbar-inner {
    max-width: var(--container);
    margin: 0 auto;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 20px;
    color: var(--text-primary);
}

.navbar-logo:hover { color: var(--text-primary); }

.navbar-logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    animation: logoHeartbeat 3s ease-in-out infinite;
    transform-origin: center;
}

@keyframes logoHeartbeat {
    0% { transform: scale(1); }
    12% { transform: scale(1.1); }
    20% { transform: scale(1); }
    28% { transform: scale(1.08); }
    45% { transform: scale(1); }
    100% { transform: scale(1); }
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
}

.navbar-nav a {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.navbar-nav a:hover,
.navbar-nav a.active {
    color: var(--text-primary);
    background: var(--bg-glass-hover);
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Перемикач теми */
.theme-toggle {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--bg-glass);
    border: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    color: var(--text-secondary);
    font-size: 18px;
}

.theme-toggle:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

/* Мобільне меню */
.navbar-burger {
    display: none;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--bg-glass);
    border: 1px solid var(--border);
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.navbar-burger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    transition: all var(--transition);
    border-radius: 2px;
}

.navbar-burger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.navbar-burger.active span:nth-child(2) { opacity: 0; }
.navbar-burger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

.mobile-menu {
    display: none;
    position: fixed;
    top: 72px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-surface);
    z-index: 999;
    padding: 24px;
    overflow-y: auto;
}

/* Atmosphere Zone for clipping particles */
.hero-atmosphere-zone {
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at 50% 50%, #1a1e2e 0%, #0b1120 100%);
}

/* Спеціальний режим для сторінки пошуку (ізольовано) */
.is-search-shader {
    overflow: visible !important;
}

/* ─── Hero Section ─── */
.hero {
    position: relative;
    padding: 120px 0 80px; /* Оптимальний відступ під навігацію */
    background: transparent;
    z-index: 3; /* Вище часток */
}


/* Flow Field / Neural Background (активний) */
#hero-canvas-flow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1; /* Над фоном Zone, але під контентом */
    pointer-events: none;
    mix-blend-mode: screen; /* Робимо лінії яскравішими */
}

/* Shader Background (вимкнено) */
#hero-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 130%; /* Розширюємо анімацію вниз */
    z-index: 0;
    pointer-events: none;
    opacity: 0.85;
}

/* Спеціальні ізольовані стилі для сторінки пошуку */
.is-search-shader #hero-canvas-flow {
    position: absolute;
    top: -72px; /* Під меню */
    left: 0;
    width: 100%;
    /* Категорично обмежуємо висоту, щоб шейдер не ліз на картки! */
    height: 800px !important; 
    z-index: 1 !important;
    pointer-events: none;
    opacity: 0.95;
    /* Плавно розчиняємо канвас унизу, щоб уникнути різкої чорної лінії */
    -webkit-mask-image: linear-gradient(to bottom, black 0%, black 75%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 0%, black 75%, transparent 100%);
}

.is-search-shader .hero-particles {
    z-index: 10 !important; /* ПОВЕРХ точок */
    /* Обмежуємо висоту куль також, і плавно їх розчиняємо */
    height: 800px !important;
    -webkit-mask-image: linear-gradient(to bottom, black 0%, black 75%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 0%, black 75%, transparent 100%);
}

.is-search-shader .hero-particle {
    mix-blend-mode: normal !important; 
    opacity: 0.45 !important; 
    /* ЕФЕКТ ГЛИБИНИ: розмиття простору ПІД шаром */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Спеціальні ізольовані стилі для сторінки категорії */
.is-category-shader {
    overflow: visible !important;
    background: #0b1120 !important; /* Прибираємо градієнт щоб не було меж */
}

.is-category-shader #hero-canvas-flow {
    position: absolute;
    top: -72px; /* Під меню */
    left: 0;
    width: 100%;
    /* Менша висота, щоб не заходило на картки */
    height: 550px !important; 
    z-index: 1 !important;
    pointer-events: none;
    opacity: 0.95;
    /* Дуже плавне розчинення, починаючи з 20% висоти */
    -webkit-mask-image: linear-gradient(to bottom, black 0%, black 20%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 0%, black 20%, transparent 100%);
}

.is-category-shader .hero-particles {
    z-index: 10 !important; 
    height: 450px !important;
    -webkit-mask-image: linear-gradient(to bottom, black 0%, black 75%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 0%, black 75%, transparent 100%);
}

.is-category-shader .hero-particle {
    mix-blend-mode: normal !important; 
    opacity: 0.45 !important; 
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.is-search-shader .search-hero {
    position: relative;
    z-index: 20 !important; /* Контент ПОВЕРХ усього декору */
}

/* Liquid Crystal (вимкнено) */
#hero-canvas-liquid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.8;
}

.hero-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%; /* Займає всю висоту Atmosphere Zone */
    overflow: hidden;
    pointer-events: none;
    z-index: 2; /* Поверх ліній, але під контентом */
}

.mobile-menu.active { display: block; }

/* ─── Visitor Counter ─── */
.visitor-counter {
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 8px 20px;
    border-radius: 100px;
    font-size: 13px;
    color: var(--text-muted);
    overflow-x: auto;
    max-width: 100%;
    scrollbar-width: none; /* Firefox */
}
.visitor-counter::-webkit-scrollbar { display: none; } /* Chrome/Safari */

.vis-item {
    display: flex;
    align-items: center;
    white-space: nowrap;
    gap: 8px;
}

.vis-value {
    color: var(--text-light);
    font-weight: 700;
}

.vis-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.vis-dot.online {
    background: #10b981;
    position: relative;
}

.vis-dot.online::after {
    content: '';
    position: absolute;
    inset: -2px;
    background: inherit;
    border-radius: inherit;
    opacity: 0.4;
    animation: vis-pulse 2s infinite;
}

@keyframes vis-pulse {
    0% { transform: scale(1); opacity: 0.4; }
    100% { transform: scale(3); opacity: 0; }
}

.vis-dot.today { background: #10b981; }
.vis-dot.yesterday { background: #6b7280; }
.vis-dot.week { background: var(--secondary-color); }
.vis-dot.month { background: #a855f7; }
.vis-dot.year { background: #f59e0b; }
.vis-dot.total { background: #ec4899; }

@media (max-width: 768px) {
    .visitor-counter {
        gap: 16px;
        padding: 8px 16px;
        justify-content: flex-start;
    }
}

.mobile-menu a {
    display: block;
    padding: 16px 0;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
}

@media (max-width: 768px) {
    .navbar-nav { display: none; }
    .navbar-burger { display: flex; }
}

/* Flow Field / Neural Background (активний) */

.hero-particle {
    position: absolute;
    border-radius: 50%;
    opacity: 0.25;
    mix-blend-mode: screen; /* Красиве накладання поверх Liquid Crystal */
    animation: float 20s infinite ease-in-out;
    filter: blur(2px); /* М'який розмиток для глибини */
}

.hero-particle:nth-child(1) {
    width: 300px; height: 300px;
    background: var(--primary);
    top: -100px; right: -50px;
    animation-delay: 0s;
    animation-duration: 25s;
}

.hero-particle:nth-child(2) {
    width: 200px; height: 200px;
    background: var(--accent);
    top: 500px; left: 10%;
    animation-delay: -5s;
    animation-duration: 20s;
}

.hero-particle:nth-child(3) {
    width: 150px; height: 150px;
    background: var(--amber);
    top: 30%; right: 20%;
    animation-delay: -10s;
    animation-duration: 30s;
}

@keyframes float {
    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, 10px) scale(1.05); }
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    margin-bottom: 20px;
    font-size: clamp(32px, 6vw, 56px);
}

.hero-subtitle {
    font-size: clamp(16px, 2.5vw, 20px);
    color: var(--text-secondary);
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Пошук в Hero */
.search-box {
    max-width: 600px;
    margin: 0 auto 40px;
    position: relative;
    border-radius: var(--radius-xl); /* Синхронізуємо з інпутом для Spotlight */
}

.search-input {
    width: 100%;
    padding: 18px 56px 18px 24px;
    border-radius: var(--radius-xl);
    border: 2px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 16px;
    font-family: inherit;
    outline: none;
    transition: all var(--transition);
}

.search-input::placeholder { color: var(--text-muted); }

.search-input:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

/* Glassmorphism Input */
.glass-input {
    background: rgba(255, 255, 255, 0.03) !important;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3) !important;
}

.glass-input:focus {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(var(--primary-rgb), 0.5) !important;
    box-shadow: 0 0 20px rgba(var(--primary-rgb), 0.2) !important;
}

/* На мобільних екранах прибираємо прозорість, щоб жовтий шар не заважав тексту */
@media (max-width: 768px) {
    .glass-input {
        background: var(--bg-card) !important; 
        backdrop-filter: none;
        box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.5) !important;
    }
    
    .glass-input:focus {
        background: var(--bg-elevated) !important;
    }
}

/* Utility Spacing */
.mb-8 { margin-bottom: 32px !important; }
.mb-12 { margin-bottom: 48px !important; }
.mt-8 { margin-top: 48px !important; }

.search-hero {
    padding: 140px 0 80px; /* Великий відступ щоб не ховалось під меню */
    text-align: center;
    position: relative;
    z-index: 5;
}

.search-hero h1 {
    font-size: 48px;
    margin-bottom: 12px;
}

@media (max-width: 768px) {
    .search-hero {
        padding: 120px 0 60px;
    }
    .search-hero h1 {
        font-size: 32px;
    }
}

.search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: var(--radius-lg);
    background: var(--gradient-primary);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.search-btn:hover { transform: translateY(-50%) scale(1.05); }

/* Статистика в Hero */
.hero-stats {
    display: flex;
    justify-content: center;
    gap: 48px;
    flex-wrap: wrap;
}

.hero-stat {
    text-align: center;
}

.hero-stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 36px;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-stat-label {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ─── Template Cards ─── */
.template-card {
    background: var(--gradient-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10; /* Поверх фонових ефектів */
}
/* Search Highlighting & Snippets */
.search-highlight {
    background: rgba(14, 165, 233, 0.3); /* Напівпрозорий var(--primary) */
    color: #fff;
    padding: 0 2px;
    border-radius: 4px;
    font-weight: 500;
}

.template-card-snippet {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-top: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.template-card-snippet .search-highlight {
    background: rgba(14, 165, 233, 0.2);
    font-weight: normal;
}
.template-card:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-card), var(--shadow-glow);
    transform: translateY(-6px);
}

.template-card-accent {
    height: 4px;
    background: var(--gradient-primary);
    flex-shrink: 0;
}

.template-card-accent.gradient-apartment { background: linear-gradient(90deg, #3b82f6, #06b6d4); }
.template-card-accent.gradient-house { background: linear-gradient(90deg, #10b981, #34d399); }
.template-card-accent.gradient-commercial { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.template-card-accent.gradient-default { background: var(--gradient-primary); }

.template-card-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.template-card-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.template-card-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.template-card-title a {
    color: inherit;
    text-decoration: none;
}
.template-card-title a:hover { color: var(--primary-light); }

.template-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.template-card-stats {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.template-card-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.template-card-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.template-card-price {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-light);
}

.template-card-price small {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-muted);
}

.template-card-action {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    background: var(--primary-glow);
    color: var(--primary-light);
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    border: 1px solid rgba(14, 165, 233, 0.2);
    transition: all var(--transition-fast);
}

.template-card-action:hover {
    background: var(--primary-light);
    color: #fff;
    box-shadow: 0 0 15px rgba(14, 165, 233, 0.4);
}

/* Button Compare */
.btn-compare {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    margin-right: 8px;
    font-size: 16px;
    padding: 0;
}

.btn-compare:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-light);
    color: var(--primary-light);
    transform: translateY(-2px);
}

.btn-compare.active {
    background: var(--primary-glow);
    border-color: var(--primary-light);
    color: #fff;
    box-shadow: 0 0 15px rgba(14, 165, 233, 0.3);
    border-width: 1px;
}

@keyframes pulse-quick {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.pulse-quick {
    display: inline-block;
    animation: pulse-quick 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ─── Category Cards ─── */
.category-section {
    position: relative;
    z-index: 10;
    background: var(--bg-glass); /* Такий же фон, як у верхнього меню */
    backdrop-filter: blur(8px); /* Трохи зменшуємо розмиття, щоб було видно тонкі лінії */
    -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-top: -1px; /* Прибираємо можливий подвійний бордер */
}

.category-card {
    padding: 28px;
    border-radius: var(--radius-lg);
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.3), rgba(51, 65, 85, 0.15));
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
    transition: all var(--transition);
    cursor: pointer;
    text-decoration: none;
    display: block;
}

.category-card:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-glow);
    transform: translateY(-4px);
}

.category-card-icon {
    font-size: 64px;
    margin-bottom: 20px;
    display: block;
    color: var(--primary);
    transition: transform 0.3s ease;
}

.category-card-icon svg {
    width: 64px;
    height: 64px;
}

.category-card:hover .category-card-icon {
    transform: scale(1.1);
    color: var(--accent);
}

.category-card-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.category-card-count {
    font-size: 14px;
    color: var(--text-muted);
}

/* ─── Features Section ─── */
.feature-card {
    padding: 32px;
    border-radius: var(--radius-lg);
    background: var(--gradient-card);
    border: 1px solid var(--border);
    text-align: center;
    transition: all var(--transition);
}

.feature-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.feature-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.feature-icon.blue { background: var(--primary-glow); }
.feature-icon.violet { background: var(--accent-glow); }
.feature-icon.amber { background: rgba(245, 158, 11, 0.15); }
.feature-icon.green { background: rgba(16, 185, 129, 0.15); }

.feature-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.feature-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ─── Steps Section ─── */
.steps {
    display: flex;
    gap: 32px;
    position: relative;
}

.steps::before {
    content: '';
    position: absolute;
    top: 40px;
    left: 80px;
    right: 80px;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--amber));
    opacity: 0.3;
}

.step {
    flex: 1;
    text-align: center;
    position: relative;
    z-index: 1;
}

.step-num {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
}

.step-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.step-text {
    font-size: 14px;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .steps { flex-direction: column; }
    .steps::before {
        top: 0; bottom: 0;
        left: 39px; right: auto;
        width: 2px;
        height: 100%;
    }
    .step { text-align: left; display: flex; gap: 20px; align-items: flex-start; }
    .step-num { width: 56px; height: 56px; font-size: 22px; flex-shrink: 0; margin: 0; }
}

/* ─── CTA Section ─── */
.cta-section {
    padding: 80px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.cta-box {
    max-width: 700px;
    margin: 0 auto;
    padding: 56px 40px;
    border-radius: var(--radius-xl);
    background: var(--gradient-card);
    border: 1px solid var(--border);
    position: relative;
}

.cta-box h2 { margin-bottom: 12px; }
.cta-box p { color: var(--text-secondary); margin-bottom: 28px; font-size: 17px; }

/* ─── Filter Bar ─── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 20px 0;
}

.filter-select {
    padding: 10px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%2394a3b8'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.filter-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

@media (max-width: 640px) {
    .filter-bar form {
        flex-direction: column;
        align-items: stretch !important;
        gap: 16px !important;
    }
    
    .filter-bar .flex.gap-sm.items-center {
        width: 100%;
        display: flex;
        justify-content: space-between;
    }

    .filter-bar .ml-auto {
        margin-left: 0 !important;
    }

    .filter-select {
        flex: 1;
        max-width: calc(100% - 110px); /* Залишаємо місце для тексту "Уточнення:" */
        min-width: 0;
    }
}

/* ─── Кнопка скидання фільтрів ─── */
.btn-clear-filters {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 9px 14px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(244, 63, 94, 0.3);
    background: rgba(244, 63, 94, 0.07);
    color: rgb(244, 63, 94);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn-clear-filters:hover {
    background: rgba(244, 63, 94, 0.15);
    border-color: rgba(244, 63, 94, 0.6);
    box-shadow: 0 0 12px rgba(244, 63, 94, 0.15);
}

@media (max-width: 640px) {
    .btn-clear-filters {
        width: 100%;
        justify-content: center;
    }
}

.filter-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-chip {
    padding: 8px 16px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--bg-glass);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.filter-chip:hover,
.filter-chip.active {
    border-color: var(--primary);
    color: var(--primary-light);
    background: var(--primary-glow);
}

/* ─── Pagination ─── */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 40px 0;
}

.pagination a,
.pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-weight: 500;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.pagination a:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination .active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ─── Footer ─── */
.footer {
    position: relative;
    padding: 60px 0 24px;
    margin-top: 100px;
    background: var(--bg-surface);
}

.footer::before {
    content: '';
    position: absolute;
    top: -100px;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(to bottom, 
        transparent 0%, 
        var(--bg-surface) 100%
    );
    pointer-events: none;
}


.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-brand p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 12px;
    line-height: 1.6;
}

.contact-links {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.social-link:hover {
    transform: translateY(-4px);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.social-link.viber:hover { background: #7360f2; box-shadow: 0 8px 20px rgba(115, 96, 242, 0.3); }
.social-link.facebook:hover { background: #1877f2; box-shadow: 0 8px 20px rgba(24, 119, 242, 0.3); }
.social-link.telegram:hover { background: #24a1de; box-shadow: 0 8px 20px rgba(36, 161, 222, 0.3); }
.social-link.youtube:hover { background: #ff0000; box-shadow: 0 8px 20px rgba(255, 0, 0, 0.3); }
.social-link.tiktok:hover { background: #000; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4); }
.social-link.instagram:hover {
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    box-shadow: 0 8px 20px rgba(204, 35, 102, 0.3);
}

.footer-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.footer-links {
    list-style: none;
}

.footer-links a {
    display: block;
    padding: 6px 0;
    color: var(--text-secondary);
    font-size: 14px;
    transition: color var(--transition-fast);
}

.footer-links a:hover { color: var(--primary-light); }

.footer-bottom {
    padding-top: 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }
    .footer-bottom { flex-direction: column; gap: 12px; }
}

@media (max-width: 480px) {
    .footer-grid { grid-template-columns: 1fr; }
}

/* ─── Skeleton Loading ─── */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-elevated) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card {
    height: 320px;
    border-radius: var(--radius-lg);
}

/* ─── Toast Notifications ─── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
}

/* ─── Table Improvements ─── */
.table-sticky-header th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-surface); /* Must match table bg */
    box-shadow: 0 1px 0 var(--border);
}

.table-zebra tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02);
}

.table-hover tbody tr:hover {
    background-color: var(--bg-elevated);
}

/* ─── Sidebar & Excel Card ─── */
.excel-card-gradient {
    position: relative;
    padding: 2px;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, #107C41, #21A366, #107C41);
    background-size: 200% 200%;
    animation: gradientMove 5s ease infinite;
    box-shadow: 0 10px 30px -10px rgba(16, 124, 65, 0.3);
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.excel-card-inner {
    background: var(--bg-card);
    border-radius: calc(var(--radius-xl) - 2px);
    padding: 32px 24px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.excel-icon-wrapper {
    width: 72px;
    height: 72px;
    font-size: 36px;
    background: rgba(16, 124, 65, 0.1);
    color: #107C41;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    box-shadow: inset 0 0 20px rgba(16, 124, 65, 0.1);
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.share-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    transition: transform 0.2s;
    text-decoration: none;
}
.share-btn:hover { transform: scale(1.1); }
.share-btn.telegram { background: #2AABEE; box-shadow: 0 4px 12px rgba(42, 171, 238, 0.3); }
.share-btn.viber { background: #7360f2; box-shadow: 0 4px 12px rgba(115, 96, 242, 0.3); }
.share-btn.facebook { background: #1877f2; box-shadow: 0 4px 12px rgba(24, 119, 242, 0.3); }

/* ─── Mobile Sticky CTA ─── */
.mobile-sticky-cta {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 24px;
    background: rgba(17, 24, 39, 0.95); /* var(--bg-surface) with opacity */
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    z-index: 990;
    display: none; /* Hidden by default */
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-sticky-cta.active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .mobile-sticky-cta {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
    }
    /* Add padding to body so content isn't covered */
    body { padding-bottom: 80px; }
}

.mobile-cta-info {
    flex: 1;
    min-width: 0;
}

.mobile-cta-title {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.mobile-cta-price {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-light);
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
}

.toast.success { border: 1px solid var(--emerald); border-left-width: 4px; }
.toast.error { border: 2px solid var(--rose); border-left-width: 5px; box-shadow: 0 0 15px rgba(244, 63, 94, 0.2); }
.toast.info { border: 1px solid var(--primary); border-left-width: 4px; }

.toast-exit { animation: toast-out 0.3s ease forwards; }

@keyframes toast-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
    to { transform: translateX(100%); opacity: 0; }
}

@media (max-width: 640px) {
    .toast-container {
        left: 16px;
        right: 16px;
        bottom: 80px;
    }
    .toast { max-width: 100%; }
}

/* ─── Breadcrumbs ─── */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    padding: 8px 0;
    flex-wrap: wrap;
}

.breadcrumbs a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.breadcrumbs a:hover { color: var(--primary); }

.breadcrumbs span { color: var(--text-muted); }

/* ─── Empty State ─── */
.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

/* ─── Smeta Preview Container ─── */
.smeta-preview-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    position: relative;
    z-index: 10; /* Вище за анімацію bleed-through */
    transition: all var(--transition);
}

/* ─── Template Grid ─── */
.template-grid {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 32px;
    align-items: stretch;
    position: relative;
    z-index: 20; /* Гарантовано вище за будь-які Hero-ефекти */
}

@media (max-width: 768px) {
    .template-grid {
        grid-template-columns: 1fr;
    }
}

/* ─── Table Smeta Public (Adaptive) ─── */
.table-smeta-public {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 1px !important;
    max-width: 100% !important;
}

@media (max-width: 768px) {
    .table-smeta-public,
    .table-smeta-public thead,
    .table-smeta-public tbody,
    .table-smeta-public tr,
    .table-smeta-public th,
    .table-smeta-public td {
        display: block;
    }

    .table-smeta-public {
        min-width: 0 !important;
    }

    .table-smeta-public thead {
        display: none;
    }

    .table-smeta-public tr {
        display: flex;
        flex-wrap: wrap;
        border: 1px solid var(--border);
        padding: 16px;
        background: var(--bg-card);
        margin-bottom: 16px;
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-sm);
    }

    .table-smeta-public tbody td {
        display: block;
        padding: 8px 0 !important;
        border: none !important;
    }

    /* № та Назва */
    .table-smeta-public td.col-num {
        flex: 0 0 30px;
        font-weight: 700;
        color: var(--primary);
        font-size: 16px;
    }

    .table-smeta-public td.col-name {
        flex: 1 1 calc(100% - 40px);
        margin-bottom: 12px;
        font-size: 16px;
        border-bottom: 1px solid var(--border) !important;
        padding-bottom: 12px !important;
        white-space: normal !important;
    }

    /* Показники (4 шт) */
    .table-smeta-public td.col-kol,
    .table-smeta-public td.col-ei,
    .table-smeta-public td.col-price,
    .table-smeta-public td.col-sum {
        flex: 0 0 25%;
        max-width: 25%;
        text-align: center !important;
        font-size: 13px;
    }

    .table-smeta-public td:before {
        content: attr(data-label);
        display: block;
        font-size: 9px;
        color: var(--text-muted);
        text-transform: uppercase;
        margin-bottom: 2px;
        font-weight: 600;
        letter-spacing: 0.05em;
    }

    .table-smeta-public td.col-num:before,
    .table-smeta-public td.col-name:before {
        display: none;
    }

    /* Розділи */
    .table-smeta-public tr.bg-elevated,
    .table-smeta-public tr.bg-surface,
    .table-smeta-public tr.bg-primary-glow {
        flex: 0 0 100%;
        display: block !important;
        text-align: center !important;
        padding: 12px !important;
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        margin-bottom: 8px;
    }

    .table-smeta-public tr.bg-elevated td,
    .table-smeta-public tr.bg-surface td,
    .table-smeta-public tr.bg-primary-glow td {
        width: 100% !important;
        padding: 0 !important;
        font-size: 18px !important;
        white-space: normal !important;
    }

    .table-smeta-public tr.bg-primary-glow td:before { display: none; }
}

.empty-state p {
    color: var(--text-muted);
    max-width: 400px;
    margin: 0 auto;
}

/* ─── Login Modal ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    max-width: 420px;
    width: 100%;
    padding: 40px;
    border-radius: var(--radius-xl);
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: modal-in 0.3s ease;
}

@keyframes modal-in {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-box h3 { margin-bottom: 12px; }
.modal-box p { color: var(--text-secondary); margin-bottom: 24px; font-size: 15px; }

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 20px;
}


@media (max-width: 768px) {
    body { padding-bottom: 0px; }
}

/* ─── Template Hero (Animated) ─── */
.template-hero {
    position: relative;
    padding: 76px 0 60px !important; /* 72px меню + 4px мінімальний зазор */
    background: linear-gradient(-45deg, #0b1120, #1a1e2e, #111827, #0b1120);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    overflow: visible;
}

.template-hero::after {
    content: '';
    position: absolute;
    bottom: -150px;
    left: 0;
    right: 0;
    height: 300px;
    background: linear-gradient(to bottom, 
        transparent 0%, 
        rgba(11, 17, 32, 0.4) 20%, 
        rgba(11, 17, 32, 0.8) 50%, 
        var(--bg-body) 100%
    );
    z-index: 1;
    pointer-events: none;
}

[data-theme="light"] .template-hero {
    background: linear-gradient(-45deg, #f1f5f9, #e2e8f0, #f8fafc, #f1f5f9);
    background-size: 400% 400%;
}

#hero-canvas {
    position: absolute;
    top: -72px; /* Виносимо canvas вгору під навбар */
    left: 0;
    width: 100%;
    height: calc(130% + 72px); /* Компенсуємо зсув */
    z-index: 1;
    pointer-events: none;
    opacity: 0.8;
}

/* На мобільних піднімаємо шейдер вище, щоб він був за заголовком */
@media (max-width: 768px) {
    #hero-canvas {
        top: -230px; /* Зсуваємо ще на 200px вгору від базової позиції */
    }
}

/* Ховаємо іконку в кнопці копіювання на мобільних */
@media (max-width: 768px) {
    .hero-price-card-wrapper .btn-primary svg,
    .hero-price-card-wrapper .btn-primary i {
        display: none !important;
    }
}

.template-hero .container {
    position: relative;
    z-index: 10;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Адаптивність блоку вартості в Hero */
.hero-price-card-wrapper {
    flex: 0 0 auto;
    width: 100%;
    max-width: 400px;
    position: relative;
    z-index: 30; /* Найвищий пріоритет */
}
/* Форсований z-index для липкого контенту Excel */
.template-grid aside > div[style*="position: sticky"] {
    z-index: 30 !important;
}

@media (max-width: 1024px) {
    .hero-price-card-wrapper {
        max-width: 100%;
        flex: 1;
    }
}

@media (max-width: 640px) {
    .hero-price-card-wrapper {
        min-width: 100%;
    }
}

/* ─── Modern Share Buttons ─── */
.share-buttons {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 8px 0;
}

.share-btn-new {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-decoration: none;
    position: relative;
    overflow: visible;
    backdrop-filter: blur(8px);
}

.share-btn-new.telegram { --spotlight-color: #0088CC; }
.share-btn-new.viber { --spotlight-color: #7360F2; }
.share-btn-new.facebook { --spotlight-color: #1877F2; }

.share-btn-new:hover {
    transform: translateY(-8px) scale(1.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.4);
}

.share-btn-new.telegram:hover { 
    background: #0088CC; 
    box-shadow: 0 0 20px rgba(0, 136, 204, 0.6), 0 0 40px rgba(0, 136, 204, 0.3);
}
.share-btn-new.viber:hover { 
    background: #7360F2; 
    box-shadow: 0 0 20px rgba(115, 96, 242, 0.6), 0 0 40px rgba(115, 96, 242, 0.3);
}
.share-btn-new.facebook:hover { 
    background: #1877F2; 
    box-shadow: 0 0 20px rgba(24, 119, 242, 0.6), 0 0 40px rgba(24, 119, 242, 0.3);
}

.share-btn-new svg {
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.share-btn-new:hover svg {
    transform: scale(1.1) rotate(5deg);
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

/* ─── Виправлення шарів контенту ─── */
.excel-card-inner, 
.excel-card-gradient,
.spotlight-card:not(.navbar) {
    position: relative;
    z-index: 10;
}

/* ─── Кнопка Вгору (Scroll Top) ─── */
.scroll-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 995;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.scroll-top-btn:hover {
    background: var(--bg-glass-hover);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 0 20px var(--primary-glow);
}

.scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

@media (max-width: 768px) {
    .scroll-top-btn {
        bottom: 100px; /* Вище над мобільним CTA */
        right: 20px;
        width: 44px;
        height: 44px;
    }
}

/* ─── Редизайн таблиці кошторису (Premium Smeta) ─── */

/* Контейнер для таблиць та блоків опису */
.smeta-preview-container {
    padding: 40px !important; /* Десктоп за замовчуванням */
    transition: padding 0.3s ease;
}

/* Виправляємо контейнер для роботи sticky */
.table-responsive {
    overflow: visible !important; /* Розблоковує sticky на десктопі */
}

/* Форсуємо видимість для grid та інших контейнерів, щоб не ламати sticky */
.template-grid, 
.template-grid > div,
.smeta-preview-container {
    overflow: visible !important;
}

@media (max-width: 1024px) {
    .table-responsive {
        overflow-x: auto;
        overflow-y: visible !important;
    }
}

/* Sticky Header для таблиці */
.table-smeta-public {
    border-collapse: separate !important; /* Необхідно для надійної роботи sticky */
    border-spacing: 0 !important;
}

.table-sticky-header thead th {
    position: sticky !important;
    top: 72px !important; /* Висота навбара за замовчуванням */
    z-index: 100 !important; 
    background: #0f172a !important; 
    border-bottom: 2px solid var(--primary) !important;
    white-space: nowrap;
    padding: 14px 12px !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    transition: top 0.3s ease-in-out; /* Плавно рухаємо шапку за меню */
}

/* Якщо меню сховане — піднімаємо шапку до самого верху */
.nav-is-hidden .table-sticky-header thead th {
    top: 0 !important;
}

/* Оптимізація ширини та падінгів колонок */
.table-smeta-public th, 
.table-smeta-public td {
    padding: 10px 8px !important; /* Ущільнюємо таблицю */
    vertical-align: middle;
}

.table-smeta-public .col-num { width: 40px !important; text-align: center; padding-left: 15px !important; }
.table-smeta-public .col-kol,
.table-smeta-public .col-ei,
.table-smeta-public .col-price,
.table-smeta-public .col-sum { 
    width: 1% !important; 
    white-space: nowrap; 
}

/* Колонку з назвою робимо гнучкою */
.table-smeta-public .col-name { width: auto; }

/* Стилізація Розділів */
.row-section {
    background: linear-gradient(90deg, #1e293b, #0f172a) !important;
}

.row-section td {
    color: var(--primary-light) !important;
    font-weight: 700;
    text-transform: uppercase;
    padding: 20px !important;
    text-align: center !important;
    letter-spacing: 1px;
    white-space: normal !important; /* ДОЗВОЛЯЄМО ПЕРЕНЕСЕННЯ */
    word-break: break-word !important;
}

/* Стилізація Підрозділів */
.row-subsection {
    background: rgba(14, 165, 233, 0.1) !important;
}

.row-subsection td {
    padding: 14px !important;
    text-align: center !important;
    font-weight: 600;
    color: var(--text-primary);
    white-space: normal !important;
    word-break: break-word !important;
}

/* Вирівнювання назв підсумків - впритул до цифр */
.subsection-footer td, 
.section-footer td,
.grand-total-row td {
    white-space: nowrap !important;
}

.subsection-footer .sum-label,
.section-footer .sum-label {
    white-space: normal; /* Тільки текстова мітка може переноситися, якщо дуже довга, але ми заборонили це вище для td */
}

.subsection-footer td:first-child, 
.section-footer td:first-child,
.grand-total-row td:first-child {
    text-align: right !important;
    padding-right: 20px !important;
}

/* Мобільна версія (Premium Card Layout) */
@media (max-width: 768px) {
    .table-smeta-public thead { display: none; } /* Ховаємо десктопну шапку */
    
    /* Скидання табличних властивостей, які можуть розпирати */
    .table-smeta-public,
    .table-smeta-public tbody,
    .table-smeta-public td,
    .table-smeta-public tr {
        display: block;
        width: 100% !important;
        box-sizing: border-box !important;
        max-width: 100% !important;
    }

    /* Контейнер рядка - перетворюємо на картку */
    /* Контейнер рядка - перетворюємо на картку (FLEX) */
    .table-smeta-public tr.row-work,
    .table-smeta-public tr:not([class]) { 
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: flex-start;
        gap: 0;
        margin-bottom: 12px;
        padding: 16px !important; 
        background: var(--bg-surface-elevated);
        border: 1px solid var(--border);
        border-radius: 12px;
        box-shadow: var(--shadow-sm);
        position: relative;
        
        /* Гарантуємо, що картка не розпирає контейнер */
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        box-sizing: border-box !important;
    }

    /* Повне усунення зовнішньої обгортки на мобайлі */
    /* Повне усунення зовнішньої обгортки на мобайлі */
    .smeta-preview-container.card,
    .smeta-preview-container {
        padding: 0 !important; /* ПРИБИРАЄМО падінг, щоб вирівняти заголовок і таблицю з Hero */
        background: none !important;
        border: none !important;
        box-shadow: none !important;
        margin-bottom: 32px !important;
        width: 100% !important;
        overflow-x: clip !important; /* БЛОКУЄМО СКРОЛ БЕЗЛАМНО */
        box-sizing: border-box !important;
    }

    /* Окремі правила для Опису шаблону */
    .smeta-preview-container:has(p),
    .smeta-preview-container:has(.text-secondary) {
        background: var(--bg-card) !important;
        border: 1px solid var(--border) !important;
        padding: 16px !important; 
        border-radius: 16px !important;
        box-shadow: var(--shadow-sm) !important;
        display: block !important;
        width: 100% !important; 
        margin: 0 0 24px 0 !important; /* Тільки нижній відступ */
    }
    
    /* Заголовки розділів - зменшуємо, щоб не розпирали */
    .smeta-preview-container h3 {
        font-size: 18px !important;
        padding-left: 0 !important;
    }

    /* Порядковий номер */
    .table-smeta-public .col-num {
        /* grid-area deleted */
        display: flex !important;
        align-items: center;
        justify-content: center;
        font-size: 16px !important;
        font-weight: 800 !important;
        color: var(--primary) !important;
        padding: 0 !important;
        background: rgba(14, 165, 233, 0.1) !important;
        border-radius: 8px;
        width: 32px;
        height: 32px;
        margin-right: 12px;
        flex-shrink: 0;
    }
    .table-smeta-public .col-num::before { display: none !important; }

    /* Назва роботи */
    .table-smeta-public .col-name {
        /* grid-area deleted */
        display: block !important;
        text-align: left !important;
        padding: 0 !important;
        margin-bottom: 16px; /* Відступ до нижнього ряду параметрів */
        border: none !important;
        width: calc(100% - 44px); /* Займає всю ширину мінус номер і відступ */
    }
    .table-smeta-public .col-name::before { display: none !important; }
    .table-smeta-public .p-name {
        font-size: 16px;
        font-weight: 700;
        line-height: 1.4;
        color: var(--text-primary);
    }
    .table-smeta-public .p-desc {
        font-size: 12px;
        margin-top: 4px;
    }

    /* Числові колонки (нижній ряд - Flex) */
    .table-smeta-public .col-kol,
    .table-smeta-public .col-ei,
    .table-smeta-public .col-price,
    .table-smeta-public .col-sum { 
        /* grid-area deleted */
        flex: 1; /* Рівномірний розподіл */
        min-width: 0; /* Дозволяє стискатися тексту */
        padding-right: 4px !important; /* Невеликий зазор між колонками */
    }
    .table-smeta-public .col-sum { padding-right: 0 !important; }

    .table-smeta-public .col-kol,
    .table-smeta-public .col-ei,
    .table-smeta-public .col-price,
    .table-smeta-public .col-sum {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        justify-content: flex-end !important;
        padding: 12px 0 0 0 !important;
        border-top: 1px solid rgba(255,255,255,0.05) !important;
        text-align: left !important;
        font-size: 14px !important;
    }

    /* Ярлики над значеннями */
    .table-smeta-public .col-kol::before,
    .table-smeta-public .col-ei::before,
    .table-smeta-public .col-price::before,
    .table-smeta-public .col-sum::before {
        content: attr(data-label);
        display: block;
        font-size: 10px;
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-bottom: 4px;
    }

    .table-smeta-public .col-sum {
        color: var(--primary-light) !important;
        font-weight: 700 !important;
        align-items: flex-end !important;
        text-align: right !important;
    }
    .table-smeta-public .col-sum::before {
        width: 100%;
        text-align: right;
    }

    /* Розділи та Підрозділи (Залишаємо центрованими) */
    .table-smeta-public tr.row-section,
    .table-smeta-public tr.row-subsection {
        display: block !important;
        background: linear-gradient(90deg, var(--primary-glow), transparent) !important;
        border: none !important;
        margin: 24px 0 12px !important;
        padding: 12px !important;
        border-radius: 8px;
    }

    .table-smeta-public tr.row-section td,
    .table-smeta-public tr.row-subsection td {
        display: block !important;
        width: 100% !important;
        text-align: center !important;
        padding: 0 !important;
        background: none !important;
        border: none !important;
        font-size: 16px !important;
        color: var(--primary-light) !important;
    }
    .table-smeta-public tr.row-section td::before,
    .table-smeta-public tr.row-subsection td::before { display: none; }

    /* Підсумки в мобільній версії (робимо клікабельними) */
    .table-smeta-public tr.row-section,
    .table-smeta-public tr.row-subsection,
    .table-smeta-public tr.subsection-footer,
    .table-smeta-public tr.section-footer {
        cursor: pointer !important;
        transition: transform 0.1s ease, background 0.1s ease !important;
    }
    
    .table-smeta-public tr.row-section:active,
    .table-smeta-public tr.row-subsection:active,
    .table-smeta-public tr.subsection-footer:active,
    .table-smeta-public tr.section-footer:active {
        transform: scale(0.98);
        background: rgba(255,255,255,0.1) !important;
    }

    .table-smeta-public tr.subsection-footer,
    .table-smeta-public tr.section-footer,
    .table-smeta-public tr.grand-total-row {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        background: rgba(255,255,255,0.03);
        margin-bottom: 8px;
        padding: 12px 20px !important;
        border-radius: 12px;
    }

    .table-smeta-public tr.subsection-footer td,
    .table-smeta-public tr.section-footer td,
    .table-smeta-public tr.grand-total-row td {
        display: block !important;
        padding: 0 !important;
        border: none !important;
        white-space: nowrap !important;
    }
}

/* ─── Search Persistence Extras ─── */
.search-clear-link {
    display: inline-block;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-decoration: none;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
}

.search-clear-link:hover {
    color: var(--primary);
    background: rgba(14, 165, 233, 0.1);
}

/* Кнопка повернення до пошуку на головній */
.search-resume-link {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    padding: 16px 28px;
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    text-decoration: none;
    color: #fff;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
    max-width: 100%;
}

.search-resume-link:hover {
    background: rgba(30, 41, 59, 0.6);
    border-color: var(--primary-light);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 20px 50px -10px rgba(14, 165, 233, 0.3);
}

.search-resume-icon {
    font-size: 20px;
}

.search-resume-text {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.2;
}

.search-resume-query {
    display: block;
    color: var(--primary-light);
    font-weight: 700;
    font-size: 18px;
    margin-top: 2px;
}

.search-resume-arrow {
    font-size: 24px;
    color: var(--primary-light);
    transition: transform 0.3s ease;
}

.search-resume-link:hover .search-resume-arrow {
    transform: translateX(6px);
}

@media (max-width: 640px) {
    .search-resume-link {
        padding: 12px 20px;
        gap: 12px;
    }
    .search-resume-text { font-size: 14px; }
    .search-resume-query { font-size: 16px; }
}

.search-box.is-resume {
    background: transparent !important;
    border: none !important;
    border-width: 0 !important;
    box-shadow: none !important;
    outline: none !important;
}

.search-box.is-resume::after,
.search-box.is-resume::before {
    display: none !important;
    content: none !important;
    opacity: 0 !important;
    mask: none !important;
    -webkit-mask: none !important;
}

/* ─── PWA Install Banner ─── */
.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: rgba(15, 23, 42, 0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(14, 165, 233, 0.2);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
    padding: 16px 24px;
    animation: pwa-slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pwa-slide-up {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.pwa-install-content {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.pwa-install-icon {
    flex-shrink: 0;
}

.pwa-install-text {
    flex: 1;
    min-width: 0;
}

.pwa-install-text strong {
    display: block;
    font-size: 15px;
    color: #fff;
    margin-bottom: 2px;
}

.pwa-install-text span {
    font-size: 13px;
    color: var(--text-muted);
}

.pwa-install-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.pwa-install-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: color 0.2s;
}

.pwa-install-close:hover {
    color: #fff;
}

@media (max-width: 480px) {
    .pwa-install-content {
        flex-wrap: wrap;
    }
    .pwa-install-text {
        flex: 1 1 calc(100% - 70px);
    }
    .pwa-install-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ─── Push Subscribe Button ─── */
.push-subscribe-bar {
    display: flex;
    justify-content: flex-end;
}

.btn-push-subscribe {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(14, 165, 233, 0.3);
    background: rgba(14, 165, 233, 0.08);
    color: var(--primary-light);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-push-subscribe:hover {
    background: rgba(14, 165, 233, 0.15);
    border-color: rgba(14, 165, 233, 0.5);
    box-shadow: 0 0 16px rgba(14, 165, 233, 0.15);
    transform: translateY(-1px);
}

.btn-push-subscribe.subscribed {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.1);
    color: var(--emerald);
}

.btn-push-subscribe.subscribed:hover {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.6);
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.15);
}

.btn-push-subscribe svg {
    transition: transform 0.3s ease;
}

.btn-push-subscribe:hover svg {
    animation: bell-ring 0.5s ease;
}

@keyframes bell-ring {
    0% { transform: rotate(0); }
    20% { transform: rotate(15deg); }
    40% { transform: rotate(-15deg); }
    60% { transform: rotate(10deg); }
    80% { transform: rotate(-5deg); }
    100% { transform: rotate(0); }
}

@media (max-width: 640px) {
    .push-subscribe-bar {
        justify-content: center;
    }
    .btn-push-subscribe {
        width: 100%;
        justify-content: center;
    }
}

/* Стан завантаження */
.btn-push-subscribe.loading {
    opacity: 0.8;
    cursor: wait;
    pointer-events: none;
    border-color: rgba(14, 165, 233, 0.2);
    background: rgba(14, 165, 233, 0.05);
}

.btn-push-subscribe.loading::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(14, 165, 233, 0.3);
    border-top-color: var(--primary-light);
    border-radius: 50%;
    animation: push-spinner 0.7s linear infinite;
    margin-right: 8px;
    flex-shrink: 0;
}

@keyframes push-spinner {
    to { transform: rotate(360deg); }
}

/* Bounce при успішній зміні стану */
.btn-push-subscribe.push-bounce {
    animation: push-bounce-anim 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes push-bounce-anim {
    0% { transform: scale(1); }
    30% { transform: scale(1.08); }
    60% { transform: scale(0.96); }
    100% { transform: scale(1); }
}


