/* Union API Site — стили */
:root {
    --primary: #4361ee;
    --primary-dark: #3a56d4;
    --secondary: #64748b;
    --accent: #06d6a0;
    --bg: #0f172a;
    --bg-card: #1e293b;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --border: #334155;
}

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

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

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

/* Navbar */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar .container { display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 1.5rem; font-weight: 800; color: var(--text); text-decoration: none; }
.logo span { color: var(--primary); }
.nav-links { display: flex; gap: 1.5rem; list-style: none; align-items: center; }
.nav-links a { color: var(--text-muted); text-decoration: none; transition: color .2s; }
.nav-links a:hover { color: var(--text); }

/* Buttons */
.btn {
    display: inline-block; padding: 0.6rem 1.2rem; border-radius: 8px;
    text-decoration: none; font-weight: 600; transition: all .2s;
    border: none; cursor: pointer; font-size: 0.95rem;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-large { padding: 0.8rem 2rem; font-size: 1.1rem; }
.btn-small { padding: 0.4rem 0.8rem; font-size: 0.85rem; }

/* Hero */
.hero { text-align: center; padding: 5rem 0 3rem; }
.hero h1 { font-size: 2.8rem; font-weight: 800; margin-bottom: 1rem; }
.hero .subtitle { font-size: 1.2rem; color: var(--text-muted); max-width: 600px; margin: 0 auto 2rem; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; }

/* Markets */
.markets, .features, .stats, .page-header { padding: 3rem 0; }
h2 { font-size: 1.8rem; margin-bottom: 2rem; }

.market-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; }
.market-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
    padding: 1.2rem; display: flex; align-items: center; gap: 1rem;
    transition: all .2s;
}
.market-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.market-flag { font-size: 2.5rem; }
.market-info h3 { font-size: 1rem; margin-bottom: 0.3rem; }
.market-code { color: var(--primary); font-size: 0.85rem; font-family: monospace; margin-right: 1rem; }
.market-listings { color: var(--text-muted); font-size: 0.85rem; }

/* Features */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; }
.feature-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
    padding: 1.5rem; transition: all .2s;
}
.feature-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.feature-icon { font-size: 2rem; margin-bottom: 0.8rem; }
.feature-card h3 { margin-bottom: 0.5rem; }
.feature-card p { color: var(--text-muted); font-size: 0.9rem; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; }
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
    padding: 2rem; text-align: center;
}
.stat-value { font-size: 2.5rem; font-weight: 800; color: var(--primary); }
.stat-label { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.3rem; }

/* Page header */
.page-header { padding: 3rem 0 1rem; }
.page-header h1 { font-size: 2rem; }
.page-header p { color: var(--text-muted); }

/* Docs / Guide */
.docs h2 { margin-top: 2.5rem; }
.code-block {
    background: #1a1a2e; border: 1px solid var(--border); border-radius: 8px;
    padding: 1rem; overflow-x: auto; margin: 1rem 0;
}
.code-block pre { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 0.9rem; color: #e2e8f0; }

/* Tables */
.params-table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.params-table th, .params-table td { padding: 0.7rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
.params-table th { color: var(--text-muted); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; }
.params-table td { font-size: 0.9rem; font-family: monospace; }
.params-table tr:hover td { background: var(--bg-card); }

/* Pricing */
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; }
.pricing-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
    padding: 2rem; text-align: center; position: relative;
}
.pricing-card.featured { border-color: var(--primary); }
.pricing-card .badge {
    position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
    background: var(--primary); color: white; padding: 0.2rem 1rem;
    border-radius: 20px; font-size: 0.8rem; font-weight: 600;
}
.pricing-card h3 { margin-bottom: 0.5rem; }
.price { font-size: 2.5rem; font-weight: 800; color: var(--primary); }
.price-sub { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1rem; }
.pricing-card ul { list-style: none; margin: 1.5rem 0; text-align: left; }
.pricing-card ul li { padding: 0.4rem 0; color: var(--text-muted); }
.pricing-card ul li::before { content: '✓ '; color: var(--accent); }

/* Auth forms */
.auth-form { max-width: 400px; margin: 3rem auto; text-align: center; }
.auth-form h1 { margin-bottom: 2rem; }
.form-row { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 1rem; }
.form-row label { min-width: 80px; color: var(--text-muted); font-size: 0.9rem; }
.form-row input, .form-row select {
    flex: 1; padding: 0.6rem; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text); font-size: 0.95rem;
}
.form-row input:focus { outline: none; border-color: var(--primary); }
.auth-link { margin-top: 1rem; color: var(--text-muted); }
.auth-link a { color: var(--primary); }

