/* ==========================================================================
   ru-openrouter.ru — Провайдеры (public-providers)
   Страничные стили страницы /v2/providers.
   Паттерн: глобальные стили в public.css, страничные — здесь (public-<page>.css).
   Тёмная/светлая темы — через CSS-переменные из public.css.
   ========================================================================== */

.site-main > .container { padding-top: 0px !important; }

/* ===== Page layout ===== */
.providers-page {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 24px 80px;
}

/* ===== Hero (как на /v2/models) ===== */
.providers-hero {
    position: relative;
    text-align: center;
    padding: 64px 0 40px;
    overflow: hidden;
}
.providers-hero h1 {
    margin: 0 0 12px;
    font-size: clamp(2rem, 4.5vw, 3.2rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 45%, var(--accent-3) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.providers-hero .hero-sub {
    margin: 0 auto;
    max-width: 700px;
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.6;
}
.providers-hero .hero-glow {
    position: absolute;
    top: -40%;
    left: 50%;
    transform: translateX(-50%);
    width: 720px;
    height: 480px;
    background: radial-gradient(closest-side, rgba(14,165,233,0.22), transparent 70%);
    pointer-events: none;
    z-index: 0;
}
.providers-hero .hero-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}
.providers-hero .hero-orb-1 { width: 220px; height: 220px; top: 8%; left: 6%; background: rgba(56,189,248,0.25); }
.providers-hero .hero-orb-2 { width: 260px; height: 260px; bottom: 0; right: 8%; background: rgba(34,211,238,0.18); }

/* ===== Error / empty ===== */
.error-state {
    max-width: 520px;
    margin: 40px auto;
    padding: 40px 24px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--glass-bg, rgba(255,255,255,0.03));
    color: var(--text);
}
.error-state .error-icon { color: #ef4444; margin-bottom: 12px; }
.no-data {
    text-align: center;
    color: var(--text-muted);
    padding: 60px 0;
}

/* ===== Сетка карточек ===== */
.providers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
    position: relative;
    z-index: 1;
}

.provider-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--glass-bg, rgba(255,255,255,0.03));
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.provider-card:hover {
    border-color: var(--accent, #0ea5e9);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}
.provider-card:focus-visible {
    outline: 2px solid var(--accent, #0ea5e9);
    outline-offset: 2px;
}

.provider-card-head {
    display: flex;
    align-items: center;
    gap: 14px;
}

.provider-logo {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(127,127,127,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
}
.provider-logo {    
    border-radius: 8px;
}

.provider-logo img {   
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 5px; 
    border-radius: 12px !important;
}

.provider-logo-fallback {
    display: none;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

.provider-name-wrap {
    min-width: 0;
}
.provider-name {
    margin: 0 0 4px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.provider-hq {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.provider-hq svg { width: 14px; height: 14px; }

.provider-models-hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.provider-models-hint svg {
    width: 14px;
    height: 14px;
    color: var(--accent, #0ea5e9);
}

.provider-links {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.provider-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.84rem;
    color: var(--accent, #0ea5e9);
    text-decoration: none;
    transition: color 0.15s ease;
}
.provider-link:hover { color: var(--accent-2, #22d3ee); text-decoration: underline; }
.provider-link svg { width: 15px; height: 15px; }

/* ===== Модалка: модели провайдера ===== */
.provider-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(10, 15, 30, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}
.provider-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}
.provider-modal {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    background: var(--glass-bg-strong);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    box-shadow: var(--shadow);
    transform: translateY(12px) scale(0.98);
    transition: transform .25s ease;
}
.provider-modal-overlay.active .provider-modal {
    transform: translateY(0) scale(1);
}
.provider-modal__close {
    position: absolute;
    top: 14px;
    right: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text-muted);
    cursor: pointer;
    transition: all .2s ease;
    z-index: 2;
}
.provider-modal__close:hover {
    background: var(--glass-hi);
    color: var(--text);
}
.provider-modal__close svg { width: 18px; height: 18px; }
.provider-modal__header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-right: 40px;
    margin-bottom: 18px;
}
.provider-modal__icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: contain;
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 6px;
}
.provider-modal__titles { min-width: 0; }
.provider-modal__name { display: block; font-size: 1.05rem; font-weight: 700; color: var(--text); }
.provider-modal__tag { font-size: 0.8rem; color: var(--text-muted); }
.provider-modal__body { display: flex; flex-direction: column; gap: 8px; }

.provider-modal-list { display: flex; flex-direction: column; gap: 6px; }
.provider-modal-item {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 10px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
}
.provider-modal-item__icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    object-fit: contain;
    background: rgba(127,127,127,0.12);
    padding: 3px;
}
.provider-modal-item__name {
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
    color: var(--text);
    text-decoration: none;
    overflow-wrap: anywhere;
    transition: color .15s ease;
}
.provider-modal-item__name:hover { color: var(--accent, #0ea5e9); }
.provider-modal-item__badges {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.pm-badge {
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.72rem;
    white-space: nowrap;
}
.provider-modal-empty {
    padding: 24px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.provider-modal-error {
    padding: 24px 0;
    text-align: center;
    color: #ef4444;
    font-size: 0.9rem;
}
.provider-modal-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 32px 0;
    color: var(--text-muted);
    font-size: 0.88rem;
}
.pm-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent, #0ea5e9);
    border-radius: 50%;
    animation: pm-spin .7s linear infinite;
}
@keyframes pm-spin { to { transform: rotate(360deg); } }

/* ===== Адаптив ===== */
@media (max-width: 768px) {
    .providers-hero { padding: 40px 0 28px; }
    .providers-page { padding: 0px; }
    .provider-modal-overlay { padding: 12px; }
}
