/* ========================================
   СЕТКА МОДЕЛЕЙ
   ======================================== */

.wca-models-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.wca-columns-1 { grid-template-columns: repeat(1, 1fr) !important; }
.wca-columns-2 { grid-template-columns: repeat(2, 1fr) !important; }
.wca-columns-3 { grid-template-columns: repeat(3, 1fr) !important; }
.wca-columns-4 { grid-template-columns: repeat(4, 1fr) !important; }
.wca-columns-5 { grid-template-columns: repeat(5, 1fr) !important; }
.wca-columns-6 { grid-template-columns: repeat(6, 1fr) !important; }

@media (max-width: 1024px) {
    .wca-models-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .wca-models-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .wca-models-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   КАРТОЧКА МОДЕЛИ
   ======================================== */

.wca-model-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.wca-model-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.wca-model-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    background: #f5f5f5;
    display: block;
}

.wca-model-info {
    padding: 12px;
}

.wca-model-name {
    font-size: 16px;
    font-weight: bold;
    margin: 0 0 8px 0;
    color: #333;
}

.wca-model-meta {
    font-size: 13px;
    color: #666;
    margin-bottom: 5px;
}

.wca-model-views {
    font-size: 12px;
    color: #999;
}

.wca-online-badge,
.wca-offline-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 8px;
}

.wca-online-badge {
    background: #46b450;
    color: #fff;
}

.wca-offline-badge {
    background: #999;
    color: #fff;
}

/* ========================================
   МОДАЛКА
   ======================================== */

.wca-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.wca-modal-overlay.wca-modal-open {
    display: flex;
}

.wca-modal {
    background: #fff;
    border-radius: 8px;
    /* Почти на всю ширину окна */
    width: 70vw;
    max-width: 70vw;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    position: relative;
}

.wca-modal-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wca-modal-title {
    font-size: 18px;
    font-weight: bold;
    margin: 0;
}

.wca-modal-close {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
}

.wca-modal-body {
    padding: 16px;
}

/* Верхний/нижний HTML в модалке */
.wca-modal-top-html,
.wca-modal-bottom-html {
    margin-bottom: 15px;
}

/* ========================================
   ВИДЕО И ЧАТ (ОБЩАЯ РАЗМЕТКА)
   ======================================== */

.wca-modal-main {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

.wca-modal-video-block {
    flex: 2;
    min-width: 0;
}

.wca-modal-chat-block {
    flex: 1;
    min-width: 0;
}

.wca-modal-video-player {
    width: 100%;
    max-height: 400px;
    background: #000;
    border-radius: 6px;
}

.wca-modal-preview-image {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 6px;
}

.wca-modal-video-placeholder {
    background: #f5f5f5;
    padding: 40px;
    text-align: center;
    color: #999;
    border-radius: 6px;
}

/* ========================================
   CHAT
   ======================================== */

.wca-chat-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
    flex-wrap: wrap;
}

.wca-chat-tab {
    padding: 8px 16px;
    border: none;
    background: #f5f5f5;
    cursor: pointer;
    border-radius: 5px 5px 0 0;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.2s;
}

.wca-chat-tab:hover {
    background: #e8e8e8;
}

.wca-chat-tab.active {
    background: #4CAF50;
    color: white;
}

.wca-chat-tab-public.active {
    background: #2196F3;
}

.wca-chat-tab-private.active {
    background: #9C27B0;
}

.wca-chat-tab-users.active {
    background: #FF9800;
}

.wca-chat-container {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.wca-chat-messages {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 15px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 5px;
}

.wca-chat-message {
    margin-bottom: 12px;
    padding: 10px;
    background: #fff;
    border-radius: 5px;
    border-left: 3px solid #2196F3;
}

.wca-chat-message:nth-child(even) {
    border-left-color: #4CAF50;
}

.wca-chat-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 12px;
    color: #888;
}

.wca-chat-user {
    font-weight: 600;
    color: #333;
}

.wca-chat-time {
    color: #999;
}

.wca-chat-body {
    font-size: 14px;
    color: #333;
    line-height: 1.4;
}

.wca-chat-no-messages {
    text-align: center;
    color: #999;
    padding: 20px;
}

.wca-chat-input-area {
    display: flex;
    gap: 10px;
}

.wca-chat-message-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.wca-chat-message-input:focus {
    border-color: #2196F3;
}

.wca-chat-send-btn {
    padding: 10px 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.wca-chat-send-btn:hover {
    background: #43A047;
}

.wca-chat-users-panel {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
}

.wca-chat-users-panel h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #666;
}

.wca-chat-users-list {
    max-height: 300px;
    overflow-y: auto;
}

