/* ===== GLOBAL & VARIABLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #1E40AF;
    --primary-dark: #1E3A8A;
    --primary-light: #3B82F6;
    --accent: #991B1B;
    --accent-light: #DC2626;
    --metal: #64748B;
    --metal-light: #94A3B8;
    --bg: #F8FAFC;
    --bg-card: #FFFFFF;
    --bg-dark: #0F172A;
    --text: #1E293B;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --border: #E2E8F0;
    --success: #059669;
    --danger: #DC2626;
    --shadow: 0 2px 8px rgba(30, 64, 175, 0.08);
    --shadow-lg: 0 8px 24px rgba(30, 64, 175, 0.12);
    --radius: 6px;
    --radius-lg: 10px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

/* ===== NAV ===== */
.nav {
    background: var(--bg-dark);
    border-bottom: 2px solid var(--primary);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 20px;
    flex-shrink: 0;
    color: white;
}

.logo-mark {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-text span {
    color: var(--primary-light);
}

.nav-actions {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-left: auto;
}

.nav-icon-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    color: var(--metal-light);
    transition: all 0.2s;
    font-size: 17px;
    position: relative;
}

.nav-icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--accent-light);
    color: white;
    font-size: 10px;
    font-weight: 700;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-dark);
}

.nav-badge:empty,
.nav-badge[data-count="0"] {
    display: none;
}

/* ===== HERO ===== */
.hero {
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1E293B 100%);
    padding: 50px 24px 60px;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -100px;
    right: -100px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
    border-radius: 50%;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: -150px;
    left: -100px;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(220, 38, 38, 0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.hero-inner {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    text-align: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-light);
    margin-bottom: 20px;
}

.hero-badge .ai-dot {
    width: 6px;
    height: 6px;
    background: var(--primary-light);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.hero h1 {
    font-size: 40px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
    color: white;
}

.hero h1 span {
    color: var(--primary-light);
}

.hero-subtitle {
    font-size: 18px;
    color: var(--metal-light);
    margin-bottom: 12px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

.hero-description {
    font-size: 15px;
    color: var(--metal);
    margin-bottom: 32px;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

.hero-search {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    max-width: 640px;
    margin: 0 auto;
}

.hero-search input {
    flex: 1;
    padding: 18px 22px;
    border: none;
    outline: none;
    font-size: 16px;
    font-family: inherit;
    color: white;
    background: transparent;
}

.hero-search input::placeholder {
    color: var(--metal-light);
}

.hero-search button {
    padding: 0 32px;
    background: var(--primary);
    color: white;
    font-weight: 700;
    font-size: 15px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hero-search button:hover {
    background: var(--primary-light);
}

.hero-tags {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
    font-size: 13px;
}

.hero-tag {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--metal-light);
}

.hero-tag:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    border-color: var(--primary-light);
}

/* ===== SECTIONS ===== */
.section {
    max-width: 1280px;
    margin: 0 auto;
    padding: 40px 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
}

.section-link {
    color: var(--primary);
    font-size: 14px;
    font-weight: 600;
}

.section-link:hover {
    text-decoration: underline;
}

/* ===== TRENDING ===== */
.trending-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: all 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    position: relative;
}

.product-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.fav-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--metal-light);
    transition: all 0.2s;
    z-index: 2;
}

.fav-btn:hover {
    background: white;
    transform: scale(1.1);
}

.fav-btn.active {
    color: var(--danger);
}

.product-thumb {
    width: 100%;
    aspect-ratio: 1;
    background: linear-gradient(135deg, #E0E7FF 0%, #C7D2FE 100%);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.product-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 38px;
}

.product-rating {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.product-rating .stars {
    color: #F59E0B;
}

.product-bottom {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-price {
    font-size: 17px;
    font-weight: 800;
    color: var(--text);
}

.product-price small {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.product-cta {
    padding: 8px 14px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 600;
    transition: background 0.2s;
}

.product-cta:hover {
    background: var(--primary-light);
}

/* ===== DEALS ===== */
.deals-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.deal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    gap: 16px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.deal-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.deal-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--accent);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

.deal-thumb {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.deal-info {
    flex: 1;
    min-width: 0;
}

.deal-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.deal-prices {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

.deal-price-new {
    font-size: 17px;
    font-weight: 800;
    color: var(--success);
}

.deal-price-old {
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: line-through;
}

.deal-shops {
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== RESULTS PAGE ===== */
.results-page {
    display: none;
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 24px 60px;
}

.results-page.active {
    display: block;
}

.results-header {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 28px;
    display: flex;
    gap: 24px;
    align-items: center;
}

.results-product-image {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, #E0E7FF 0%, #C7D2FE 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.results-product-info {
    flex: 1;
}

.results-product-name {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--text);
    line-height: 1.2;
}

.results-product-meta {
    display: flex;
    gap: 16px;
    font-size: 14px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.results-product-meta .stars {
    color: #F59E0B;
    font-weight: 600;
}

.results-price-range {
    text-align: right;
    padding-left: 24px;
    border-left: 2px solid var(--border);
}

.results-price-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
    font-weight: 600;
}

.results-price-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 6px;
}

.results-price-savings {
    font-size: 13px;
    color: var(--success);
    font-weight: 600;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 24px;
    transition: all 0.2s;
}

.back-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.offers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.offer-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    position: relative;
}

.offer-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.offer-card.best {
    border-color: var(--success);
    border-width: 2px;
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.03), transparent);
}

.offer-best-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--success);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.offer-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.offer-mp-logo {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 11px;
    flex-shrink: 0;
}

