/**
 * Asgaros Forum - Private Messaging (MyBB Style Stylesheet)
 */

/* Page Container Expansion for Private Messages */
.page:has(.af-pm-wrapper) #content-wrap,
.page:has(.af-pm-wrapper) .container,
body:has(.af-pm-wrapper) #primary,
body:has(.af-pm-wrapper) .container {
    width: 100% !important;
    max-width: 1440px !important;
}

/* Main Wrapper */
.af-pm-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #333333;
    margin: 20px auto;
    width: 100%;
    max-width: 100%;
    line-height: 1.5;
    box-sizing: border-box;
}

.af-pm-wrapper * {
    box-sizing: border-box;
}

/* Notices & Alerts */
.af-pm-notice {
    padding: 12px 18px;
    border-radius: 4px;
    margin-bottom: 18px;
    font-size: 14px;
    font-weight: 500;
}

.af-pm-notice.af-pm-success {
    background-color: #e8f5e9;
    border-left: 4px solid #2e7d32;
    color: #1b5e20;
}

.af-pm-notice.af-pm-error {
    background-color: #ffebee;
    border-left: 4px solid #c62828;
    color: #b71c1c;
}

.af-pm-notice.af-pm-warning {
    background-color: #fff8e1;
    border-left: 4px solid #f57f17;
    color: #f57f17;
}

/* Top Forum Unread Alert Banner (MyBB Style) */
.af-pm-alert-banner {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #fff3cd, #ffeeba);
    border: 1px solid #ffeeba;
    border-left: 5px solid #ff9800;
    color: #856404;
    padding: 12px 16px;
    border-radius: 5px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    animation: af-pm-slide-down 0.3s ease-out;
}

@keyframes af-pm-slide-down {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.af-pm-alert-icon {
    font-size: 24px;
    margin-right: 14px;
    color: #e65100;
}

.af-pm-pulse {
    animation: af-pm-heartbeat 2s infinite ease-in-out;
}

@keyframes af-pm-heartbeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.af-pm-alert-content {
    flex: 1;
    font-size: 14px;
}

.af-pm-alert-details {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    color: #66512c;
}

.af-pm-alert-link {
    display: inline-block;
    margin-left: 8px;
    font-weight: 600;
    color: #b75500;
    text-decoration: underline;
}

.af-pm-alert-link:hover {
    color: #8a3f00;
}

.af-pm-alert-close {
    background: transparent;
    border: none;
    font-size: 20px;
    color: #856404;
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
}

/* Two-column Layout */
.af-pm-layout {
    display: flex;
    gap: 24px;
    width: 100%;
    align-items: flex-start;
}

/* Sidebar Navigation */
.af-pm-sidebar {
    width: 220px;
    min-width: 220px;
    max-width: 220px;
    flex-shrink: 0;
}

/* Main Content Box */
.af-pm-main {
    flex: 1 1 auto;
    width: calc(100% - 244px);
    min-width: 0;
}

.af-pm-sidebar-section {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    overflow: hidden;
}

.af-pm-sidebar-header {
    background: #f4f6f8;
    border-bottom: 1px solid #e0e0e0;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #495057;
}

.af-pm-sidebar-header i {
    margin-right: 6px;
    color: #6c757d;
}

.af-pm-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.af-pm-menu li {
    margin: 0;
    padding: 0;
    border-bottom: 1px solid #f0f0f0;
}

.af-pm-menu li:last-child {
    border-bottom: none;
}

.af-pm-menu a {
    display: flex;
    align-items: center;
    padding: 11px 15px;
    color: #495057;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.af-pm-menu a:hover {
    background: #f8f9fa;
    color: #1976d2;
    padding-left: 18px;
}

.af-pm-menu li.active a {
    background: #e3f2fd;
    color: #0d47a1;
    font-weight: 600;
    border-left: 4px solid #1976d2;
}

.af-pm-menu a i {
    width: 20px;
    margin-right: 8px;
    font-size: 14px;
}

.af-pm-badge {
    margin-left: auto;
    background: #d32f2f;
    color: #ffffff;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
}

.af-pm-count {
    margin-left: auto;
    font-size: 12px;
    color: #888888;
}

.af-pm-compose-link {
    color: #2e7d32 !important;
    font-weight: 600 !important;
}

.af-pm-compose-link:hover {
    background: #e8f5e9 !important;
}

/* Quota Meter */
.af-pm-quota-content {
    padding: 14px;
}

.af-pm-progress-bar {
    height: 10px;
    background: #e9ecef;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 8px;
}

.af-pm-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #81c784);
    border-radius: 5px;
    transition: width 0.4s ease;
}

