/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f9fafb;
    --card-bg: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--card-bg);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.logo a {
    text-decoration: none;
}

.nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

.favorite-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.favorite-count {
    background: var(--primary-color);
    color: white;
    border-radius: 12px;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.btn-header {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    white-space: nowrap;
}

.btn-header i {
    margin-right: 0.5rem;
}

/* Main Layout (как на kolesa.kz) */
.main-layout {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

/* Sidebar Filters */
.sidebar-filters {
    width: 280px;
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    transition: all 0.3s;
}

.sidebar-filters.collapsed {
    width: 60px;
    padding: 1rem 0.5rem;
}

.sidebar-filters.collapsed .filters-content {
    display: none;
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.filters-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.filters-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.filters-toggle:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

.sidebar-filters.collapsed .filters-toggle i {
    transform: rotate(180deg);
}

.filters-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.price-filter-vertical {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.price-filter-vertical .price-input {
    width: 100%;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* Content Area */
.content-area {
    flex: 1;
    min-width: 0;
}

/* Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.results-count {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.view-toggle {
    display: flex;
    gap: 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0.25rem;
    background: var(--card-bg);
}

.view-btn {
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

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

/* Search Section */
.search-section {
    background: var(--card-bg);
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.search-box {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: center;
}

.search-box i {
    color: var(--text-secondary);
    font-size: 1.2rem;
}

.search-box input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

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

.filters {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-select {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.9rem;
    min-width: 150px;
}

.price-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
}

.price-input {
    width: 100px;
    padding: 0.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    background: transparent;
    color: var(--text-primary);
}

.price-input:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

.price-input::placeholder {
    color: var(--text-secondary);
}

.price-separator {
    color: var(--text-secondary);
    font-weight: 500;
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: var(--text-primary);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: var(--secondary-color);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

/* Catalog Grid */
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.catalog-grid.list-view {
    grid-template-columns: 1fr;
    gap: 1rem;
}

.catalog-item {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.catalog-grid.list-view .catalog-item {
    flex-direction: row;
    align-items: flex-start;
    padding: 1rem;
    gap: 1.5rem;
}

.catalog-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.catalog-grid.list-view .catalog-item:hover {
    transform: none;
    box-shadow: var(--shadow-md);
}

.item-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--bg-color);
}

.catalog-grid.list-view .item-image {
    width: 200px;
    height: 150px;
    flex-shrink: 0;
    border-radius: 8px;
}

.item-image-placeholder {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
}

.catalog-grid.list-view .item-image-placeholder {
    width: 200px;
    height: 150px;
    flex-shrink: 0;
    border-radius: 8px;
}

.item-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.catalog-grid.list-view .item-content {
    padding: 0;
    min-width: 0;
}

.item-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.item-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.item-seller,
.item-category {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.item-seller i,
.item-category i {
    font-size: 0.75rem;
    opacity: 0.7;
}

.item-category {
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.item-category span {
    font-weight: 500;
    color: var(--primary-color);
}

.item-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.catalog-grid.list-view .item-price {
    font-size: 1.75rem;
}

.item-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-published {
    background: #d1fae5;
    color: #065f46;
}

.status-draft {
    background: #fef3c7;
    color: #92400e;
}

.status-archived {
    background: #fee2e2;
    color: #991b1b;
}

/* Loading & Empty States */
.loading,
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.loading i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.empty-state i {
    font-size: 4rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.error-message {
    background: #fee2e2;
    color: #991b1b;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal-content {
    background-color: var(--card-bg);
    margin: 5% auto;
    padding: 2rem;
    border-radius: 12px;
    max-width: 800px;
    position: relative;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content:focus {
    outline: none;
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
    z-index: 1001;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.2s;
}

.close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

/* Photo Gallery */
.photo-gallery {
    margin: 1.5rem 0;
}

.photo-main-container {
    position: relative;
    width: 100%;
    max-height: 600px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.photo-main {
    position: relative;
    width: 100%;
    height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
}

.main-photo {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.main-photo:hover {
    transform: scale(1.02);
}

.photo-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.photo-nav:hover {
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.photo-nav-prev {
    left: 1rem;
}

.photo-nav-next {
    right: 1rem;
}

.photo-nav i {
    font-size: 1.2rem;
    color: var(--text-primary);
}

.photo-counter {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.photo-thumbnails {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.5rem 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.photo-thumbnails::-webkit-scrollbar {
    height: 6px;
}

.photo-thumbnails::-webkit-scrollbar-track {
    background: transparent;
}

.photo-thumbnails::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.photo-thumb {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s;
    opacity: 0.7;
}

.photo-thumb:hover {
    opacity: 1;
    transform: scale(1.05);
}

.photo-thumb.active {
    border-color: var(--primary-color);
    opacity: 1;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

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

.no-photos {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
    background: var(--bg-color);
    border-radius: 12px;
    margin: 1.5rem 0;
}

.no-photos i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

/* Photo Zoom Modal */
.photo-zoom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.photo-zoom-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-zoom-img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}

.photo-zoom-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
}

.photo-zoom-nav:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: white;
    transform: translateY(-50%) scale(1.1);
}

.photo-zoom-prev {
    left: 2rem;
}

.photo-zoom-next {
    right: 2rem;
}

.photo-zoom-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.5rem;
    color: white;
    transition: all 0.2s;
}

.photo-zoom-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.photo-zoom-counter {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 500;
}

/* Item Details in Modal */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.modal-header h2 {
    margin: 0;
    flex: 1;
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.action-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--bg-color);
}

.action-btn.active {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
}

.favorite-btn.active {
    color: #ef4444;
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 1rem;
}

.meta-left,
.meta-right {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.item-category-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.item-seller-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-color);
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.item-seller-info i {
    color: var(--primary-color);
    font-size: 1.2rem;
}

.seller-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.seller-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.seller-name {
    font-weight: 600;
    color: var(--text-primary);
}

.item-date {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.item-description-full {
    margin: 2rem 0;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.item-description-full h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.item-description-full p {
    color: var(--text-secondary);
    line-height: 1.8;
    white-space: pre-wrap;
}

.item-price-full {
    margin: 2rem 0;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.item-price-full h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.price-large {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination button {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination .active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Footer */
.footer {
    background: var(--card-bg);
    padding: 2rem 0;
    margin-top: 4rem;
    text-align: center;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
}

/* Responsive */
@media (max-width: 768px) {
    .main-layout {
        flex-direction: column;
    }
    
    .sidebar-filters {
        width: 100%;
        position: relative;
        top: 0;
        max-height: none;
    }
    
    .sidebar-filters.collapsed {
        width: 100%;
        padding: 1rem;
    }
    
    .catalog-grid {
        grid-template-columns: 1fr;
    }
    
    .catalog-grid.list-view .catalog-item {
        flex-direction: column;
    }
    
    .catalog-grid.list-view .item-image,
    .catalog-grid.list-view .item-image-placeholder {
        width: 100%;
        height: 200px;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .btn-header {
        width: 100%;
        justify-content: center;
    }

    .search-box {
        flex-direction: column;
    }

    .search-box input {
        width: 100%;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .toolbar-right {
        justify-content: space-between;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-select {
        width: 100%;
        min-width: auto;
    }

    .price-filter {
        width: 100%;
        justify-content: space-between;
    }

    .price-input {
        flex: 1;
        min-width: 0;
    }

    .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    .modal-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .modal-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .item-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .meta-left,
    .meta-right {
        width: 100%;
    }

    .modal-content {
        margin: 2% auto;
        padding: 1rem;
        max-width: 95%;
    }

    .photo-main {
        height: 300px;
    }

    .photo-nav {
        width: 40px;
        height: 40px;
    }

    .photo-nav-prev {
        left: 0.5rem;
    }

    .photo-nav-next {
        right: 0.5rem;
    }

    .photo-thumb {
        width: 60px;
        height: 60px;
    }

    .photo-zoom-nav {
        width: 44px;
        height: 44px;
    }

    .photo-zoom-prev {
        left: 0.5rem;
    }

    .photo-zoom-next {
        right: 0.5rem;
    }

    .photo-zoom-close {
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }
}


