/* ============================================
   Catsize.ru - Modern CSS
   Inspired by sachsperformance.com
   ============================================ */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #1a1a1a;
    line-height: 1.5;
}

/* Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.75rem;
    color: #1a1a1a;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

a {
    color: #0066cc;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #004499;
    text-decoration: underline;
}

p {
    margin-bottom: 1rem;
}

/* Layout
   ============================================ */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

.main-content {
    display: block;
    margin: 40px 0;
}

.content {
    width: 100%;
}

.sidebar {
    display: none;
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        order: -1;
    }
}

/* Header
   ============================================ */
.header {
    background-color: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 20px 0;
}

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

.logo {
    flex-shrink: 0;
}

.logo img {
    height: 50px;
    width: auto;
}

.logo a {
    display: block;
}

/* Breadcrumbs
   ============================================ */
.breadcrumb {
    background-color: transparent;
    padding: 12px 0;
    margin-bottom: 20px;
    font-size: 0.875rem;
    color: #666;
    border-bottom: 1px solid #e0e0e0;
}

.breadcrumb ol {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
}

.breadcrumb li {
    display: inline-flex;
    align-items: center;
}

.breadcrumb li:not(:last-child):after {
    content: "›";
    margin: 0 8px;
    color: #ccc;
    font-size: 1.1em;
}

.breadcrumb a {
    color: #666;
}

.breadcrumb a:hover {
    color: #0066cc;
    text-decoration: none;
}

.breadcrumb span {
    color: #1a1a1a;
}

/* Cards (Categories)
   ============================================ */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin: 30px 0;
}

.card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    transform: translateY(-4px);
}

.card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.card-link:hover {
    text-decoration: none;
}

.card-image {
    background-color: #f8f8f8;
    text-align: center;
    padding: 20px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-image img {
    max-height: 120px;
    max-width: 100%;
    object-fit: contain;
}

.card-content {
    padding: 16px;
    border-top: 1px solid #f0f0f0;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1a1a1a;
}

.card-title:hover {
    color: #0066cc;
}

.card-subcategories {
    font-size: 0.75rem;
    color: #666;
    line-height: 1.4;
}

.card-subcategories span {
    display: inline-block;
    margin-right: 8px;
}

/* Detail Item (для деталей в списке)
   ============================================ */
.detail-item {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    transition: box-shadow 0.2s ease;
    border: 1px solid #e0e0e0;
}

.detail-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.detail-item-header {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.detail-item-image {
    flex-shrink: 0;
    width: 100px;
    text-align: center;
}

.detail-item-image img {
    max-width: 80px;
    max-height: 80px;
}

.detail-item-info {
    flex: 1;
}

.detail-item-title {
    font-weight: 600;
    font-size: 1.125rem;
    margin-bottom: 8px;
}

.detail-item-manuf {
    color: #666;
    font-size: 0.875rem;
    margin-bottom: 8px;
}

.detail-item-sizes {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 10px;
}

.detail-size {
    font-size: 0.875rem;
    background: #f5f5f5;
    padding: 4px 10px;
    border-radius: 4px;
    font-family: monospace;
}

.detail-item-link {
    margin-top: 12px;
    text-align: right;
}

.detail-item-link a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Search Form
   ============================================ */
.search-form {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 30px;
    border: 1px solid #e0e0e0;
}

.search-form h2 {
    font-size: 1.125rem;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
    align-items: flex-end;
}

.form-group {
    flex: 1;
    min-width: 150px;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    margin-bottom: 6px;
}

.param-group {
    display: flex;
    gap: 10px;
}

.param-min, .param-max {
    flex: 1;
}

.param-min input, .param-max input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background-color: #fff;
}

.param-min input:focus, .param-max input:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 2px rgba(0,102,204,0.1);
}

.btn {
    background-color: #0066cc;
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn:hover {
    background-color: #004499;
}

.btn-secondary {
    background-color: #666;
}

.btn-secondary:hover {
    background-color: #444;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid #ccc;
    color: #666;
}

.btn-outline:hover {
    background-color: #f5f5f5;
    border-color: #999;
    color: #333;
}

/* Search Results Table
   ============================================ */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.results-count {
    font-size: 0.875rem;
    color: #666;
}

.results-table {
    width: 100%;
    background: #fff;
    border-radius: 8px;
    overflow-x: auto;
    border: 1px solid #e0e0e0;
    animation: fadeIn 0.3s ease-out;
}

.results-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.results-table th {
    background-color: #f8f8f8;
    padding: 12px;
    text-align: center;
    font-weight: 600;
    border-bottom: 2px solid #e0e0e0;
}

.results-table td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
}

.results-table tr:hover {
    background-color: #fafafa;
}

.result-img img {
    max-width: 45px;
    max-height: 45px;
}

.result-img {
    text-align: center;
}

.result-name {
    text-align: left;
    font-weight: 500;
}

.result-manuf-cell {
    color: #666;
    font-size: 0.8rem;
}

.result-param {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    font-weight: 500;
    color: #1a1a1a;
}

.result-link a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: #0066cc;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
}

.result-link a:hover {
    background-color: #004499;
}

/* Пустые ячейки */
.results-table td:empty:before {
    content: "—";
    color: #ccc;
}

