/* ========== PERSONAL MESSAGES - ПОЛНЫЙ КОД ========== */

/* ========== PM HEADER ========== */
.pm-header {
    background: #1a1a1a;
    padding: 12px;
    border-bottom: 1px solid #2a2a2a;
}

.pm-title {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

/* Navigation */
.pm-nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
}

.pm-nav::-webkit-scrollbar {
    display: none;
}

.pm-nav-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 9px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    color: #888;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-decoration: none;
}

.pm-nav-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.pm-nav-btn:hover {
    background: #3a3a3a;
}

.pm-nav-btn.active {
    background: linear-gradient(135deg, #2196F3, #42A5F5);
    border-color: #2196F3;
    color: #fff;
}

.pm-nav-btn.new {
    background: linear-gradient(135deg, #4CAF50, #66BB6A);
    border-color: #4CAF50;
    color: #fff;
}

/* ========== PM LIST SECTION ========== */
.pm-list-section {
    background: #1a1a1a;
    padding: 16px;
}

.pm-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 0 4px;
}

.section-subtitle {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.pm-list-actions {
    display: flex;
    gap: 6px;
}

.select-all-btn,
.delete-selected-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    color: #888;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.select-all-btn svg,
.delete-selected-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.select-all-btn:hover {
    background: rgba(33, 150, 243, 0.15);
    border-color: #2196F3;
    color: #2196F3;
}

.delete-selected-btn:hover {
    background: rgba(244, 67, 54, 0.15);
    border-color: #F44336;
    color: #F44336;
}

.select-all-btn:active,
.delete-selected-btn:active {
    transform: scale(0.95);
}

.pm-list {
    /* Контейнер для таблицы */
}

/* ========== PM TABLE ========== */
table.pm {
    width: 100% !important;
    border-collapse: collapse;
    display: block;
    background: transparent;
}

table.pm tbody {
    display: block;
}

/* Скрыть заголовки */
table.pm tr:first-child {
    display: none;
}

/* Строки - компактные карточки */
table.pm tr {
    display: grid;
    grid-template-columns: 8px 1fr auto;
    grid-template-rows: auto auto;
    gap: 6px 12px;
    padding: 14px 12px;
    margin-bottom: 6px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    transition: all 0.2s;
    align-items: start;
}

table.pm tr:hover {
    background: #333;
    border-color: #4a4a4a;
}

/* Пустая строка */
table.pm tr:has(td[colspan="5"]) {
    display: none;
}

/* Последняя строка с действиями */
table.pm tr:last-child {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 12px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    margin-bottom: 0;
}

/* ========== ЯЧЕЙКИ ========== */
table.pm td {
    padding: 0;
    border: none;
    background: transparent;
}

/* Индикатор (точка) */
table.pm td:nth-child(1) {
    grid-column: 1;
    grid-row: 1 / 3;
    width: 8px;
    height: 100%;
    display: flex;
    align-items: flex-start;
    padding-top: 4px;
}

table.pm td:nth-child(1) img {
    display: none;
}

table.pm td:nth-child(1)::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: block;
}

/* Цвета точек */
table.pm tr:has(img[src*="unread.gif"]) td:nth-child(1)::before {
    background: #4CAF50;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
}

table.pm tr:has(img[src*="read.gif"]) td:nth-child(1)::before {
    background: #555;
}

table.pm tr:has(img[src*="send.gif"]) td:nth-child(1)::before {
    background: #2196F3;
    box-shadow: 0 0 8px rgba(33, 150, 243, 0.6);
}

/* Тема сообщения */
table.pm td:nth-child(2) {
    grid-column: 2;
    grid-row: 1 / 3;
    min-width: 0;
    padding-right: 8px;
}

table.pm td:nth-child(2) a {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    margin-bottom: 6px;
}

table.pm td:nth-child(2) a:hover {
    color: #4CAF50;
}

table.pm td:nth-child(2) a b {
    font-weight: 700;
}

/* Автор под темой - МОБИЛЬНЫЕ */
.pm-author-mobile {
    display: block;
    font-size: 11px;
    color: #2196F3;
    font-weight: 500;
}

/* Правая колонка - автор */
table.pm td:nth-child(3) {
    grid-column: 3;
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
}

table.pm td:nth-child(3) a {
    color: #2196F3;
    text-decoration: none;
    white-space: nowrap;
}

table.pm td:nth-child(3) a:hover {
    color: #42A5F5;
}

/* Дата + Чекбокс */
table.pm td:nth-child(4),
table.pm td:nth-child(5) {
    grid-column: 3;
    grid-row: 2;
}

table.pm td:nth-child(4) {
    font-size: 10px;
    color: #888;
    display: flex;
    align-items: center;
    gap: 10px;
}

table.pm td:nth-child(5) {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

table.pm td:nth-child(5) input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #4CAF50;
    margin: 0;
    flex-shrink: 0;
}

/* ========== ПАГИНАЦИЯ И ДЕЙСТВИЯ ========== */
table.pm tr:last-child td:first-child {
    width: 100%;
}

table.pm tr:last-child td:last-child {
    width: 100%;
    display: flex;
    gap: 8px;
    align-items: center;
}

.navigation {
    display: flex;
    gap: 4px;
    justify-content: center;
    padding: 10px;
    background: #2a2a2a;
    border-radius: 6px;
}

.navigation span,
.navigation a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    background: #1a1a1a;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.navigation span {
    background: linear-gradient(135deg, #4CAF50, #66BB6A);
    border-color: #4CAF50;
}

.navigation a:hover {
    background: #3a3a3a;
    transform: translateY(-1px);
}

/* Селект действий */
table.pm select[name="doaction"] {
    flex: 1;
    padding: 10px 14px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

table.pm select[name="doaction"]:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

table.pm select[name="doaction"] option {
    background: #2a2a2a;
    color: #fff;
}

table.pm select[name="doaction"] optgroup {
    background: #1a1a1a;
    color: #888;
    font-weight: 700;
}

/* Кнопка Start */
table.pm input.bbcodes[type="submit"] {
    padding: 10px 20px;
    background: linear-gradient(135deg, #4CAF50, #66BB6A);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

table.pm input.bbcodes[type="submit"]:hover {
    background: linear-gradient(135deg, #66BB6A, #81C784);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

table.pm input.bbcodes[type="submit"]:active {
    transform: translateY(0) scale(0.98);
}

/* ========== ВЫБРАННЫЕ СООБЩЕНИЯ ========== */
table.pm tr:has(input[type="checkbox"]:checked) {
    background: rgba(76, 175, 80, 0.1);
    border-color: #4CAF50;
}

table.pm tr:has(input[type="checkbox"]:checked) td:nth-child(1)::before {
    background: #4CAF50;
    box-shadow: 0 0 12px rgba(76, 175, 80, 1);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

/* ========== NEW PM FORM ========== */
.pm-new-section {
    background: #1a1a1a;
    padding: 16px;
}

.pm-new-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #2a2a2a;
}

.pm-new-header svg {
    width: 28px;
    height: 28px;
    fill: #4CAF50;
}

.pm-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #aaa;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    font-size: 14px;
    color: #fff;
    font-family: inherit;
    transition: all 0.2s;
    box-sizing: border-box;
}

.form-input::placeholder {
    color: #666;
}

.form-input:focus {
    outline: none;
    border-color: #4CAF50;
    background: #333;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.form-textarea {
    width: 100%;
    padding: 14px 16px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    font-size: 14px;
    color: #fff;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    transition: all 0.2s;
    box-sizing: border-box;
    line-height: 1.5;
}

.form-textarea::placeholder {
    color: #666;
}

.form-textarea:focus {
    outline: none;
    border-color: #4CAF50;
    background: #333;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 12px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    transition: all 0.2s;
}

.checkbox-label:hover {
    background: #333;
}

.checkbox-input {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #4CAF50;
}

.checkbox-text {
    font-size: 14px;
    color: #ddd;
}

/* Капча */
.captcha-group {
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    padding: 16px;
}

.captcha-label {
    font-size: 13px;
    color: #aaa;
    font-weight: 500;
}

.captcha-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.captcha-image {
    display: flex;
    justify-content: center;
    padding: 12px;
    background: #fff;
    border-radius: 6px;
}

.captcha-image img {
    display: block;
    max-width: 100%;
    height: auto;
}

.recaptcha-group {
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    padding: 16px;
}

.recaptcha-label {
    font-size: 13px;
    color: #aaa;
    font-weight: 500;
}

.recaptcha-container {
    margin-top: 8px;
    display: flex;
    justify-content: center;
}

.form-actions {
    margin-top: 8px;
}

.submit-btn {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #4CAF50, #66BB6A);
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    text-transform: none;
    font-family: inherit;
}

.submit-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.submit-btn:hover {
    background: linear-gradient(135deg, #66BB6A, #81C784);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4);
    transform: translateY(-1px);
}

.submit-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

/* ========== READ PM ========== */
.pm-read-section {
    background: #1a1a1a;
    padding: 16px;
}

.pm-message-card {
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 12px;
    overflow: hidden;
}

/* Header с автором */
.pm-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #1a1a1a;
    border-bottom: 1px solid #3a3a3a;
}

.pm-message-author {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pm-message-author svg {
    width: 40px;
    height: 40px;
    padding: 8px;
    background: #2a2a2a;
    border-radius: 50%;
    fill: #2196F3;
}

.author-name {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

/* Действия */
.pm-message-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: #2a2a2a;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}

.action-btn svg {
    width: 20px;
    height: 20px;
    fill: #888;
    transition: fill 0.2s;
}

.action-btn:hover {
    background: #3a3a3a;
}

.action-btn:active {
    transform: scale(0.9);
}

.reply-btn:hover {
    background: rgba(33, 150, 243, 0.15);
}

.reply-btn:hover svg {
    fill: #2196F3;
}

.delete-btn:hover {
    background: rgba(244, 67, 54, 0.15);
}

.delete-btn:hover svg {
    fill: #F44336;
}

/* Тема сообщения */
.pm-message-subject {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    padding: 16px;
    background: #2a2a2a;
    border-bottom: 1px solid #3a3a3a;
}

/* Тело сообщения */
.pm-message-body {
    padding: 20px;
    font-size: 14px;
    line-height: 1.6;
    color: #ddd;
    word-wrap: break-word;
}

.pm-message-body p {
    margin: 0 0 12px;
}

.pm-message-body p:last-child {
    margin-bottom: 0;
}

.pm-message-body a {
    color: #2196F3;
    text-decoration: none;
    word-break: break-all;
}

.pm-message-body a:hover {
    text-decoration: underline;
}

/* Футер с метаданными */
.pm-message-footer {
    padding: 16px;
    background: #1a1a1a;
    border-top: 1px solid #3a3a3a;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pm-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #888;
}

.pm-meta-item svg {
    width: 16px;
    height: 16px;
    fill: #666;
}

.pm-meta-label {
    color: #aaa;
    font-weight: 600;
}

.pm-meta-value {
    color: #fff;
}

/* Адаптивность */
@media (min-width: 600px) {
    .pm-message-footer {
        flex-direction: row;
        justify-content: space-between;
    }
}

/* ========== АДАПТИВНОСТЬ ========== */
@media (min-width: 600px) {
    table.pm tr {
        grid-template-columns: 8px 1fr 150px 110px 20px;
        grid-template-rows: auto;
        padding: 12px;
    }
    
    table.pm td:nth-child(1) {
        grid-row: 1;
        padding-top: 0;
        align-items: center;
    }
    
    table.pm td:nth-child(2) {
        grid-row: 1;
        padding-right: 12px;
    }
    
    .pm-author-mobile {
        display: none;
    }
    
    table.pm td:nth-child(3) {
        grid-column: 3;
        grid-row: 1;
    }
    
    table.pm td:nth-child(4) {
        grid-column: 4;
        grid-row: 1;
        justify-content: flex-end;
    }
    
    table.pm td:nth-child(5) {
        grid-column: 5;
        grid-row: 1;
    }
    
    table.pm tr:last-child {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    table.pm tr:last-child td:first-child {
        width: auto;
        flex: 1;
    }
    
    table.pm tr:last-child td:last-child {
        width: auto;
        max-width: 400px;
    }
    
    .captcha-wrapper {
        flex-direction: row;
        align-items: center;
    }
    
    .captcha-image {
        flex-shrink: 0;
    }
}

@media (min-width: 900px) {
    .pm-header,
    .pm-list-section,
    .pm-new-section,
    .pm-read-section {
        max-width: 900px;
        margin: 0 auto;
    }
}

/* ========== АНИМАЦИИ ========== */
@keyframes pmSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

table.pm tr {
    animation: pmSlideIn 0.3s ease-out;
}

table.pm tr:nth-child(2) { animation-delay: 0.05s; }
table.pm tr:nth-child(3) { animation-delay: 0.1s; }
table.pm tr:nth-child(4) { animation-delay: 0.15s; }
table.pm tr:nth-child(5) { animation-delay: 0.2s; }
table.pm tr:nth-child(6) { animation-delay: 0.25s; }
table.pm tr:nth-child(7) { animation-delay: 0.3s; }




/* ========== КНОПКИ УПРАВЛЕНИЯ В ФОРМЕ ========== */
.ignore-btn:hover {
    background: rgba(255, 152, 0, 0.15);
}

.ignore-btn:hover svg {
    fill: #FF9800;
}
/* Скрыть старый заголовок */
.pm-list-header {
    display: none;
}

/* Последняя строка таблицы - действия */
table.pm tr:last-child {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 12px;
    padding: 14px 12px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    margin-bottom: 0;
}

/* Пагинация - первая колонка */
table.pm tr:last-child td:first-child {
    grid-column: 1 / -1;
    grid-row: 1;
}

/* Действия - вторая строка */
table.pm tr:last-child td:last-child {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    align-items: center;
}

/* Селект */
table.pm tr:last-child select[name="doaction"] {
    grid-column: 1;
}

/* Кнопка Start (Submit) */
table.pm tr:last-child input[type="submit"] {
    grid-column: 2;
    padding: 10px 16px;
    white-space: nowrap;
}

/* ДОБАВИТЬ чекбокс master_box как кнопку */
table.pm tr:last-child input[name="master_box"] {
    display: none;
}

/* Создать кнопку для чекбокса через label */
table.pm tr:last-child::before {
    content: '✓ Όλα';
    grid-column: 3;
    grid-row: 2;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    color: #888;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

table.pm tr:last-child:hover::before {
    background: rgba(33, 150, 243, 0.15);
    border-color: #2196F3;
    color: #2196F3;
}

@media (min-width: 600px) {
    table.pm tr:last-child {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto;
    }
    
    table.pm tr:last-child td:first-child {
        grid-column: 1;
        grid-row: 1;
    }
    
    table.pm tr:last-child td:last-child {
        grid-column: 2;
        grid-row: 1;
        display: flex;
        gap: 8px;
    }
    
    table.pm tr:last-child::before {
        grid-column: auto;
        grid-row: auto;
    }
}