/**
 * KL Predictions — стили для блоков прогнозов и тезисов
 * Version: 2.1.0
 */

/* ============================================================
   ОБЩИЕ СТИЛИ БЛОКА
   ============================================================ */
.kl-topic-meta-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px 24px;
    margin: 20px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.kl-topic-meta-box .kl-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 20px;
}

.kl-topic-meta-box .kl-meta-item {
    display: flex;
    flex-direction: column;
}

.kl-topic-meta-box .kl-meta-full {
    grid-column: 1 / -1;
}

.kl-topic-meta-box .kl-meta-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    margin-bottom: 4px;
    font-weight: 600;
}

.kl-topic-meta-box .kl-meta-val {
    font-size: 14px;
    color: #1e293b;
    line-height: 1.5;
    word-break: break-word;
}

.kl-topic-meta-box .kl-deadline-display {
    font-weight: 600;
    color: #d97706;
}

.kl-topic-meta-box .kl-resolution {
    background: #f8fafc;
    padding: 10px 14px;
    border-radius: 6px;
    border-left: 3px solid #6366f1;
    font-style: italic;
    color: #475569;
    margin-top: 4px;
}

/* ============================================================
   БЛОК СТАВОК
   ============================================================ */
.kl-stake-container {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
}

.kl-btn-stake {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #6366f1;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 10px 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.kl-btn-stake:hover {
    background: #4f46e5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.kl-btn-stake:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.kl-stake-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 0;
}

.kl-stake-label {
    font-size: 14px;
    color: #475569;
}

.kl-stake-value {
    font-size: 18px;
    font-weight: 700;
    color: #059669;
}

.kl-stake-value.kl-stake-against {
    color: #dc2626;
}

.kl-stake-hint {
    font-size: 13px;
    color: #94a3b8;
    margin-top: 4px;
}

.kl-stake-error {
    color: #dc2626;
    font-size: 14px;
    padding: 8px 0;
}

.kl-stake-loading {
    color: #64748b;
    font-size: 14px;
    padding: 8px 0;
}

/* ============================================================
   ИТОГИ ГОЛОСОВАНИЯ (ПУЛ)
   ============================================================ */
.kl-pool-results {
    margin-top: 16px;
    padding: 14px 18px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
}

.kl-pool-header {
    font-weight: 700;
    font-size: 14px;
    color: #065f46;
    margin-bottom: 6px;
}

.kl-pool-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    padding: 2px 0;
}

.kl-pool-label {
    color: #475569;
}

.kl-pool-value {
    font-weight: 600;
    color: #1e293b;
}

.kl-pool-hidden {
    margin-top: 16px;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    color: #64748b;
    font-size: 13px;
    text-align: center;
}

/* ============================================================
   МОДАЛЬНОЕ ОКНО ДЛЯ СТАВОК
   ============================================================ */
.kl-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kl-modal {
    background: #ffffff;
    border-radius: 16px;
    padding: 32px;
    max-width: 420px;
    width: 92%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.kl-modal h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
}

.kl-modal p {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: #64748b;
}

.kl-ku-slider {
    width: 100%;
    margin: 12px 0 8px 0;
    accent-color: #6366f1;
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    -webkit-appearance: none;
    appearance: none;
}

.kl-ku-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #6366f1;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.kl-ku-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #6366f1;
    cursor: pointer;
    border: 2px solid #ffffff;
}

.kl-ku-value {
    text-align: center;
    font-size: 36px;
    font-weight: 700;
    color: #6366f1;
    margin: 8px 0 16px 0;
}

.kl-modal-actions {
    display: flex;
    gap: 10px;
}