/* Detail Page
   ============================================ */
.detail-page {
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    border: 1px solid #e0e0e0;
}

.detail-header {
    text-align: center;
    margin-bottom: 30px;
}

.detail-header h1 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.detail-image {
    text-align: center;
    margin-bottom: 30px;
}

.detail-image img {
    max-width: 100%;
    max-height: 300px;
}

.detail-sizes {
    background-color: #f8f8f8;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.detail-sizes h2 {
    font-size: 1rem;
    margin-bottom: 15px;
}

.sizes-list {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.size-item {
    font-family: monospace;
    font-size: 1.125rem;
    font-weight: 600;
}

/* Detail info box */
.detail-info-box {
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    border: 1px solid #e0e0e0;
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: center;
}

.detail-info-item {
    display: flex;
    gap: 10px;
    font-size: 1rem;
}

.detail-info-label {
    font-weight: 600;
    color: #666;
}

.detail-info-value {
    color: #1a1a1a;
    font-family: monospace;
    font-size: 1.1rem;
}

.detail-back {
    text-align: center;
    margin-top: 20px;
}

/* Pagination
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 30px 0 20px;
    flex-wrap: wrap;
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    color: #0066cc;
    font-size: 0.875rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.pagination a:hover {
    background-color: #0066cc;
    border-color: #0066cc;
    color: #fff;
    transform: translateY(-2px);
}

.pagination-current {
    background-color: #0066cc;
    border-color: #0066cc;
    color: #fff;
    cursor: default;
}

.pagination-dots {
    border: none;
    background: transparent;
}

/* Category Image
   ============================================ */
.category-image {
    text-align: center;
    margin: 20px 0;
    background: linear-gradient(135deg, #fff 0%, #f8f8f8 100%);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e0e0e0;
}

.category-image-img {
    max-width: 200px;
    max-height: 150px;
    object-fit: contain;
}

/* Footer
   ============================================ */
.footer {
    background-color: #1a1a1a;
    color: #999;
    padding: 40px 0 20px;
    margin-top: 60px;
}

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

.footer-column {
    flex: 1;
    min-width: 150px;
}

.footer-column h4 {
    color: #fff;
    font-size: 0.875rem;
    margin-bottom: 15px;
}

.footer-column ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-column li {
    margin-bottom: 8px;
}

.footer-column a {
    color: #999;
    font-size: 0.75rem;
    text-decoration: none;
}

.footer-column a:hover {
    color: #fff;
}

.footer-copyright {
    text-align: center;
    padding-top: 30px;
    margin-top: 30px;
    border-top: 1px solid #333;
    font-size: 0.75rem;
}

/* Text Blocks
   ============================================ */
.text-block {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    margin: 20px 0;
    border: 1px solid #e0e0e0;
}

.text-block h2 {
    font-size: 1.25rem;
    margin-bottom: 15px;
}

.text-block h3 {
    font-size: 1rem;
    margin: 20px 0 10px;
}

.text-block ul, .text-block ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

/* Alert Warning
   ============================================ */
.alert-warning {
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin: 20px 0;
}

/* Utilities
   ============================================ */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }

/* Focus for accessibility
   ============================================ */
:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* Animations
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Print styles
   ============================================ */
@media print {
    .header, .footer, .sidebar, .search-form, .pagination {
        display: none;
    }
    
    .detail-page {
        box-shadow: none;
        padding: 0;
    }
}

/* Responsive
   ============================================ */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
    
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    
    .detail-item-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .detail-item-sizes {
        justify-content: center;
    }
    
    .results-table {
        font-size: 0.75rem;
    }
    
    .results-table th,
    .results-table td {
        padding: 8px 6px;
        font-size: 0.7rem;
    }
    
    .results-table .result-param {
        font-size: 0.7rem;
    }
    
    .result-img img {
        max-width: 35px;
        max-height: 35px;
    }
    
    .result-link a {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .param-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .results-table th,
    .results-table td {
        padding: 6px 4px;
        font-size: 0.65rem;
    }
    
    .category-image-img {
        max-width: 120px;
        max-height: 100px;
    }
    
    .detail-info-item {
        font-size: 0.8rem;
    }
    
    .detail-info-value {
        font-size: 0.9rem;
    }
}

/* ============================================
   Рекламные блоки РСЯ
   ============================================ */

.ad-block {
    margin: 30px 0;
    text-align: center;
    clear: both;
}

.ad-feed {
    margin: 40px 0 20px;
    background: transparent;
    border-radius: 12px;
    overflow: hidden;
}

.ad-banner {
    margin: 20px 0;
    min-height: 90px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px;
}

@media (max-width: 768px) {
    .ad-feed {
        padding: 12px;
        margin: 20px 0;
    }
    
    .ad-banner {
        min-height: 70px;
    }
}

/* Сортировка таблицы */
.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.sortable:hover {
    background-color: #e8e8e8;
}

.sort-icon {
    display: inline-block;
    margin-left: 5px;
    font-size: 0.75rem;
    color: #999;
}

.sort-asc .sort-icon {
    color: #0066cc;
    font-weight: bold;
}

.sort-desc .sort-icon {
    color: #0066cc;
    font-weight: bold;
}

.sorted {
    background-color: #e3f2fd;
}