.af-pm-quota-text {
    font-size: 12px;
    color: #6c757d;
    text-align: center;
}

/* Main Content Header */

.af-pm-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}

.af-pm-header-bar h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Buttons */
.af-pm-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    line-height: 1.2;
}

.af-pm-btn-primary {
    background: #1976d2;
    color: #ffffff !important;
}

.af-pm-btn-primary:hover {
    background: #1565c0;
    box-shadow: 0 2px 6px rgba(25, 118, 210, 0.3);
}

.af-pm-btn-secondary {
    background: #f5f5f5;
    border-color: #cccccc;
    color: #444444 !important;
}

.af-pm-btn-secondary:hover {
    background: #e0e0e0;
    color: #222222 !important;
}

.af-pm-btn-danger {
    background: #ffebee;
    border-color: #ef9a9a;
    color: #c62828 !important;
}

.af-pm-btn-danger:hover {
    background: #c62828;
    color: #ffffff !important;
}

/* Tables (Classic MyBB Forum Table) */
.af-pm-table-responsive {
    overflow-x: auto;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.af-pm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.af-pm-table th {
    background: #f4f6f8;
    color: #495057;
    font-weight: 700;
    padding: 12px 14px;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
}

.af-pm-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #eeeeee;
    vertical-align: middle;
}

.af-pm-table tr:hover td {
    background-color: #f9fbfd;
}

.af-pm-table tr.af-pm-unread td {
    background-color: #f0f7ff;
    font-weight: 600;
}

.af-pm-col-cb { width: 35px; text-align: center; }
.af-pm-col-status { width: 35px; text-align: center; font-size: 16px; }
.af-pm-col-subject { min-width: 200px; }
.af-pm-col-sender { width: 180px; }
.af-pm-col-date { width: 160px; }
.af-pm-col-actions { width: 45px; text-align: center; }

.af-pm-icon-unread { color: #d32f2f; }
.af-pm-icon-read { color: #9e9e9e; }

.af-pm-subject-link {
    color: #1976d2;
    text-decoration: none;
    font-size: 14px;
}

.af-pm-subject-link:hover {
    text-decoration: underline;
    color: #0d47a1;
}

.af-pm-user-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.af-pm-user-cell img {
    border-radius: 50%;
    width: 24px;
    height: 24px;
}

.af-pm-date {
    display: block;
    color: #333333;
    font-size: 13px;
}

.af-pm-datetime {
    display: block;
    color: #888888;
    font-size: 11px;
}

.af-pm-delete-btn {
    color: #9e9e9e;
    font-size: 15px;
    text-decoration: none;
    padding: 4px 6px;
    border-radius: 3px;
    transition: all 0.15s;
}

.af-pm-delete-btn:hover {
    color: #d32f2f;
    background: #ffebee;
}

.af-pm-empty {
    text-align: center;
    padding: 40px 20px !important;
    color: #888888;
}

.af-pm-empty-icon {
    font-size: 40px;
    color: #cccccc;
    margin-bottom: 10px;
    display: block;
}

.af-pm-table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    padding: 0 4px;
}

.af-pm-pagination {
    display: flex;
    gap: 4px;
}

.af-pm-pagination a {
    padding: 5px 10px;
    border: 1px solid #dddddd;
    background: #ffffff;
    color: #333333;
    text-decoration: none;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
}

.af-pm-pagination a.active,
.af-pm-pagination a:hover {
    background: #1976d2;
    color: #ffffff;
    border-color: #1976d2;
}

/* Single Message View */
.af-pm-view-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.af-pm-view-actions {
    display: flex;
    gap: 8px;
}

.af-pm-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    margin-bottom: 20px;
    overflow: hidden;
}

.af-pm-card-header {
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    padding: 14px 18px;
}

.af-pm-view-subject {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
}