/* Demo */
.demo { padding: 2rem 0; }
.demo-form { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; }
.demo-form .btn { margin-top: 1rem; width: 100%; }
.demo-result { margin-top: 2rem; }
.demo-result .hint { color: var(--text-muted); text-align: center; padding: 2rem; }
.demo-result .error { color: #ff6b6b; padding: 1rem; background: var(--bg-card); border-radius: 8px; }
.result-meta { margin-bottom: 1rem; color: var(--text-muted); font-size: 0.9rem; }

/* Card grid */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.car-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
    overflow: hidden; cursor: pointer; transition: all .2s;
}
.car-card:hover { transform: translateY(-3px); border-color: var(--primary); }
.card-img { width: 100%; height: 180px; object-fit: cover; display: block; background: #1a1a2e; }
.card-img-placeholder { width: 100%; height: 180px; display: flex; align-items: center; justify-content: center; font-size: 3rem; }
.card-body { padding: 0.8rem 1rem; }
.card-title { font-size: 1rem; margin-bottom: 0.2rem; line-height: 1.3; }
.card-group { color: var(--text-muted); font-size: 0.8rem; }
.card-meta { color: var(--text-muted); font-size: 0.8rem; margin-bottom: 0.3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-price { font-size: 0.9rem; }
.card-currency { color: var(--text-muted); font-size: 0.8rem; }
.card-price-rub { color: var(--accent); font-weight: 700; font-size: 1.1rem; }
.card-tech { color: var(--text-muted); font-size: 0.8rem; margin-top: 0.3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-location { color: var(--text-muted); font-size: 0.8rem; margin-top: 0.2rem; }

/* Modal */
.modal {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.8);
    z-index: 1000; align-items: center; justify-content: center;
    padding: 20px;
}
.modal-content {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px;
    max-width: 700px; width: 100%; max-height: 90vh; overflow-y: auto;
    position: relative; padding: 1.5rem;
}
.modal-close {
    position: sticky; top: 0; float: right; cursor: pointer; font-size: 1.5rem;
    color: var(--text-muted); z-index: 1;
}
.modal-close:hover { color: var(--text); }
.modal-img { width: 100%; max-height: 300px; object-fit: contain; border-radius: 8px; background: #111; margin-bottom: 0.5rem; cursor: zoom-in; }
.modal-photos { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 1rem; }
.modal-thumb { width: 80px; height: 60px; object-fit: cover; border-radius: 4px; cursor: pointer; border: 1px solid var(--border); }
.modal-thumb:hover { border-color: var(--primary); }
.modal-info h2 { font-size: 1.4rem; margin-bottom: 0.2rem; }
.modal-sub { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1rem; }
.modal-table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.modal-table td { padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.modal-table td:first-child { color: var(--text-muted); width: 120px; }
.modal-json { margin-top: 1rem; }
.modal-actions { margin: 1rem 0; text-align: right; }
.modal-json h3 { cursor: pointer; color: var(--primary); font-size: 1rem; }
.json-block {
    display: none; background: #1a1a2e; border: 1px solid var(--border); border-radius: 8px;
    padding: 1rem; font-size: 0.8rem; overflow-x: auto; max-height: 400px; overflow-y: auto;
    white-space: pre; font-family: monospace; color: #e2e8f0;
}
.json-block.open { display: block; }

/* Gallery viewer */
.gallery-viewer {
    display: none; position: fixed; inset: 0; z-index: 2000;
    align-items: center; justify-content: center;
}
.gallery-bg { position: absolute; inset: 0; background: rgba(0,0,0,0.95); cursor: pointer; }
.gallery-container { position: relative; max-width: 90vw; max-height: 90vh; display: flex; align-items: center; justify-content: center; }
.gallery-img { max-width: 90vw; max-height: 85vh; object-fit: contain; border-radius: 4px; cursor: default; }
.gallery-close { position: absolute; top: -30px; right: 0; color: #fff; font-size: 1.5rem; cursor: pointer; z-index: 1; }
.gallery-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 50px; height: 80px; display: flex; align-items: center; justify-content: center;
    font-size: 3rem; color: #fff; cursor: pointer; transition: .2s;
    background: rgba(255,255,255,0.05); border-radius: 8px; user-select: none;
}
.gallery-nav:hover { background: rgba(255,255,255,0.15); }
.gallery-prev { left: -60px; }
.gallery-next { right: -60px; }
.gallery-counter { position: absolute; bottom: -30px; left: 50%; transform: translateX(-50%); color: #aaa; font-size: 0.9rem; }

/* Main photo clickable */
.modal-main-photo { position: relative; cursor: pointer; }
.modal-photo-count { position: absolute; bottom: 10px; right: 10px; background: rgba(0,0,0,0.7); color: #fff; padding: 2px 10px; border-radius: 4px; font-size: 0.8rem; }

/* Error pages */
.error-page { text-align: center; padding: 5rem 0; }
.error-page h1 { font-size: 5rem; color: var(--primary); }
.error-page p { font-size: 1.2rem; margin: 1rem 0 2rem; }

/* Footer */
.footer { text-align: center; padding: 2rem 0; border-top: 1px solid var(--border); margin-top: 4rem; }
.footer p { color: var(--text-muted); }
.footer .small { font-size: 0.8rem; margin-top: 0.5rem; }

/* Responsive */
@media (max-width: 768px) {
    .hero h1 { font-size: 2rem; }
    .nav-links { display: none; }
}
