/* app.css - Общие стили */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    padding: 16px;
    background: #f5f7fa;
    color: #333;
    min-height: 100vh;
}

.container {
    max-width: 600px;
    margin: 0 auto;
}

/* Навигация */
.app-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #fff;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.app-logo {
    font-weight: 700;
    font-size: 18px;
    color: #007aff;
    text-decoration: none;
}

.app-nav-links {
    display: flex;
    gap: 16px;
}

.nav-link {
    color: #666;
    text-decoration: none;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-link.active {
    background: #007aff;
    color: #fff;
}

.nav-link:active {
    transform: scale(0.95);
}

/* Кнопки */
.btn {
    display: inline-block;
    padding: 12px 20px;
    border-radius: 8px;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: #007aff;
    color: #fff;
}

.btn-primary:active {
    background: #0066d9;
}

.btn-secondary {
    background: #34c759;
    color: #fff;
}

.btn-secondary:active {
    background: #28a745;
}

.btn-outline {
    background: transparent;
    color: #007aff;
    border: 2px solid #007aff;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-lg {
    padding: 14px 24px;
    font-size: 18px;
}

/* Модальное окно */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: #fff;
    padding: 24px;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-content h3 {
    margin-bottom: 16px;
    font-size: 18px;
}

.modal-content label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 4px;
}

.modal-content input,
.modal-content textarea {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 14px;
    transition: border-color 0.2s;
}

.modal-content input:focus,
.modal-content textarea:focus {
    outline: none;
    border-color: #007aff;
}

.modal-content textarea {
    height: 80px;
    resize: vertical;
}

.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.modal-actions .btn {
    flex: 1;
    margin-top: 0;
}

.hidden {
    display: none !important;
}

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

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Загрузка */
.loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.loading:after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
}

/* Стили для каталога */
.categories-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 0 16px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
}

.categories-bar::-webkit-scrollbar {
    display: none;
}

.category-btn {
    flex-shrink: 0;
    padding: 8px 16px;
    border-radius: 20px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    background: #e9ecef;
    color: #495057;
    white-space: nowrap;
}

.category-btn:active {
    transform: scale(0.95);
}

.category-btn.active {
    background: #007aff;
    color: #fff;
}

.category-btn.source-pwht {
    border-left: 3px solid #007aff;
}

.category-btn.source-rgzc {
    border-left: 3px solid #34c759;
}

.products-count {
    text-align: center;
    font-size: 14px;
    color: #999;
    padding: 8px 0 4px 0;
}

.product-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.product-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.product-card:active {
    transform: scale(0.98);
}

.product-card img {
    width: 100px;
    min-width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    background: #f0f2f5;
    flex-shrink: 0;
}

.product-info {
    flex: 1;
    min-width: 0;
}

.product-title {
    font-weight: 600;
    font-size: 16px;
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.product-source {
    font-size: 11px;
    color: #999;
    margin-bottom: 4px;
}

.badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-pwht {
    background: #007aff20;
    color: #007aff;
}

.badge-rgzc {
    background: #34c75920;
    color: #34c759;
}

.product-short {
    font-size: 14px;
    color: #666;
    margin: 0 0 8px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.specs-preview {
    font-size: 13px;
    color: #555;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.specs-preview span {
    background: #f0f2f5;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

/* Детальная страница */
.detail-view {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.detail-view .back-btn {
    background: none;
    border: none;
    color: #007aff;
    font-size: 16px;
    padding: 8px 0;
    margin-bottom: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-view .back-btn:before {
    content: '←';
    font-size: 20px;
}

.detail-view h2 {
    font-size: 20px;
    margin-bottom: 4px;
}

.detail-view .product-source-detail {
    font-size: 13px;
    color: #999;
    margin-bottom: 12px;
}

.detail-view .description {
    color: #555;
    line-height: 1.6;
    margin: 12px 0;
}

.specs-list {
    list-style: none;
    padding: 0;
    margin: 12px 0;
}

.specs-list li {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f0f2f5;
    font-size: 14px;
    gap: 16px;
}

.specs-list li .label {
    color: #666;
    flex-shrink: 0;
}

.specs-list li .value {
    font-weight: 500;
    text-align: right;
    word-break: break-word;
}

.detail-view .complectation {
    background: #f8f9fa;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 12px 0;
    font-size: 14px;
    line-height: 1.6;
}

/* Галерея */
.main-image-container {
    position: relative;
    cursor: pointer;
    background: #f0f2f5;
    border-radius: 8px;
    overflow: hidden;
}

.main-image-container .detail-img {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    display: block;
}

.zoom-hint {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    pointer-events: none;
}

.gallery-thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 0;
    margin-bottom: 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.thumb-img {
    width: 80px;
    min-width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.thumb-img.active {
    border-color: #007aff;
}

/* Адаптивность */
@media (max-width: 480px) {
    body { padding: 12px; }
    .app-nav { padding: 8px 12px; flex-wrap: wrap; gap: 8px; }
    .app-logo { font-size: 16px; }
    .nav-link { font-size: 13px; padding: 4px 10px; }
    .product-card { padding: 12px; gap: 12px; }
    .product-card img { width: 80px; min-width: 80px; height: 80px; }
    .product-title { font-size: 15px; }
    .detail-view { padding: 16px; }
    .modal-content { padding: 20px; }
    .thumb-img { width: 64px; min-width: 64px; height: 64px; }
    .category-btn { font-size: 12px; padding: 6px 14px; }
}