/* style.css - финальная версия с компактным дизайном */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark-color: #1f2937;
    --light-color: #f9fafb;
    --gray-color: #6b7280;
    --border-color: #e5e7eb;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--light-color);
    color: var(--dark-color);
    line-height: 1.5;
    font-size: 14px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Header - компактный */
.header {
    background: linear-gradient(135deg, var(--dark-color) 0%, #374151 100%);
    color: white;
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo .accent {
    color: var(--primary-color);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-slogan {
    font-size: 0.7rem;
    color: var(--gray-color);
    margin-top: 2px;
}

.header-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* Search - компактный */
.search-container {
    position: relative;
    width: 280px;
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-color);
    font-size: 0.8rem;
}

.search-input {
    width: 100%;
    padding: 8px 35px 8px 35px;
    border: 2px solid transparent;
    border-radius: 30px;
    font-size: 0.9rem;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
}

.search-input:focus {
    outline: none;
    background: white;
    color: var(--dark-color);
    border-color: var(--primary-color);
}

.search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-color);
    cursor: pointer;
    display: none;
    padding: 4px;
    font-size: 0.8rem;
}

/* View Toggle - компактный */
.view-toggle {
    display: flex;
    gap: 3px;
    background: rgba(255, 255, 255, 0.1);
    padding: 3px;
    border-radius: 30px;
}

.view-btn {
    background: none;
    border: none;
    color: white;
    padding: 6px 10px;
    border-radius: 25px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.8rem;
}

.view-btn.active {
    background: var(--primary-color);
}

/* Filters - компактный */
.filters-section {
    background: white;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 68px;
    z-index: 99;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.filters-wrapper {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-group label {
    font-weight: 500;
    color: var(--gray-color);
    font-size: 0.75rem;
}

.filter-select {
    padding: 6px 22px 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 30px;
    font-size: 0.85rem;
    cursor: pointer;
    background: white;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

/* Products Grid - компактный */
.main-content {
    flex: 1;
    padding: 20px 0;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

/* Product Card - компактный */
.product-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 12px -4px rgba(0, 0, 0, 0.15);
}

.product-image {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    overflow: hidden;
    background-color: #f5f5f5;
    cursor: zoom-in;
}

.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.2s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.03);
}

.product-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--primary-color);
    color: white;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 500;
    z-index: 2;
}

.product-info {
    padding: 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.product-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--dark-color);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.5em;
}

.product-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--gray-color);
    font-size: 0.7rem;
    margin-top: auto;
}

.product-photos-count i {
    color: var(--secondary-color);
    font-size: 0.7rem;
}

/* List View - компактный */
.products-grid.list-view {
    grid-template-columns: 1fr;
}

.products-grid.list-view .product-card {
    display: flex;
    flex-direction: row;
    height: 140px;
}

.products-grid.list-view .product-image {
    width: 105px;
    height: 140px;
    aspect-ratio: 3/4;
    flex-shrink: 0;
}

.products-grid.list-view .product-info {
    padding: 12px 15px;
    justify-content: center;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.modal.active {
    display: block;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.modal-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    animation: modalFadeIn 0.2s ease;
    z-index: 1001;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

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

.modal-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: 100%;
    max-height: 90vh;
}

/* Modal Gallery */
.modal-gallery {
    background: #1a1a1a;
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-main-image {
    width: 100%;
    height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
    border-radius: 8px;
    margin-bottom: 15px;
    cursor: zoom-in;
}

.modal-main-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
}

.modal-thumbnails {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: auto;
}

.modal-thumb {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.6;
    transition: var(--transition);
    background: #333;
    border: 2px solid transparent;
    flex-shrink: 0;
}

.modal-thumb:hover {
    opacity: 0.8;
}

.modal-thumb.active {
    opacity: 1;
    border-color: var(--primary-color);
}

.modal-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Modal Info */
.modal-info {
    padding: 25px;
    overflow-y: auto;
    max-height: 90vh;
}

.modal-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--dark-color);
    line-height: 1.3;
}

.modal-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.modal-description {
    font-size: 0.95rem;
    color: var(--gray-color);
    margin-bottom: 20px;
    line-height: 1.6;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 8px;
}

.modal-description::-webkit-scrollbar {
    width: 4px;
}

.modal-description::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

.modal-meta {
    margin-bottom: 20px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.meta-item i {
    width: 16px;
    color: var(--primary-color);
}

.modal-actions {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    flex: 1;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--dark-color);
    padding: 10px;
}

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

/* Footer - компактный */
.footer {
    background: var(--dark-color);
    color: white;
    padding: 30px 0 12px;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 25px;
    margin-bottom: 25px;
}

.footer-info h3 {
    font-size: 1.2rem;
    margin-bottom: 6px;
}

.footer-info p {
    font-size: 0.85rem;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.footer-link {
    font-size: 0.85rem;
}

.footer-social {
    display: flex;
    gap: 10px;
}

.social-link {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
}

.footer-bottom {
    padding-top: 12px;
    font-size: 0.75rem;
}

/* Responsive */
@media (max-width: 768px) {
    .search-container {
        width: 100%;
    }
    
    .modal-content {
        grid-template-columns: 1fr;
    }
    
    .modal-gallery {
        max-height: 350px;
    }
    
    .modal-main-image {
        height: 250px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .product-title {
        font-size: 0.85rem;
    }
    
    .product-price {
        font-size: 1rem;
    }
}