/**
 * Classifieds Messaging System - Styles
 */

/* ===== General Styles ===== */
.cms-loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.cms-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    margin: 10px 0;
}

.cms-no-messages {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-style: italic;
}

.cms-login-required {
    text-align: center;
    padding: 40px 20px;
}

.cms-login-required .button {
    display: inline-block;
    margin-top: 15px;
    padding: 10px 20px;
    background: #0073aa;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
}

/* ===== Messages Page Layout ===== */
.cms-messages-page {
    display: flex;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    height: calc(100vh - 40px);
    min-height: 600px;
    overflow: hidden;
}

.cms-conversations-sidebar {
    flex: 0 0 350px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

.cms-conversations-header {
    padding: 20px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
}

.cms-conversations-header h3 {
    margin: 0 0 15px 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.cms-search-wrapper {
    position: relative;
    margin-bottom: 15px;
}

.cms-search-box {
    width: 100%;
    padding: 12px 45px 12px 40px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 14px;
    background: #f8f9fa;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    color: #333;
}

.cms-search-box::placeholder {
    color: #999;
    font-weight: 400;
}

.cms-search-box:focus {
    outline: none;
    border-color: #2196f3;
    background: #fff;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.15), 0 0 0 4px rgba(33, 150, 243, 0.1);
    transform: translateY(-1px);
}

.cms-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.cms-search-wrapper:focus-within .cms-search-icon {
    color: #2196f3;
}

.cms-search-icon svg {
    width: 18px;
    height: 18px;
}

.cms-tabs {
    display: flex;
    gap: 8px;
    margin-top: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.cms-tab {
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
    margin-bottom: -2px;
    position: relative;
}

.cms-tab:hover {
    color: #2196f3;
}

.cms-tab.active {
    color: #2196f3;
    border-bottom-color: #2196f3;
    font-weight: 600;
}

.cms-conversations-list {
    max-height: 500px;
    overflow-y: auto;
}

.cms-conversation-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.cms-conversation-item:hover {
    background: #f8f9fa;
}

.cms-conversation-item.active {
    background: #e3f2fd;
    border-left: 3px solid #2196f3;
}

.cms-conversation-item.unread {
    background: #fff8e1;
    font-weight: bold;
}

.cms-conversation-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-right: 15px;
    background: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    flex-shrink: 0;
}

.cms-conversation-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cms-conversation-name-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 2px;
}

.cms-conversation-name {
    font-weight: 600;
    font-size: 15px;
    color: #333;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cms-conversation-listing {
    font-size: 13px;
    color: #666;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cms-conversation-preview {
    font-size: 13px;
    color: #999;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.cms-conversation-meta {
    text-align: right;
    flex-shrink: 0;
    margin-left: 10px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.cms-conversation-date {
    font-size: 11px;
    color: #999;
    white-space: nowrap;
}

.cms-unread-badge {
    background: #e74c3c;
    color: #fff;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    display: inline-block;
}

/* ===== Conversation View ===== */
.cms-conversation-view {
    flex: 1;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    height: 100%;
}

.cms-conversation-view-header {
    padding: 8px 12px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.cms-conversation-view-header-content {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.cms-conversation-view-header h3,
.cms-conversation-name {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

/* Modern Listing Card */
.cms-listing-card {
    display: flex;
    gap: 10px;
    padding: 8px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    margin-top: 8px;
}

.cms-listing-thumbnail {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cms-listing-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cms-listing-card-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    justify-content: center;
}

.cms-listing-title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}

.cms-message-preview {
    font-size: 11px;
    color: #666;
    margin: 0;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.cms-listing-time {
    font-size: 10px;
    color: #999;
    margin-top: 1px;
}

.cms-conversation-view-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.cms-conversation-view-header-content {
    flex: 1;
    min-width: 0;
}

.cms-conversation-view-search-wrapper {
    position: relative;
    margin-top: 10px;
}

.cms-conversation-view-search-box {
    width: 100%;
    padding: 10px 40px 10px 38px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 13px;
    background: #fff;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    color: #333;
}

.cms-conversation-view-search-box::placeholder {
    color: #999;
}

.cms-conversation-view-search-box:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.15), 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.cms-conversation-view-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.cms-conversation-view-search-wrapper:focus-within .cms-conversation-view-search-icon {
    color: #2196f3;
}

.cms-conversation-view-search-icon svg {
    width: 16px;
    height: 16px;
}

.cms-conversation-view-tabs {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0;
}

.cms-conversation-view-tab {
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
    margin-bottom: -2px;
    position: relative;
}

.cms-conversation-view-tab:hover {
    color: #2196f3;
}

.cms-conversation-view-tab.active {
    color: #2196f3;
    border-bottom-color: #2196f3;
    font-weight: 600;
}

.cms-conversation-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #fafafa;
    position: relative;
    min-height: 0;
    height: 0;
    -webkit-overflow-scrolling: touch;
}

/* Floating Search Button */
.cms-floating-search-btn {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 56px;
    height: 56px;
    background: #2196f3;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cms-floating-search-btn:hover {
    background: #1976d2;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(33, 150, 243, 0.5);
}

.cms-floating-search-btn svg {
    width: 24px;
    height: 24px;
}

/* Modern Search Overlay - Redesigned */
.cms-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
    animation: fadeIn 0.25s ease;
    overflow-y: auto;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.cms-search-overlay-content {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 700px;
    max-height: calc(100vh - 80px);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: auto;
    margin-bottom: auto;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.cms-search-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    border-bottom: 1px solid #f0f0f0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.cms-search-header h4 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cms-search-header h4::before {
    content: '';
    width: 24px;
    height: 24px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><path d="m21 21-4.35-4.35"></path></svg>') no-repeat center;
    background-size: contain;
}

.cms-search-close {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.cms-search-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.cms-search-input-wrapper {
    position: relative;
    padding: 24px 28px;
    background: #fafbfc;
}

.cms-search-input {
    width: 100%;
    padding: 16px 20px 16px 56px;
    border: 2px solid #e1e8ed;
    border-radius: 14px;
    font-size: 16px;
    background: #fff;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    color: #333;
    font-weight: 400;
}

.cms-search-input::placeholder {
    color: #999;
}

.cms-search-input:focus {
    outline: none;
    border-color: #667eea;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.cms-search-icon {
    position: absolute;
    left: 44px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
    transition: all 0.3s ease;
    width: 20px;
    height: 20px;
}

.cms-search-input-wrapper:focus-within .cms-search-icon {
    color: #667eea;
    transform: translateY(-50%) scale(1.1);
}

.cms-search-results {
    flex: 1;
    overflow-y: auto;
    padding: 0 28px 28px;
    max-height: calc(80vh - 200px);
}

.cms-search-results-count {
    font-size: 14px;
    color: #667eea;
    margin: 0 0 16px;
    padding: 12px 16px;
    background: #f0f4ff;
    border-radius: 8px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cms-search-results-count::before {
    content: '🔍';
    font-size: 16px;
}

.cms-search-result-item {
    padding: 16px;
    margin-bottom: 12px;
    background: #fff;
    border: 1px solid #e1e8ed;
    border-radius: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.cms-search-result-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.cms-search-result-item .cms-message-author {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    margin-bottom: 6px;
}

.cms-search-result-item .cms-message-content {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 8px;
}

.cms-search-result-item .cms-message-date {
    font-size: 12px;
    color: #999;
}

.cms-search-highlight {
    background: #fff3cd;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
    color: #856404;
}

.cms-search-no-results {
    padding: 40px 20px;
    text-align: center;
    color: #999;
}

.cms-search-no-results svg {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    opacity: 0.5;
}

.cms-message.cms-search-highlight {
    background: rgba(33, 150, 243, 0.05);
    border-left: 3px solid #2196f3;
    padding-left: 8px;
}

.cms-message {
    margin-bottom: 20px;
    max-width: 70%;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.cms-message-sent {
    margin-left: auto;
}

.cms-message-received {
    margin-right: auto;
}

.cms-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    font-size: 12px;
    gap: 8px;
}

.cms-message-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.cms-message:hover .cms-message-actions {
    opacity: 1;
}

/* Attach File Button - Make sure it's always visible */
.cms-message-input-wrapper .cms-message-actions {
    opacity: 1 !important;
    display: flex !important;
}

.cms-mark-spam-btn {
    background: transparent;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.cms-mark-spam-btn:hover {
    background: #f0f0f0;
    color: #f44336;
}

.cms-message-author {
    font-weight: 600;
    color: #333;
}

.cms-message-date {
    color: #999;
}

.cms-message-content {
    padding: 12px 16px;
    border-radius: 8px;
    line-height: 1.5;
    word-wrap: break-word;
}

.cms-message-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 8px;
    display: block;
}

.cms-message-sent .cms-message-content {
    background: #2196f3;
    color: #fff;
    border-bottom-right-radius: 2px;
}

.cms-message-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 8px;
    display: block;
}

.cms-message-received .cms-message-content {
    background: #fff;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 2px;
}

/* ===== Reply Form ===== */
.cms-reply-form-container {
    padding: 15px 20px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
}

.cms-message-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cms-message-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    padding: 8px 12px;
    transition: all 0.3s ease;
}

.cms-message-input-wrapper:focus-within {
    border-color: #2196f3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
    background: #fff;
}

.cms-message-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cms-attach-file-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: #666 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    border: none !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
    opacity: 1 !important;
    visibility: visible !important;
    position: relative !important;
    z-index: 1 !important;
}

.cms-attach-file-btn svg {
    width: 20px !important;
    height: 20px !important;
    display: block !important;
    flex-shrink: 0 !important;
    stroke: currentColor !important;
    fill: none !important;
}

.cms-attach-file-btn:hover {
    background: #e0e0e0 !important;
    color: #2196f3 !important;
    transform: scale(1.1) !important;
}

.cms-message-textarea {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: transparent;
    border-radius: 0;
    resize: none;
    min-height: 24px;
    max-height: 120px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    overflow-y: auto;
    box-sizing: border-box;
}

.cms-message-textarea:focus {
    outline: none;
}

.cms-message-textarea::placeholder {
    color: #999;
}

.cms-send-message-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #2196f3;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
    box-shadow: none;
}

.cms-send-message-btn:hover {
    background: #1976d2;
    transform: scale(1.05);
}

.cms-send-message-btn:active {
    transform: scale(0.95);
}

.cms-send-message-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.cms-send-message-btn svg {
    width: 18px;
    height: 18px;
}

/* Plane icon animation */
.cms-send-message-btn:hover svg {
    transform: translateX(2px) translateY(-2px);
    transition: transform 0.2s ease;
}

.cms-attachment-preview {
    display: none;
    margin-top: 8px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.cms-attachment-preview.has-attachment {
    display: block;
}

.cms-attachment-preview-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: #fff;
    border-radius: 6px;
    margin-bottom: 8px;
}

.cms-attachment-preview-item:last-child {
    margin-bottom: 0;
}

.cms-attachment-preview-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
}

.cms-attachment-preview-file-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    border-radius: 6px;
    color: #666;
    flex-shrink: 0;
}