.wca-chat-user-item {
    padding: 8px 12px;
    background: #fff;
    border-radius: 5px;
    margin-bottom: 8px;
    font-size: 14px;
    color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wca-chat-model-owner {
    background: #E3F2FD;
    border-left: 3px solid #2196F3;
    font-weight: 600;
}

.wca-chat-user-badge {
    background: #2196F3;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}

.wca-no-users {
    text-align: center;
    color: #999;
    padding: 10px;
}

/* ========================================
   МЕТА ДАННЫЕ
   ======================================== */

.wca-modal-meta {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.wca-modal-meta-row {
    margin-bottom: 8px;
    font-size: 13px;
    color: #555;
}

.wca-modal-meta-label {
    font-weight: bold;
    margin-right: 5px;
}

/* ========================================
   ПРОФИЛЬ МОДЕЛИ
   ======================================== */

.wca-model-profile {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.wca-model-profile-avatar {
    max-width: 300px;
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.wca-model-profile-name {
    font-size: 24px;
    margin-top: 15px;
}

.wca-model-profile-meta {
    margin-bottom: 20px;
}

.wca-model-profile-actions button {
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
}

/* ========================================
   РЕФЕРАЛЬНЫЕ КНОПКИ
   ======================================== */

.wca-ref-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.wca-ref-btn {
    padding: 8px 16px;
    background: #0073aa;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    display: inline-block;
}

.wca-ref-btn:hover {
    opacity: 0.9;
}

.wca-ref-webmaster {
    background: #00a32a;
}

.wca-ref-signup {
    background: #dc3232;
}

/* ========================================
   ВИДЖЕТ АГРЕГАТОРА
   ======================================== */

.wca-aggregator-widget {
    font-size: 14px;
}

.wca-aggr-loading {
    color: #888;
    font-style: italic;
}

.wca-aggr-sites {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wca-aggr-site-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 0;
    border-bottom: 1px solid #eee;
}

.wca-aggr-site-name {
    font-weight: 600;
    flex: 1 1 auto;
}

.wca-aggr-site-total,
.wca-aggr-site-online {
    white-space: nowrap;
    margin-left: 8px;
}

/* ========================================
   АДАПТИВ (МОБИЛЬНЫЕ)
   ======================================== */

/* Мобильные: видео сверху, чат снизу */
@media (max-width: 768px) {
    .wca-modal {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }

    .wca-modal-body {
        padding: 10px;
    }

    /* Вертикальная раскладка: видео сверху, чат снизу */
    .wca-modal-main {
        flex-direction: column;
        gap: 10px;
    }

    .wca-modal-video-block,
    .wca-modal-chat-block {
        flex: none;
        width: 100%;
    }

    .wca-modal-video-player,
    .wca-modal-preview-image {
        max-height: 300px;
    }

    .wca-chat-messages {
        max-height: 250px;
    }

    .wca-chat-tabs {
        flex-wrap: wrap;
    }

    .wca-chat-tab {
        flex: 1 1 auto;
        text-align: center;
        min-width: 80px;
    }

    .wca-chat-input-area {
        flex-direction: column;
    }

    .wca-chat-send-btn {
        width: 100%;
    }

    .wca-ref-buttons {
        flex-direction: column;
    }

    .wca-ref-btn {
        width: 100%;
        text-align: center;
    }

    .wca-modal-title {
        font-size: 16px;
    }

    .wca-modal-meta-row {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .wca-model-image {
        height: 200px;
    }

    .wca-modal-video-player,
    .wca-modal-preview-image {
        max-height: 250px;
    }

    .wca-chat-messages {
        max-height: 200px;
    }

    .wca-chat-tab {
        flex: 1 1 45%;
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    .wca-modal-video-player,
    .wca-modal-preview-image {
        max-height: 200px;
    }

    .wca-chat-messages {
        max-height: 150px;
    }
}

/* ========================================
   FEEDBACK (без изменений, просто порядок)
   ======================================== */

.wca-feedback {
    width: 100%;
    max-width: 1100px;
    margin: 30px auto;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    box-sizing: border-box;
}

.wca-feedback-moderator-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 20px;
}

.wca-feedback-users {
    border-right: 1px solid #ddd;
    padding-right: 15px;
}

.wca-feedback-users h3 {
    margin: 0 0 15px;
}

.wca-feedback-users-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wca-feedback-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #fff;
    color: #333;
    text-align: left;
    cursor: pointer;
}

.wca-feedback-user:hover,
.wca-feedback-user.is-active {
    border-color: #0073aa;
    background: #eef7fb;
}

.wca-feedback-user b {
    min-width: 22px;
    padding: 2px 6px;
    border-radius: 12px;
    background: #d63638;
    color: #fff;
    text-align: center;
    font-size: 12px;
}

.wca-feedback-chat {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.wca-feedback-chat-header {
    min-height: 40px;
    padding-bottom: 12px;
    border-bottom: 1px solid #ddd;
}

.wca-feedback-messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 350px;
    max-height: 500px;
    padding: 15px 0;
    overflow-y: auto;
}

.wca-feedback-message {
    max-width: 75%;
    padding: 10px 13px;
    border-radius: 8px;
    background: #f0f0f0;
}

.wca-feedback-message.is-own {
    align-self: flex-end;
    background: #dff1ff;
}

.wca-feedback-message.is-other {
    align-self: flex-start;
}

.wca-feedback-message-author {
    margin-bottom: 4px;
    color: #555;
    font-size: 12px;
    font-weight: 600;
}

.wca-feedback-message-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    color: #222;
}

.wca-feedback-message-date {
    margin-top: 6px;
    color: #888;
    font-size: 11px;
    text-align: right;
}

.wca-feedback-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wca-feedback-form textarea {
    width: 100%;
    min-height: 85px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    resize: vertical;
    box-sizing: border-box;
}

.wca-feedback-form button {
    align-self: flex-end;
    padding: 10px 20px;
    border: 0;
    border-radius: 5px;
    background: #0073aa;
    color: #fff;
    cursor: pointer;
}

.wca-feedback-form button:disabled {
    opacity: .6;
    cursor: wait;
}

.wca-feedback-form-message {
    font-size: 14px;
}

.wca-feedback-form-message.is-success {
    color: #176b2c;
}

.wca-feedback-form-message.is-error {
    color: #b32d2e;
}

.wca-feedback-empty,
.wca-feedback-loading {
    padding: 20px;
    color: #777;
    text-align: center;
}

@media screen and (max-width: 700px) {
    .wca-feedback-moderator-layout {
        display: block;
    }

    .wca-feedback-users {
        margin-bottom: 20px;
        padding-right: 0;
        padding-bottom: 15px;
        border-right: 0;
        border-bottom: 1px solid #ddd;
    }

    .wca-feedback-message {
        max-width: 90%;
    }
}