/* =========================================================
   File: public_html/74ai/assets/css/main.css
   Version: 1.5.0
   Назначение: Стили публичной части.
   Изменения v1.5.0:
     - Контрастность тем повышена.
     - Анимация космоса (звёзды, кометы, падающая звезда).
     - Модалки получили отступы сверху/снизу.
     - Адаптивность: скрытие второстепенных колонок на мобильных.
     - Бейджи Freemium и Paid.
     - Стили для языковой поддержки.
   ========================================================= */

[data-theme="light"], :root {
    --bg: #f8fafc;
    --bg-soft: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --accent: #f59e0b;
    --th-bg: #f1f5f9;
    --row-hover: rgba(37, 99, 235, 0.03);
    --shadow: rgba(0, 0, 0, 0.05);
    --badge-free-bg: #dcfce7;
    --badge-free-color: #166534;
    --badge-freemium-bg: #e0e7ff;
    --badge-freemium-color: #3730a3;
    --badge-paid-bg: #f1f5f9;
    --badge-paid-color: #475569;
    --badge-api-bg: #e0e7ff;
    --badge-api-color: #3730a3;
    --badge-hot-bg: #fef3c7;
    --badge-hot-color: #92400e;
    --badge-new-bg: #dbeafe;
    --badge-new-color: #1e40af;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --bg-soft: #1e293b;
    --text: #f8fafc; /* Контрастнее */
    --text-muted: #cbd5e1;
    --border: #475569;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --accent: #fbbf24;
    --th-bg: #1e293b;
    --row-hover: rgba(59, 130, 246, 0.12);
    --shadow: rgba(0, 0, 0, 0.4);
    --badge-free-bg: rgba(16, 185, 129, 0.25);
    --badge-free-color: #6ee7b7;
    --badge-freemium-bg: rgba(99, 102, 241, 0.25);
    --badge-freemium-color: #a5b4fc;
    --badge-paid-bg: rgba(100, 116, 139, 0.25);
    --badge-paid-color: #cbd5e1;
    --badge-api-bg: rgba(99, 102, 241, 0.25);
    --badge-api-color: #a5b4fc;
    --badge-hot-bg: rgba(251, 191, 36, 0.25);
    --badge-hot-color: #fbbf24;
    --badge-new-bg: rgba(59, 130, 246, 0.25);
    --badge-new-color: #60a5fa;
}

[data-theme="cosmos"] {
    --bg: #0a0e27;
    --bg-soft: #11173a;
    --text: #f8fafc;
    --text-muted: #c4b5fd;
    --border: #4338ca;
    --primary: #8b5cf6;
    --primary-hover: #a78bfa;
    --accent: #f472b6;
    --th-bg: #1e1b4b;
    --row-hover: rgba(139, 92, 246, 0.15);
    --shadow: rgba(139, 92, 246, 0.3);
    --badge-free-bg: rgba(16, 185, 129, 0.25);
    --badge-free-color: #6ee7b7;
    --badge-freemium-bg: rgba(139, 92, 246, 0.3);
    --badge-freemium-color: #c4b5fd;
    --badge-paid-bg: rgba(100, 116, 139, 0.25);
    --badge-paid-color: #cbd5e1;
    --badge-api-bg: rgba(139, 92, 246, 0.25);
    --badge-api-color: #c4b5fd;
    --badge-hot-bg: rgba(244, 114, 182, 0.25);
    --badge-hot-color: #f9a8d4;
    --badge-new-bg: rgba(139, 92, 246, 0.25);
    --badge-new-color: #c4b5fd;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    line-height: 1.5;
    overflow-x: hidden;
    position: relative;
    transition: background 0.3s ease, color 0.3s ease;
}

body.modal-open { overflow: hidden; }

#hero-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 300px;
    z-index: -1;
    pointer-events: none;
}

