* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
a { color: #007bff; text-decoration: none; }
a:hover { text-decoration: underline; }

.header { background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.1); padding: 20px 0; margin-bottom: 30px; }
.header .container { display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 24px; font-weight: bold; color: #333; }
.nav { display: flex; gap: 20px; }
.nav a { color: #555; font-weight: 500; }

.main { min-height: calc(100vh - 200px); padding-bottom: 40px; }
.footer { background: #333; color: #fff; padding: 20px 0; text-align: center; margin-top: 40px; }

.catalog-page h1 { margin-bottom: 30px; }
.catalog-layout { display: grid; grid-template-columns: 280px 1fr; gap: 30px; }

.filters { background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); height: fit-content; position: sticky; top: 20px; }
.filter-group { margin-bottom: 20px; }
.filter-group h3 { font-size: 14px; margin-bottom: 10px; color: #555; text-transform: uppercase; }
.filter-group label { display: block; margin-bottom: 5px; cursor: pointer; }

.input-full, .input-half { width: 100%; padding: 8px 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; }
.input-half { width: 48%; display: inline-block; }
.price-range { display: flex; gap: 4%; }

.btn { padding: 10px 20px; border: none; border-radius: 4px; cursor: pointer; font-size: 14px; font-weight: 500; transition: all 0.2s; }
.btn-primary { background: #007bff; color: #fff; }
.btn-primary:hover { background: #0056b3; }
.btn-secondary { background: #6c757d; color: #fff; }
.btn-small { padding: 5px 10px; font-size: 12px; }

.results-info { margin-bottom: 20px; font-size: 14px; color: #666; }
.doors-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; margin-bottom: 30px; }

.door-card { background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 4px rgba(0,0,0,0.1); transition: transform 0.2s, box-shadow 0.2s; display: flex; flex-direction: column; }
.door-card:hover { transform: translateY(-4px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); text-decoration: none; }

.door-image { width: 100%; height: 250px; background: #f0f0f0; display: flex; align-items: center; justify-content: center; overflow: hidden; }

.door-page { background: #fff; padding: 30px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.back-link { display: inline-block; margin-bottom: 20px; color: #007bff; }
.door-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-bottom: 40px; }
.door-gallery .main-image { width: 100%; border-radius: 8px; margin-bottom: 15px; }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; }
.thumb { width: 80px; height: 80px; object-fit: cover; border-radius: 4px; cursor: pointer; border: 2px solid transparent; }
.thumb:hover { border-color: #007bff; }

.door-main-info h1 { margin-bottom: 20px; }
.brand, .category { margin-bottom: 10px; color: #666; }
.price-block { margin: 20px 0; }
.current-price { font-size: 32px; font-weight: bold; color: #007bff; }
.source-link { margin-top: 30px; padding: 20px; background: #f8f9fa; border-radius: 8px; }
.description-block, .specs-block { margin-top: 30px; }
.description-block h2, .specs-block h2 { margin-bottom: 15px; }
.specs-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.specs-table th, .specs-table td { padding: 10px; text-align: left; border-bottom: 1px solid #eee; }
.specs-table th { width: 40%; color: #666; font-weight: normal; }

.admin-page h1 { margin-bottom: 30px; }
.alert { padding: 15px; background: #d4edda; border: 1px solid #c3e6cb; border-radius: 4px; margin-bottom: 20px; color: #155724; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 40px; }
.stat-card { background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); text-align: center; }
.stat-value { font-size: 36px; font-weight: bold; color: #007bff; margin-bottom: 5px; }
.stat-label { color: #666; font-size: 14px; }
.admin-section { background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); margin-bottom: 30px; }
.admin-section h2 { margin-bottom: 20px; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { padding: 12px; text-align: left; border-bottom: 1px solid #eee; }
.admin-table th { background: #f8f9fa; font-weight: 600; }

@media (max-width: 768px) {
    .catalog-layout { grid-template-columns: 1fr; }
    .filters { position: static; }
    .door-detail { grid-template-columns: 1fr; }
    .doors-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
.door-image img { width: 100%; height: 100%; object-fit: cover; }
.no-image { color: #999; font-size: 14px; }

.door-info { padding: 15px; flex: 1; display: flex; flex-direction: column; }
.door-name { font-size: 16px; margin-bottom: 10px; color: #333; line-height: 1.3; }
.door-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.door-brand, .door-material { font-size: 12px; color: #666; background: #f0f0f0; padding: 2px 8px; border-radius: 3px; }
.door-price { font-size: 20px; font-weight: bold; color: #007bff; margin-bottom: 10px; }
.old-price { font-size: 14px; color: #999; text-decoration: line-through; margin-left: 10px; font-weight: normal; }
.door-source { margin-top: auto; color: #999; font-size: 12px; }

.empty { text-align: center; padding: 40px; color: #999; }

.pagination { display: flex; justify-content: center; gap: 5px; }

/* Carousel */
.carousel { position: relative; width: 100%; overflow: hidden; border-radius: 8px; background: #f0f0f0; }
.carousel-slide { display: none; width: 100%; }
.carousel-slide.active { display: block; animation: fadeIn 0.3s ease; }
.carousel-slide img { width: 100%; height: auto; max-height: 500px; object-fit: contain; display: block; }

.carousel-btn { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,0.5); color: #fff; border: none; width: 40px; height: 40px; border-radius: 50%; font-size: 24px; cursor: pointer; transition: background 0.2s; z-index: 10; display: flex; align-items: center; justify-content: center; }
.carousel-btn:hover { background: rgba(0,0,0,0.8); }
.carousel-prev { left: 10px; }
.carousel-next { right: 10px; }

.carousel-counter { position: absolute; bottom: 10px; right: 10px; background: rgba(0,0,0,0.7); color: #fff; padding: 5px 10px; border-radius: 4px; font-size: 14px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Thumbnails */
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 15px; overflow-x: auto; padding: 5px 0; }
.thumb { width: 80px; height: 80px; object-fit: cover; border-radius: 4px; cursor: pointer; border: 2px solid transparent; transition: border-color 0.2s, transform 0.2s; flex-shrink: 0; }
.thumb:hover { border-color: #007bff; transform: scale(1.05); }
.thumb.active { border-color: #007bff; box-shadow: 0 0 0 2px rgba(0,123,255,0.3); }

/* Reviews */
.reviews-block { margin-top: 40px; }
.reviews-count { color: #666; font-size: 18px; font-weight: normal; }
.reviews-summary { background: #f8f9fa; padding: 20px; border-radius: 8px; margin-bottom: 30px; }
.rating-display { display: flex; align-items: center; gap: 20px; }
.rating-value { font-size: 48px; font-weight: bold; color: #007bff; }
.rating-stars { font-size: 24px; color: #ffc107; }
.rating-total { color: #666; font-size: 14px; }

/* Offers Block */
.offers-block { margin-top: 30px; padding: 20px; background: #f8f9fa; border-radius: 8px; }
.offers-title { margin-bottom: 15px; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.offers-count { background: #007bff; color: #fff; padding: 2px 8px; border-radius: 12px; font-size: 14px; font-weight: normal; }
.offers-list { display: flex; flex-direction: column; gap: 10px; }
.offer-item { display: flex; justify-content: space-between; align-items: center; padding: 15px; background: #fff; border-radius: 6px; border: 2px solid transparent; transition: border-color 0.2s; }
.offer-item:hover { border-color: #007bff; }
.offer-current { border-color: #28a745; background: #f0fff4; }
.offer-source { flex: 1; }
.offer-badge { display: inline-block; margin-left: 8px; padding: 2px 8px; background: #28a745; color: #fff; border-radius: 4px; font-size: 12px; }
.offer-price { flex: 1; text-align: center; }
.offer-price-value { font-size: 20px; font-weight: bold; color: #007bff; }
.offer-old-price { font-size: 14px; color: #999; text-decoration: line-through; margin-left: 8px; }
.offer-no-price { color: #666; font-style: italic; }

.door-offers-count { font-size: 12px; color: #28a745; font-weight: 600; margin-top: 5px; }
.offer-action { flex: 0 0 auto; }

/* Mini Carousel in Catalog */
.door-card { position: relative; }
.door-card-link { display: flex; flex-direction: column; height: 100%; text-decoration: none; color: inherit; }
.carousel-mini { position: relative; overflow: hidden; }
.carousel-mini img { width: 100%; height: 250px; object-fit: cover; transition: opacity 0.3s; }
.carousel-main-img { display: block; }

.mini-carousel-btn { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,0.6); color: #fff; border: none; width: 32px; height: 32px; border-radius: 50%; font-size: 20px; cursor: pointer; opacity: 0; transition: opacity 0.2s; z-index: 5; display: flex; align-items: center; justify-content: center; line-height: 1; }
.carousel-mini:hover .mini-carousel-btn { opacity: 1; }
.mini-carousel-btn:hover { background: rgba(0,0,0,0.9); }
.mini-prev { left: 8px; }
.mini-next { right: 8px; }

.mini-carousel-counter { position: absolute; bottom: 8px; right: 8px; background: rgba(0,0,0,0.7); color: #fff; padding: 3px 8px; border-radius: 3px; font-size: 12px; z-index: 5; }

.reviews-list { margin-bottom: 30px; }
.review-item { background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); margin-bottom: 20px; }
.review-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; flex-wrap: wrap; gap: 10px; }
.review-rating { font-size: 18px; color: #ffc107; }
.review-meta { display: flex; gap: 15px; flex-wrap: wrap; font-size: 14px; color: #666; }
.review-author { font-weight: 600; color: #333; }
.review-source { font-style: italic; }
.review-title { margin-bottom: 10px; color: #333; }
.review-content { line-height: 1.6; margin-bottom: 15px; color: #555; }
.review-pros, .review-cons { margin-bottom: 10px; padding: 10px; border-radius: 4px; }
.review-pros { background: #d4edda; color: #155724; }
.review-cons { background: #f8d7da; color: #721c24; }
.review-footer { margin-top: 15px; padding-top: 15px; border-top: 1px solid #eee; }
.review-link { color: #007bff; font-size: 14px; }

.reviews-pagination { display: flex; justify-content: center; gap: 5px; margin-top: 20px; }
.reviews-pagination button { padding: 8px 12px; border: 1px solid #ddd; background: #fff; cursor: pointer; border-radius: 4px; }
.reviews-pagination button.active { background: #007bff; color: #fff; border-color: #007bff; }

.no-reviews, .loading, .error { text-align: center; padding: 40px; color: #999; }
.error { color: #dc3545; }

.stars { letter-spacing: 2px; }
.pagination button { padding: 8px 12px; border: 1px solid #ddd; background: #fff; cursor: pointer; border-radius: 4px; }
.pagination button.active { background: #007bff; color: #fff; border-color: #007bff; }