.kl-modal-actions button {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.kl-btn-confirm {
    background: #6366f1;
    color: #ffffff;
}

.kl-btn-confirm:hover {
    background: #4f46e5;
}

.kl-btn-cancel {
    background: #f1f5f9;
    color: #475569;
}

.kl-btn-cancel:hover {
    background: #e2e8f0;
}

/* ============================================================
   РАБОТА НАД ОШИБКАМИ
   ============================================================ */
.kl-resolution-section {
    margin-top: 20px;
    padding: 16px 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.kl-resolution-header {
    font-weight: 700;
    font-size: 15px;
    color: #0f172a;
    margin-bottom: 10px;
}

.kl-resolution-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    box-sizing: border-box;
}

.kl-resolution-form textarea:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.kl-resolution-hint {
    font-size: 13px;
    color: #64748b;
    margin: 6px 0 12px 0;
}

.kl-resolution-readonly {
    background: #f1f5f9;
    padding: 12px 16px;
    border-radius: 6px;
    border-left: 3px solid #6366f1;
    font-size: 14px;
    line-height: 1.6;
    color: #1e293b;
    margin-bottom: 10px;
}

.kl-resolution-meta {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 12px;
}

.kl-resolution-empty {
    color: #64748b;
    font-size: 14px;
    padding: 8px 0;
}

.kl-resolve-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.kl-btn-resolve {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.kl-btn-resolve:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.kl-btn-fulfilled {
    background: #10b981;
    color: #ffffff;
}

.kl-btn-fulfilled:hover:not(:disabled) {
    background: #059669;
}

.kl-btn-failed {
    background: #ef4444;
    color: #ffffff;
}

.kl-btn-failed:hover:not(:disabled) {
    background: #dc2626;
}

.kl-resolve-message {
    margin-top: 10px;
}

.kl-notice {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
}

.kl-notice-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.kl-notice-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ============================================================
   ГРАВИЦАПА
   ============================================================ */
.kl-gravitsapa-main {
    text-align: center !important;
    padding: 10px 0 8px 0 !important;
    border-bottom: 1px solid #e2e8f0 !important;
    margin-bottom: 12px !important;
}

.kl-gravitsapa-main .kl-gravitsapa-label {
    font-size: 13px !important;
    color: #64748b !important;
    margin-bottom: 2px !important;
    line-height: 1.4 !important;
}

.kl-gravitsapa-main .kl-gravitsapa-value {
    font-size: 22px !important;
    color: #0f172a !important;
    line-height: 1.4 !important;
}

.kl-gravitsapa-main .kl-gravitsapa-value strong {
    font-weight: 700 !important;
    color: #6366f1 !important;
}

.kl-gravitsapa-main .kl-gravitsapa-time {
    font-size: 11px !important;
    color: #94a3b8 !important;
    margin-top: 2px !important;
    line-height: 1.4 !important;
}

/* ============================================================
   РАНГИ
   ============================================================ */
.kl-rank-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 6px;
    vertical-align: middle;
}

.kl-rank-calibrator   { background: #d4edda; color: #155724; }
.kl-rank-arguer       { background: #f8d7da; color: #721c24; }
.kl-rank-kuluarshchik { background: #e2e3e5; color: #383d41; }

/* ============================================================
   АДАПТИВ
   ============================================================ */
@media (max-width: 640px) {
    .kl-topic-meta-box {
        padding: 16px;
        margin: 12px 0;
    }

    .kl-topic-meta-box .kl-meta-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .kl-topic-meta-box .kl-meta-item {
        grid-column: 1 / -1;
    }

    .kl-btn-stake {
        width: 100%;
        justify-content: center;
    }

    .kl-modal {
        padding: 24px;
        width: 95%;
    }

    .kl-ku-value {
        font-size: 28px;
    }
}

/* ============================================================
   ТЕМНАЯ ТЕМА
   ============================================================ */
@media (prefers-color-scheme: dark) {
    .kl-topic-meta-box {
        background: #1e293b;
        border-color: #334155;
    }

    .kl-topic-meta-box .kl-meta-val {
        color: #e2e8f0;
    }

    .kl-topic-meta-box .kl-meta-label {
        color: #94a3b8;
    }

    .kl-topic-meta-box .kl-resolution {
        background: #0f172a;
        border-color: #6366f1;
        color: #cbd5e1;
    }

    .kl-btn-stake {
        background: #818cf8;
    }

    .kl-btn-stake:hover {
        background: #6366f1;
    }

    .kl-modal {
        background: #1e293b;
    }

    .kl-modal h3 {
        color: #f1f5f9;
    }

    .kl-modal p {
        color: #94a3b8;
    }

    .kl-ku-value {
        color: #818cf8;
    }

    .kl-btn-cancel {
        background: #334155;
        color: #e2e8f0;
    }

    .kl-btn-cancel:hover {
        background: #475569;
    }

    .kl-pool-results {
        background: #064e3b;
        border-color: #065f46;
    }

    .kl-pool-header {
        color: #a7f3d0;
    }

    .kl-pool-label {
        color: #94a3b8;
    }

    .kl-pool-value {
        color: #f1f5f9;
    }

    .kl-pool-hidden {
        background: #0f172a;
        border-color: #334155;
        color: #94a3b8;
    }

    .kl-resolution-section {
        background: #0f172a;
        border-color: #334155;
    }

    .kl-resolution-header {
        color: #f1f5f9;
    }

    .kl-resolution-readonly {
        background: #1e293b;
        color: #e2e8f0;
    }

    .kl-resolution-empty {
        color: #94a3b8;
    }

    .kl-rank-calibrator   { background: #1a3a2a; color: #6ee7b7; }
    .kl-rank-arguer       { background: #3a1a1a; color: #fca5a5; }
    .kl-rank-kuluarshchik { background: #2a2a2a; color: #cbd5e1; }
}

/* ============================================================
   KL FORECAST — АКТИВНЫЕ ПРОГНОЗЫ НА ГЛАВНОЙ
   ============================================================ */

.kl-forecast-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
}

.kl-forecast-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    max-width: 900px;
    width: 100%;
}

.kl-forecast-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px 24px;
    background: #ffffff;
    text-align: left;
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.kl-forecast-card:hover {
    border-color: #6366f1;
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.10);
}

.kl-forecast-card h3 a:hover {
    color: #6366f1 !important;
}

.kl-forecast-tag {
    display: inline-block;
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.kl-forecast-tag--politics {
    background: #eef2ff;
    color: #6366f1;
}

.kl-forecast-tag--economy {
    background: #fffbeb;
    color: #f59e0b;
}

.kl-forecast-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #047857;
    background: #ecfdf5;
}

.kl-forecast-deadline {
    font-size: 13px;
    color: #94a3b8;
    margin: 8px 0 10px 0;
}

.kl-forecast-deadline-icon {
    margin-right: 4px;
}

.kl-forecast-deadline strong {
    color: #1e293b;
    font-weight: 600;
}

.kl-forecast-description {
    font-size: 14px;
    color: #475569;
    line-height: 1.6;
    margin: 0 0 12px 0;
}

.kl-forecast-author {
    font-size: 13px;
    color: #94a3b8;
}

.kl-forecast-more {
    display: inline-block;
    margin-top: 12px;
    color: #6366f1;
    font-weight: 500;
    text-decoration: none;
}

.kl-forecast-more:hover {
    color: #4338ca;
    text-decoration: underline;
}

@media (max-width: 768px) {
    .kl-forecast-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        max-width: 600px;
    }

    .kl-forecast-card {
        padding: 16px 20px;
    }

    .kl-forecast-card h3 {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .kl-forecast-grid {
        gap: 12px;
        padding: 0 4px;
    }

    .kl-forecast-card {
        padding: 14px 16px;
    }

    .kl-forecast-card h3 {
        font-size: 15px;
    }
}