/* === КОСМОС ФОН === */
.cosmos-bg {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -2;
    pointer-events: none;
    background: radial-gradient(ellipse at bottom, #1B2735 0%, #090A0F 100%);
    overflow: hidden;
}
[data-theme="cosmos"] .cosmos-bg { display: block; }
[data-theme="cosmos"] #hero-canvas { display: none; } /* Отключаем граф в космосе */

.cosmos-bg::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image:
        radial-gradient(1px 1px at 20px 30px, #ffffff, rgba(0,0,0,0)),
        radial-gradient(1px 1px at 40px 70px, #ffffff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 50px 160px, #ffffff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 90px 40px, #ffffff, rgba(0,0,0,0)),
        radial-gradient(1px 1px at 130px 80px, #ffffff, rgba(0,0,0,0)),
        radial-gradient(1px 1px at 160px 120px, #ffffff, rgba(0,0,0,0));
    background-repeat: repeat;
    background-size: 200px 200px;
    animation: stars-anim 50s linear infinite;
    opacity: 0.8;
}

@keyframes stars-anim {
    from { transform: translateY(0); }
    to { transform: translateY(-200px); }
}

/* Падающая звезда */
.cosmos-bg::after {
    content: "";
    position: absolute;
    top: 0; right: 20%;
    width: 2px; height: 2px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 10px 2px #fff;
    animation: shooting-star 4s linear infinite;
    opacity: 0;
}

@keyframes shooting-star {
    0% { transform: translate(0, 0); opacity: 1; }
    100% { transform: translate(-300px, 300px); opacity: 0; }
}

/* Планета */
.cosmos-bg .planet {
    position: absolute;
    top: 10%; right: 10%;
    width: 150px; height: 150px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #9333ea);
    box-shadow: 0 0 50px rgba(147, 51, 234, 0.4), inset -20px -20px 40px rgba(0,0,0,0.6);
    opacity: 0.8;
}
.cosmos-bg .planet::before {
    content: '';
    position: absolute;
    top: 50%; left: -25%;
    width: 150%; height: 20px;
    border: 4px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    transform: rotate(-20deg);
}

/* ... остальные стили ... */

.theme-switcher {
    position: fixed;
    top: 16px; right: 16px;
    z-index: 100;
    display: flex; gap: 4px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 24px; padding: 4px;
    box-shadow: 0 4px 12px var(--shadow);
}
.theme-btn {
    border: none; background: transparent; cursor: pointer;
    font-size: 16px; width: 32px; height: 32px; border-radius: 50%;
    transition: transform 0.15s, background 0.15s; color: var(--text);
}
.theme-btn:hover { background: var(--row-hover); transform: scale(1.15); }
.theme-btn.active { background: var(--primary); color: #fff; }

.site-logo {
    display: inline-flex; align-items: center; gap: 12px;
    text-decoration: none; color: var(--text); transition: transform 0.15s ease;
}
.site-logo:hover { transform: translateY(-1px); }
.site-logo-icon { border-radius: 12px; box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3); flex-shrink: 0; }
.site-logo-text {
    font-size: 28px; font-weight: 900; letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

.site-header { text-align: center; padding: 60px 20px 40px; position: relative; z-index: 1; }
.site-header .site-logo { margin-bottom: 20px; }
.site-header h1 {
    font-size: 2.75rem; margin-bottom: 10px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.site-header p { color: var(--text-muted); font-size: 1.1rem; }

.hero-stats {
    display: inline-flex; gap: 20px; margin-top: 24px; padding: 12px 24px;
    background: var(--bg-soft); border: 1px solid var(--border); border-radius: 32px;
    font-size: 14px; color: var(--text-muted); box-shadow: 0 2px 8px var(--shadow);
    flex-wrap: wrap; justify-content: center;
}
.hero-stats strong { color: var(--primary); font-size: 16px; }

.container { max-width: 1400px; margin: 0 auto; padding: 0 20px 60px; position: relative; z-index: 1; }

.category-tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.cat-tab {
    padding: 10px 18px; border-radius: 22px; background: var(--bg-soft);
    border: 1px solid var(--border); color: var(--text); text-decoration: none;
    font-size: 14px; font-weight: 500; transition: all 0.15s;
    display: inline-flex; align-items: center; gap: 8px;
}
.cat-tab:hover { border-color: var(--primary); background: var(--row-hover); transform: translateY(-1px); }
.cat-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25); }
.cat-count {
    font-size: 12px; opacity: 0.7; background: rgba(255, 255, 255, 0.25);
    padding: 2px 8px; border-radius: 10px; font-weight: 600;
}
.cat-tab:not(.active) .cat-count { background: var(--border); }

.search-form {
    background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px;
    padding: 16px; display: flex; flex-direction: column; gap: 12px;
    margin-bottom: 20px; box-shadow: 0 2px 8px var(--shadow);
}
.search-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search-input-wrap { position: relative; flex: 1; min-width: 240px; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 14px; pointer-events: none; opacity: 0.7; }
.filter-search {
    width: 100%; padding: 10px 14px 10px 38px; border: 1px solid var(--border);
    border-radius: 8px; background: var(--bg); color: var(--text);
    font-size: 14px; font-family: inherit; transition: border-color 0.15s, box-shadow 0.15s;
}
.filter-search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
.filter-select {
    padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--bg); color: var(--text); font-size: 14px; font-family: inherit; cursor: pointer;
}
.filters-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px;
    border: 1px solid var(--border); border-radius: 22px; font-size: 13px;
    cursor: pointer; user-select: none; background: var(--bg); color: var(--text); transition: all 0.15s;
}
.filter-chip:hover { border-color: var(--primary); background: var(--row-hover); }
.filter-chip input { margin: 0; accent-color: var(--primary); }

.table-wrapper {
    overflow-x: auto; background: var(--bg-soft); border: 1px solid var(--border);
    border-radius: 12px; box-shadow: 0 4px 16px var(--shadow);
}
.services-table { width: 100%; border-collapse: collapse; text-align: left; min-width: 1000px; }
.services-table th, .services-table td { padding: 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.services-table th { background: var(--th-bg); font-weight: 600; white-space: nowrap; position: sticky; top: 0; z-index: 2; }
.services-table tr:hover { background: var(--row-hover); transition: background 0.15s; }
.services-table tr:last-child td { border-bottom: none; }

.col-name a { color: var(--primary); text-decoration: none; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.col-name a:hover { text-decoration: underline; }
.ext-icon { opacity: 0.6; display: inline-flex; }
.btn-details {
    display: block; margin-top: 6px; padding: 4px 10px; font-size: 12px;
    background: transparent; color: var(--primary); border: 1px solid var(--primary);
    border-radius: 4px; cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.btn-details:hover { background: var(--primary); color: #fff; }

.col-badges { min-width: 110px; vertical-align: top; }
.row-badges { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.badge {
    display: inline-block; padding: 2px 8px; border-radius: 12px;
    font-size: 11px; font-weight: 600; line-height: 1.4; white-space: nowrap;
}
.badge-free { background: var(--badge-free-bg); color: var(--badge-free-color); }
.badge-freemium { background: var(--badge-freemium-bg); color: var(--badge-freemium-color); }
.badge-paid { background: var(--badge-paid-bg); color: var(--badge-paid-color); }
.badge-api  { background: var(--badge-api-bg);  color: var(--badge-api-color); }
.badge-hot  { background: var(--badge-hot-bg);  color: var(--badge-hot-color); }
.badge-new  { background: var(--badge-new-bg);  color: var(--badge-new-color); }
.badge-russia-yes { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.badge-russia-no  { background: rgba(239, 68, 68, 0.15);  color: #ef4444; }

.source-link { color: var(--primary); text-decoration: none; display: inline-flex; align-items: center; gap: 2px; }
.source-link:hover { text-decoration: underline; }

.price-list { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.price-list li { margin-bottom: 4px; white-space: nowrap; }
.not-available { color: #ef4444; font-style: italic; }
.subscription-info { font-size: 13px; }
.subscription-line { white-space: nowrap; }

.col-russia { text-align: center; vertical-align: middle; }
.availability {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 4px 10px; border-radius: 8px; font-weight: 600; font-size: 13px; line-height: 1;
}
.availability-yes { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.availability-no  { background: rgba(239, 68, 68, 0.15);  color: #ef4444; }
.availability-unknown { background: var(--border); color: var(--text-muted); }
.lang-status { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

.rating-block { min-width: 120px; }
.rating-badge { display: inline-flex; align-items: center; gap: 4px; font-weight: bold; }
.rating-badge .stars { color: var(--accent); }
.rating-bar { width: 100%; height: 4px; background: var(--border); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.rating-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--primary)); transition: width 0.4s ease; }

.muted { color: var(--text-muted); font-style: italic; }

.btn {
    display: inline-block; padding: 9px 18px; border-radius: 6px; text-decoration: none;
    border: 0; cursor: pointer; font-size: 14px; font-family: inherit; font-weight: 500;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { opacity: 0.8; }

.btn-vote {
    display: block; margin-top: 8px; padding: 4px 10px; font-size: 12px;
    background: var(--primary); color: white; border: none; border-radius: 4px;
    cursor: pointer; font-family: inherit; transition: opacity 0.2s, transform 0.15s;
}
.btn-vote:hover { opacity: 0.85; transform: scale(1.03); }

.pagination { display: flex; gap: 4px; margin-top: 20px; justify-content: center; flex-wrap: wrap; }
.page-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 36px; height: 36px; padding: 0 10px; border-radius: 6px;
    border: 1px solid var(--border); background: var(--bg-soft); color: var(--text);
    text-decoration: none; font-size: 14px; font-weight: 500; transition: background 0.15s;
}
.page-btn:hover { background: var(--row-hover); border-color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); cursor: default; }
.page-btn.disabled { opacity: 0.4; cursor: not-allowed; }
.page-dots { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; color: var(--text-muted); }

.disclaimer { margin-top: 30px; font-size: 14px; color: var(--text-muted); max-width: 800px; line-height: 1.6; }
.site-footer { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 14px; }
.site-footer a { color: var(--primary); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* Модалки */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7); display: flex; align-items: flex-start; justify-content: center;
    z-index: 1000; backdrop-filter: blur(3px); animation: fadeIn 0.2s ease;
    padding: 40px 20px; /* Отступы сверху и снизу! */
    overflow-y: auto;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-content {
    background: var(--bg-soft); color: var(--text); padding: 32px 32px 40px;
    border-radius: 16px; position: relative; text-align: center;
    min-width: 320px; max-width: 500px; width: 100%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); border: 1px solid var(--border);
    animation: popIn 0.2s ease; margin: auto 0; /* Центрирование по вертикали */
}
.modal-content-wide {
    max-width: 780px; text-align: left; max-height: calc(100vh - 80px); overflow-y: auto;
}
@keyframes popIn { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-content h3 { margin-top: 0; color: var(--text); }
.close-btn {
    position: absolute; top: 10px; right: 15px; font-size: 24px; cursor: pointer;
    background: none; border: none; color: var(--text); opacity: 0.5; line-height: 1; font-family: inherit;
}
.close-btn:hover { opacity: 1; }

.stars-selector { font-size: 40px; color: var(--border); margin: 20px 0; cursor: pointer; user-select: none; }
.stars-selector span { transition: color 0.1s, transform 0.1s; padding: 0 5px; display: inline-block; }
.stars-selector span.active, .stars-selector span:hover { color: var(--accent); transform: scale(1.15); }
.vote-message { margin-top: 10px; font-size: 14px; font-weight: bold; min-height: 20px; }
.vote-message.success { color: #10b981; }
.vote-message.error { color: #ef4444; }
.vote-hint { font-size: 12px; color: var(--text-muted); margin-top: 12px; }

.detail-title { margin: 0 0 12px; font-size: 1.6rem; }
.detail-rating { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.detail-rating .stars { color: var(--accent); font-size: 18px; }
.detail-rating .rating-bar { min-width: 100px; flex: 1; }
.detail-lead { font-size: 1rem; color: var(--text-muted); margin-bottom: 16px; }
.detail-full { margin: 16px 0; line-height: 1.7; font-size: 15px; }
.detail-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 20px; }
.detail-cols h3 { margin: 0 0 10px; font-size: 1.1rem; color: var(--primary); }
.detail-actions { display: flex; gap: 10px; margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--border); margin-bottom: 10px; flex-wrap: wrap; }

.specs-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.specs-table th, .specs-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.specs-table th { font-weight: 600; color: var(--text-muted); width: 40%; }

.service-hero { padding: 40px 20px 40px; background: linear-gradient(135deg, var(--bg-soft), var(--bg)); border-bottom: 1px solid var(--border); }
.service-hero h1 { margin: 8px 0 12px; font-size: 2.4rem; background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.service-lead { font-size: 1.15rem; color: var(--text-muted); max-width: 800px; margin: 0 0 20px; }
.service-hero-actions { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.service-rating-big { font-size: 18px; font-weight: bold; color: var(--accent); }
.service-rating-big small { color: var(--text-muted); font-weight: normal; font-size: 13px; }
.breadcrumbs { font-size: 14px; color: var(--text-muted); display: flex; gap: 8px; align-items: center; margin-bottom: 16px; }
.breadcrumbs a { color: var(--primary); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }

.service-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 40px 0 24px; }
.service-section { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: 24px; box-shadow: 0 2px 8px var(--shadow); }
.service-section-wide { margin-bottom: 24px; }
.service-section h2 { margin-top: 0; font-size: 1.3rem; color: var(--primary); }
.service-details { line-height: 1.7; font-size: 15px; }

@media (max-width: 900px) {
    .service-grid { grid-template-columns: 1fr; }
    .detail-cols { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .hide-mobile { display: none !important; }
    .site-header h1 { font-size: 1.8rem; }
    .site-header { padding: 40px 15px 20px; }
    .site-logo-text { font-size: 22px; }
    .site-logo-icon { width: 44px; height: 44px; }
    .container { padding: 0 10px 40px; }
    .services-table th, .services-table td { padding: 10px; }
    .theme-switcher { top: 8px; right: 8px; padding: 2px; }
    .theme-btn { width: 28px; height: 28px; font-size: 14px; }
    .hero-stats { flex-wrap: wrap; gap: 12px; font-size: 13px; padding: 8px 16px; }
    .search-form { padding: 12px; }
    .search-input-wrap { min-width: 100%; }
    .category-tabs { gap: 4px; }
    .cat-tab { padding: 8px 14px; font-size: 13px; }
    .detail-title { font-size: 1.3rem; }
    .modal-content { padding: 20px 20px 30px; }
    .modal-overlay { padding: 20px 10px; }
    .service-hero h1 { font-size: 1.8rem; }
}