.offer-mp-info {
    flex: 1;
}

.offer-mp-name {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 2px;
}

.offer-delivery {
    font-size: 12px;
    color: var(--text-muted);
}

.offer-price-section {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.offer-price {
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}

.offer-card.best .offer-price {
    color: var(--success);
}

.offer-diff {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.offer-cta {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s;
    flex-shrink: 0;
}

.offer-cta:hover {
    background: var(--primary-light);
}

.offer-card.best .offer-cta {
    background: var(--success);
}

.offer-card.best .offer-cta:hover {
    background: #047857;
}

/* ===== FOOTER ===== */
.footer {
    background: var(--bg-dark);
    color: var(--metal-light);
    padding: 40px 24px 24px;
    border-top: 2px solid var(--primary);
}

.footer-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.footer-brand .logo {
    color: white;
}

.footer-brand p {
    font-size: 13px;
    max-width: 320px;
    color: var(--metal);
}

.footer-links {
    display: flex;
    gap: 24px;
    font-size: 13px;
}

.footer-links a {
    color: var(--metal-light);
    cursor: pointer;
}

.footer-links a:hover {
    color: var(--primary-light);
}

/* ===== MODAL WINDOWS ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 32px;
    position: relative;
    animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg);
    border: none;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.modal-close:hover {
    background: var(--border);
}

.modal h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text);
}

.modal h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 20px 0 12px;
    color: var(--text);
}

.modal h4 {
    font-size: 15px;
    font-weight: 600;
    margin: 16px 0 8px;
    color: var(--text);
}

.modal p {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.modal ul {
    margin-left: 20px;
    margin-bottom: 12px;
}

.modal li {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.affiliate-notice {
    background: var(--bg);
    border-left: 4px solid var(--primary);
    padding: 16px;
    border-radius: var(--radius);
    margin: 20px 0;
}

.affiliate-notice strong {
    color: var(--primary);
    display: block;
    margin-bottom: 8px;
}

/* ===== FAVORITES & HISTORY LIST ===== */
.fav-list,
.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.fav-item,
.history-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.2s;
}

.fav-item:hover,
.history-item:hover {
    border-color: var(--primary);
    background: var(--bg-card);
}

.fav-item-thumb,
.history-item-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #E0E7FF 0%, #C7D2FE 100%);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    flex-shrink: 0;
    text-transform: uppercase;
}

.history-item-icon {
    background: var(--bg-card);
    color: var(--metal);
    font-size: 18px;
}

.fav-item-info,
.history-item-info {
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.fav-item-name,
.history-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fav-item-price {
    font-size: 13px;
    color: var(--success);
    font-weight: 700;
}

.history-item-time {
    font-size: 12px;
    color: var(--text-muted);
}

.fav-item-remove,
.history-item-remove {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.fav-item-remove:hover,
.history-item-remove:hover {
    background: rgba(220, 38, 38, 0.1);
    color: var(--danger);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.btn-clear {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-clear:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* ===== АДАПТИВ ===== */
@media (max-width: 900px) {
    .trending-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .deals-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .offers-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .hero h1 {
        font-size: 28px;
    }

    .hero {
        padding: 40px 20px 50px;
    }

    .trending-grid,
    .deals-grid {
        grid-template-columns: 1fr;
    }

    .offers-grid {
        grid-template-columns: 1fr;
    }

    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .results-header {
        flex-direction: column;
        text-align: center;
    }

    .results-price-range {
        text-align: center;
        padding-left: 0;
        border-left: none;
        border-top: 2px solid var(--border);
        padding-top: 20px;
        width: 100%;
    }

    .modal {
        padding: 24px;
    }
}
