/* РЫСК — Styles */
/* Файл: assets/css/style.css */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --success: #16a34a;
    --error: #dc2626;
    --warning: #d97706;
    --radius: 12px;
}

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

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

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    padding: 30px 0 20px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-light);
    font-size: 1.1rem;
}

/* Search */
.search-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.search-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

#query {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

#query:focus {
    outline: none;
    border-color: var(--primary);
}

#search-btn {
    padding: 12px 28px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

#search-btn:hover:not(:disabled) {
    background: var(--primary-dark);
}

#search-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.search-options {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.region-label, .photo-label {
    font-size: 0.9rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

#region {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
}

.photo-label input[type="file"] {
    display: none;
}

.photo-label span {
    color: var(--text-light);
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.9rem;
}

/* Status */
.status-section {
    margin-bottom: 20px;
}

.status-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.status-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.status-info {
    flex: 1;
}

#status-text {
    font-weight: 600;
    color: var(--text);
}

.status-detail {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 4px;
}

/* Results */
.result-section {
    flex: 1;
}

.best-card {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
}

.best-card h2 {
    color: var(--primary);
    font-size: 1.3rem;
    margin-bottom: 16px;
}

.result-group {
    margin-bottom: 20px;
}

.result-group h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: var(--text);
}

.result-group summary {
    font-size: 1.1rem;
    cursor: pointer;
    padding: 8px 0;
    color: var(--text);
}

.card-list {
    display: grid;
    gap: 12px;
}

/* Product card */
.product-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
    display: flex;
    gap: 16px;
}

.product-card.best {
    border: 2px solid var(--success);
}

.product-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 6px;
    background: #f1f5f9;
    flex-shrink: 0;
}

.product-info {
    flex: 1;
}

.product-title {
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.4;
}

.product-brand, .product-model, .product-article, .product-mod {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 2px;
}

.product-price {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--success);
    margin: 8px 0 4px;
}

.price-source, .offers-price, .offers-shop {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 2px;
}

.product-link {
    display: inline-block;
    margin-top: 8px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.product-link:hover {
    text-decoration: underline;
}

/* Offers */
.offers-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.offers-section h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.offer-product {
    margin-bottom: 16px;
}

.offer-product-title {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.offers-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.offers-table th {
    text-align: left;
    padding: 6px 8px;
    background: #f1f5f9;
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    color: var(--text-light);
}

.offers-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
}

.price-cell {
    font-weight: 700;
    color: var(--success);
    white-space: nowrap;
}

/* Diagnostics */
.diagnostics-section {
    margin-top: 24px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.diagnostics-section summary {
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-light);
}

.diag-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.diag-block h4 {
    font-size: 0.9rem;
    margin-bottom: 6px;
    color: var(--primary);
}

.diag-block p {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 2px;
}

/* Error */
.error-card {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 20px;
    color: var(--error);
}

.error-card h3 {
    margin-bottom: 8px;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px 0;
    color: var(--text-light);
    font-size: 0.85rem;
    margin-top: auto;
}

footer a {
    color: var(--primary);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Utility */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 600px) {
    .search-input-group {
        flex-direction: column;
    }
    
    #search-btn {
        width: 100%;
    }
    
    .product-card {
        flex-direction: column;
    }
    
    .product-image {
        width: 100%;
        height: 120px;
    }
    
    .offers-table {
        font-size: 0.8rem;
    }
    
    .offers-table th, .offers-table td {
        padding: 4px;
    }
}