.af-pm-card-meta-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    border-bottom: 1px solid #eeeeee;
    background: #fafafa;
}

.af-pm-meta-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.af-pm-meta-user img {
    border-radius: 50%;
    border: 2px solid #e0e0e0;
}

.af-pm-meta-details {
    font-size: 13px;
    line-height: 1.4;
}

.af-pm-meta-time {
    font-size: 12px;
    color: #777777;
}

.af-pm-card-body {
    padding: 22px 18px;
    font-size: 15px;
    line-height: 1.7;
    color: #222222;
    min-height: 120px;
}

.af-pm-card-body blockquote,
.af-pm-history-content blockquote {
    background: #f4f6f9;
    border-left: 4px solid #1976d2;
    margin: 12px 0;
    padding: 10px 14px;
    border-radius: 0 4px 4px 0;
    color: #495057;
    font-size: 13.5px;
}

/* Quick Reply Box */
.af-pm-quickreply-box {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 18px;
    margin-bottom: 20px;
}

.af-pm-quickreply-box h4 {
    margin: 0 0 12px 0;
    font-size: 15px;
    font-weight: 600;
    color: #333333;
}

/* Thread History */
.af-pm-thread-history {
    margin-top: 24px;
}

.af-pm-thread-history h4 {
    font-size: 16px;
    font-weight: 600;
    color: #333333;
    margin-bottom: 12px;
}

.af-pm-history-item {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 12px;
    overflow: hidden;
}

.af-pm-history-header {
    background: #f8f9fa;
    padding: 8px 14px;
    font-size: 13px;
    border-bottom: 1px solid #eeeeee;
    color: #555555;
}

.af-pm-history-content {
    padding: 14px;
    font-size: 13.5px;
    color: #333333;
}

/* Compose Form */
.af-pm-compose-box {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.af-pm-form-group {
    margin-bottom: 18px;
}

.af-pm-form-group label {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #333333;
}

.af-pm-required {
    color: #d32f2f;
}

.af-pm-input,
.af-pm-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cccccc;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.af-pm-input:focus,
.af-pm-textarea:focus {
    border-color: #1976d2;
    outline: none;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.15);
}

.af-pm-textarea {
    resize: vertical;
}

.af-pm-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Autocomplete Dropdown */
.af-pm-autocomplete-wrap {
    position: relative;
}

.af-pm-suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #cccccc;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    display: none;
    max-height: 220px;
    overflow-y: auto;
}

.af-pm-suggestion-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}

.af-pm-suggestion-item:hover {
    background: #e3f2fd;
}

.af-pm-suggestion-item img {
    border-radius: 50%;
}

/* Formatting Toolbar (MyBB Style) */
.af-pm-toolbar {
    display: flex;
    gap: 4px;
    background: #f4f6f8;
    border: 1px solid #cccccc;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    padding: 6px 8px;
}

.af-pm-toolbar + .af-pm-form-group .af-pm-textarea {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.af-pm-tb-btn {
    background: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 3px;
    padding: 4px 8px;
    font-size: 13px;
    cursor: pointer;
    color: #444444;
    line-height: 1;
    min-width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.af-pm-tb-btn:hover {
    background: #e0e0e0;
    color: #111111;
}

/* Postbit PM Button (In Forum Post Author block) */
.af-pm-postbit-action {
    margin-top: 6px;
}

.af-pm-postbit-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: #f0f4f8;
    border: 1px solid #cfd8dc;
    border-radius: 3px;
    font-size: 11.5px;
    font-weight: 600;
    color: #455a64 !important;
    text-decoration: none;
    transition: all 0.15s;
}

.af-pm-postbit-btn:hover {
    background: #1976d2;
    border-color: #1976d2;
    color: #ffffff !important;
}

.af-pm-postbit-btn i {
    font-size: 10.5px;
}

/* Profile Menu PM Link */
.af-profile-pm-link {
    margin-left: 8px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* Responsive Rules */
@media (max-width: 768px) {
    .af-pm-layout {
        flex-direction: column;
    }
    
    .af-pm-sidebar {
        width: 100%;
    }

    .af-pm-table th.af-pm-col-date,
    .af-pm-table td.af-pm-col-date {
        display: none;
    }
}