.cms-attachment-preview-file-icon svg {
    width: 32px;
    height: 32px;
}

.cms-attachment-preview-info {
    flex: 1;
    font-size: 12px;
    color: #666;
}

.cms-attachment-preview-remove {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f44336;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    transition: all 0.2s ease;
}

.cms-attachment-preview-remove:hover {
    background: #d32f2f;
    transform: scale(1.1);
}

/* ===== Contact Seller Button ===== */
.cms-contact-seller-btn {
    display: inline-block;
    padding: 12px 24px;
    background: #0073aa;
    color: #fff;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.cms-contact-seller-btn:hover {
    background: #005a87;
    color: #fff;
}

/* ===== Unread Count Badge ===== */
.cms-unread-count {
    display: inline-block;
    padding: 4px 8px;
    background: #e74c3c;
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    line-height: 1;
    min-width: 20px;
    text-align: center;
}

/* ===== Modal ===== */
.cms-message-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
}

.cms-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.cms-modal-content {
    position: relative;
    max-width: 500px;
    margin: 100px auto;
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.cms-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.cms-modal-close:hover {
    color: #333;
}

.cms-modal-content h3 {
    margin: 0 0 20px 0;
}

.cms-modal-content .cms-message-form {
    flex-direction: column;
}

.cms-modal-content .cms-send-message-btn {
    align-self: stretch;
}

/* ===== Notices ===== */
.cms-notice {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 10000;
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.cms-notice-success {
    background: #4caf50;
    color: #fff;
}

.cms-notice-error {
    background: #f44336;
    color: #fff;
}

/* ===== Mobile Back Button ===== */
.cms-mobile-back-btn {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 12px 16px;
    z-index: 1001;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cms-mobile-back-btn.active {
    display: flex;
}

.cms-mobile-back-btn button {
    background: none;
    border: none;
    font-size: 24px;
    color: #2196f3;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.cms-mobile-back-btn button:hover {
    background: #f0f0f0;
}

.cms-mobile-back-btn .cms-back-title {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
    body.cms-conversation-open {
        overflow: hidden;
    }
    
    .cms-messages-page {
        position: relative;
        padding: 0;
        min-height: 100vh;
        overflow: hidden;
    }
    
    .cms-conversations-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        z-index: 100;
        background: #fff;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
    }
    
    .cms-conversations-sidebar.hidden {
        transform: translateX(-100%);
        pointer-events: none;
    }
    
    .cms-conversation-view {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        z-index: 101;
        background: #fff;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex;
        flex-direction: column;
    }
    
    .cms-conversation-view.active {
        transform: translateX(0);
    }
    
    .cms-mobile-back-btn {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1002;
    }
    
    .cms-conversation-view-header {
        padding: 8px 12px;
        padding-top: 60px !important;
    }
    
    .cms-conversation-messages {
        padding: 12px;
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
    }
    
    .cms-floating-search-btn {
        bottom: 80px;
        right: 20px;
        width: 48px;
        height: 48px;
        z-index: 1003;
    }
}

@media (max-width: 768px) {
    .cms-messages-page {
        flex-direction: column;
        padding: 0;
    }
    
    .cms-conversations-sidebar {
        flex: 0 0 auto;
        width: 100%;
    }
    
    .cms-conversation-view {
        width: 100%;
    }
    
    .cms-message {
        max-width: 85%;
    }
    
    .cms-tabs {
        gap: 4px;
    }
    
    .cms-tab {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .cms-message-input-wrapper {
        padding: 6px 10px;
    }
    
    .cms-attach-file-btn,
    .cms-send-message-btn {
        width: 32px;
        height: 32px;
    }
    
    .cms-attach-file-btn svg,
    .cms-send-message-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .cms-conversation-view-header {
        padding-top: 60px;
    }
}
