* {
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

body {
    margin: 0;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    color: #1a1a1a;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 24px;
}

h1 {
    margin: 0 0 24px 0;
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(90deg, #0078d4, #00a4ef);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.search-form {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
    background: white;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.search-form input[type="search"] {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid #e1e5eb;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #f8fafc;
}

.search-form input[type="search"]:focus {
    outline: none;
    border-color: #0078d4;
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.1);
}

.search-form button {
    padding: 14px 28px;
    border: none;
    background: linear-gradient(135deg, #0078d4, #00a4ef);
    color: white;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 120, 212, 0.2);
}

.search-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 120, 212, 0.3);
    background: linear-gradient(135deg, #006cbd, #0098e1);
}

.search-form .clear {
    align-self: center;
    margin-left: 12px;
    color: #666;
    text-decoration: none;
    font-weight: 500;
    padding: 10px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.search-form .clear:hover {
    color: #0078d4;
    background: rgba(0, 120, 212, 0.1);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 32px;
}

.card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #0078d4, #00a4ef);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.card:hover::before {
    opacity: 1;
}

.card a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 16px;
    transition: transform 0.3s ease;
}

.card:hover img {
    transform: scale(1.05);
}

.card h2 {
    font-size: 18px;
    margin: 12px 0 8px 0;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.4;
}

.card .price {
    font-weight: 700;
    color: #0078d4;
    font-size: 20px;
    margin: 12px 0 6px 0;
}

.card .category {
    font-size: 13px;
    color: #666;
    background: #f0f7ff;
    padding: 4px 10px;
    border-radius: 20px;
    display: inline-block;
    margin: 8px 0;
}

.card .stock-info {
    font-size: 14px;
    font-weight: 500;
    margin: 12px 0 0 0;
    padding: 6px 12px;
    border-radius: 6px;
    display: inline-block;
}

.card .stock-info:contains("✓") {
    background: rgba(0, 200, 83, 0.1);
    color: #00c853;
}

.card .stock-info:contains("✗") {
    background: rgba(244, 67, 54, 0.1);
    color: #f44336;
}

.back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    color: #0078d4;
    text-decoration: none;
    font-weight: 600;
    padding: 12px 20px;
    background: rgba(0, 120, 212, 0.1);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.back:hover {
    background: rgba(0, 120, 212, 0.2);
    transform: translateX(-4px);
    color: #006cbd;
}

.back::before {
    content: '\2190';
    font-size: 18px;
}

.product-detail {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
}

.product-image {
    width: 500px;
    max-width: 45%;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.product-meta {
    flex: 1;
}

.product-meta h1 {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 2.2rem;
    color: #1a1a1a;
}

.product-meta .price {
    font-size: 2rem;
    font-weight: 700;
    color: #0078d4;
    margin: 20px 0;
    padding: 10px 0;
    border-bottom: 2px solid #f0f7ff;
}

.product-meta p {
    margin: 16px 0;
    color: #444;
    line-height: 1.7;
}

.product-meta .sku,
.product-meta .model,
.product-meta .stock,
.product-meta .category {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #f8fafc;
    border-radius: 10px;
    margin: 12px 0;
}

.product-meta .sku::before {
    content: '📦';
}

.product-meta .model::before {
    content: '🔧';
}

.product-meta .stock::before {
    content: '📊';
}

.product-meta .category::before {
    content: '🏷️';
}

.attachments {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 2px solid #f0f7ff;
}

.attachments h3 {
    color: #1a1a1a;
    margin-bottom: 16px;
    font-size: 1.3rem;
}

.attachment-images {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.attachment-images img {
    width: 180px;
    height: 120px;
    object-fit: cover;
    border-radius: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
}

.attachment-images img:hover {
    transform: scale(1.05);
    border-color: #0078d4;
    box-shadow: 0 4px 12px rgba(0, 120, 212, 0.2);
}

@media (max-width: 768px) {
    .container {
        margin: 20px auto;
        padding: 0 16px;
    }

    h1 {
        font-size: 2rem;
    }

    .search-form {
        flex-direction: column;
    }

    .product-detail {
        flex-direction: column;
        padding: 24px;
    }

    .product-image {
        max-width: 100%;
        width: 100%;
    }

    .grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 16px;
    }

    .attachment-images {
        justify-content: center;
    }

    .attachment-images img {
        width: 150px;
        height: 100px;
    }
}

/* Анимация загрузки карточек */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeInUp 0.4s ease-out;
    animation-fill-mode: both;
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }
.card:nth-child(4) { animation-delay: 0.4s; }
.card:nth-child(5) { animation-delay: 0.5s; }
.card:nth-child(n+6) { animation-delay: 0.6s; }

/* Стили для бренда TOTAL */
.brand-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: linear-gradient(135deg, #ff6b6b, #ff8e53);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    z-index: 1;
}

/* Плавный скролл */
html {
    scroll-behavior: smooth;
}

/* Стили пагинации */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 40px 0 20px;
    flex-wrap: wrap;
}

.pagination-info {
    background: #f8fafc;
    padding: 12px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.pagination-info p {
    margin: 0;
    color: #555;
    font-size: 14px;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    background: white;
    border: 1px solid #e1e5eb;
    color: #555;
}

.pagination a:hover {
    background: #0078d4;
    color: white;
    border-color: #0078d4;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 120, 212, 0.2);
}

.pagination-current {
    background: linear-gradient(135deg, #0078d4, #00a4ef);
    color: #999 !important;
    border-color: #0078d4 !important;
    font-weight: 600;
}

.pagination-ellipsis {
    background: transparent !important;
    border: none !important;
    color: #999;
    font-size: 18px;
}

.pagination-first,
.pagination-last,
.pagination-prev,
.pagination-next {
    font-size: 18px;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    grid-column: 1 / -1;
    color: #666;
    font-size: 18px;
}

/* Адаптивность пагинации */
@media (max-width: 768px) {
    .pagination {
        gap: 4px;
    }

    .pagination a,
    .pagination span {
        min-width: 36px;
        height: 36px;
        padding: 0 8px;
        font-size: 14px;
    }

    .pagination-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .pagination a,
    .pagination span {
        min-width: 32px;
        height: 32px;
        padding: 0 6px;
        font-size: 13px;
    }

    .pagination-first,
    .pagination-last,
    .pagination-prev,
    .pagination-next {
        font-size: 16px;
    }
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

@media (max-width: 600px) {
    .grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
}