/* public/styleprofile.css */

/* --- 1. ĐỊNH DẠNG CHUNG DÀNH CHO TRANG HỒ SƠ --- */
body { 
    font-family: Arial, sans-serif; 
    margin: 0; 
    padding: 0; 
    background-color: #f4f4f4; 
    color: #333; 
}

.profile-container { 
    max-width: 1000px; 
    margin: 20px auto; 
    padding: 20px; 
    background-color: #fff; 
    border-radius: 8px; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); 
}

header h1 { 
    margin: 0 0 20px 0; 
    font-size: 1.8em; 
    text-align: center; 
    color: blue; 
}

/* --- 2. LAYOUT DẠNG LƯỚI (2 CỘT TỔNG THỂ) --- */
.profile-grid-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

@media (max-width: 768px) {
    .profile-grid-layout { 
        grid-template-columns: 1fr; 
    }
}

.profile-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* --- 3. KHU VỰC FORM VÀ NÚT BẤM --- */
.form-section { 
    background: #fafafa;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.form-section h3 { 
    margin-top: 0; 
    color: #0056b3; 
    font-size: 1.1em; 
    border-bottom: 2px solid #0056b3; 
    padding-bottom: 5px; 
}

.form-group { 
    margin-bottom: 12px; 
}

.form-group:last-child { 
    margin-bottom: 0; 
}

.form-group label { 
    display: block; 
    margin-bottom: 4px; 
    font-weight: bold; 
    font-size: 0.9em; 
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"] {
    width: 100%; 
    padding: 8px 10px; 
    border: 1px solid #ccc;
    border-radius: 4px; 
    box-sizing: border-box;
    background-color: #e9ecef; 
    cursor: default;
}

.back-button { 
    background-color: #6c757d; 
    color: white; 
    padding: 10px 15px; 
    border-radius: 4px; 
    cursor: pointer; 
    border: none; 
    font-size: 1em;
    width: 100%;
}

.back-button:hover { 
    background-color: #5a6268;
}

.btn-manage-listings {
    background-color: #0d6efd;
    color: #fff;
    border: none;
    padding: 15px 20px;
    font-size: 1.1em;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 3px 6px rgba(13, 110, 253, 0.2);
    transition: background-color 0.2s;
}

.btn-manage-listings:hover { 
    background-color: #0b5ed7; 
}

#profile-status { 
    margin-top: 15px; 
    padding: 10px; 
    border-radius: 4px; 
    text-align: center; 
}

.status-error { 
    background-color: #f8d7da; 
    color: #721c24; 
    border: 1px solid #f5c6cb;
}

/* --- 4. CẤU TRÚC MODAL CHUNG --- */
.modal-overlay {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: rgba(0, 0, 0, 0.6); 
    z-index: 10000;
    display: flex; 
    align-items: center; 
    justify-content: center;
}

.modal-content {
    background: #fff; 
    width: 100%; 
    max-width: 750px; 
    max-height: 85vh;
    border-radius: 8px; 
    padding: 5px; 
    display: flex; 
    flex-direction: column;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.modal-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    border-bottom: 1px solid #eee; 
    padding-bottom: 10px; 
}

.modal-header h3 { 
    margin: 0; 
    color: #0056b3; 
}

.modal-close-btn { 
    font-size: 28px; 
    font-weight: bold; 
    cursor: pointer; 
    color: #888; 
}

.modal-close-btn:hover { 
    color: #000; 
}

.modal-body { 
    overflow-y: auto; 
    flex-grow: 1; 
    padding: 10px 0; 
    max-height: 55vh; 
}

.pagination-btn { 
    padding: 6px 12px; 
    border: 1px solid #007bff; 
    background: #fff; 
    color: #007bff; 
    border-radius: 4px; 
    cursor: pointer; 
    font-size: 0.9em; 
}

.pagination-btn.active { 
    background: #007bff; 
    color: #fff; 
    font-weight: bold; 
}

.pagination-btn:disabled { 
    border-color: #ccc; 
    color: #ccc; 
    cursor: not-allowed; 
}

/* --- 5. STYLES DÀNH CHO MODAL CHAT --- */
.chat-modal-content { 
    max-width: 850px !important; 
    height: 80vh !important; 
    padding: 0 !important; 
    overflow: hidden; 
}

.chat-layout { 
    display: flex; 
    height: calc(100% - 50px); 
}

.chat-sidebar { 
    width: 35%; 
    border-right: 1px solid #eee; 
    overflow-y: auto; 
    background: #fdfdfd; 
}

.chat-main { 
    width: 65%; 
    display: flex; 
    flex-direction: column; 
    background: #fff; 
}

.chat-thread-item { 
    display: flex; 
    padding: 10px; 
    gap: 10px; 
    border-bottom: 1px solid #f0f0f0; 
    cursor: pointer; 
}

.chat-thread-item:hover, 
.chat-thread-item.active { 
    background: #e0f2fe; 
}

.chat-thread-item.unread { 
    background: #fffbe3; 
    font-weight: bold; 
}

.chat-main-header { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    padding: 10px; 
    border-bottom: 1px solid #eee; 
    background: #fafafa; 
}

.chat-listing-thumb { 
    width: 40px; 
    height: 40px; 
    border-radius: 4px; 
    object-fit: cover; 
}

.chat-header-text h4 { 
    margin: 0; 
    font-size: 0.9em; 
    color: #333; 
}

.chat-partner-name { 
    font-size: 0.8em; 
    color: #666; 
}

.chat-messages-body { 
    flex: 1; 
    padding: 15px; 
    overflow-y: auto; 
    display: flex; 
    flex-direction: column; 
    gap: 8px; 
    background: #f8fafc; 
}

.chat-placeholder-text { 
    margin: auto; 
    color: #888; 
    font-size: 0.9em; 
    text-align: center; 
}

.chat-bubble { 
    max-width: 70%; 
    padding: 8px 12px; 
    border-radius: 12px; 
    font-size: 0.9em; 
    line-height: 1.4; 
}

.chat-bubble.me { 
    align-self: flex-end; 
    background: #0284c7; 
    color: #fff; 
}

.chat-bubble.partner { 
    align-self: flex-start; 
    background: #e2e8f0; 
    color: #333; 
}

.chat-input-footer { 
    display: flex; 
    border-top: 1px solid #eee; 
}

.chat-input-footer input { 
    flex: 1; 
    padding: 8px 12px; 
    border: 1px solid #ddd; 
    border-radius: 20px; 
    outline: none; 
}

.chat-input-footer button { 
    background: #0284c7; 
    color: #fff; 
    border: none; 
    padding: 8px 15px; 
    border-radius: 20px; 
    cursor: pointer; 
}

.chat-mobile-back-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #0284c7;
    cursor: pointer;
    padding: 5px 10px 5px 0;
}

/* --- 6. HỖ TRỢ HIỆU ỨNG TRƯỢT CHAT MOBILE (< 768px) --- */
@media (max-width: 767px) {
    .chat-layout {
        position: relative;
        overflow: hidden;
    }

    .chat-sidebar {
        width: 100% !important;
    }

    .chat-main {
        position: absolute;
        top: 0;
        left: 0;
        width: 100% !important;
        height: 100%;
        z-index: 10;
        background: #ffffff;
        transform: translateX(100%);
        transition: transform 0.25s ease-in-out;
    }

    .chat-main.mobile-active {
        transform: translateX(0);
    }
    .chat-mobile-back-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}