/* social_nectar/css/style.css (Complete Revamp) */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@400;500;700&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css');


:root {
    --primary-color: #3B82F6; /* Blue 500 */
    --primary-hover: #2563EB; /* Blue 600 */
    --success-color: #10B981; /* Emerald 500 */
    --danger-color: #EF4444; /* Red 500 */
    --background-color: #F3F4F6; /* Gray 100 */
    --card-background: #FFFFFF;
    --text-dark: #111827; /* Gray 900 */
    --text-light: #6B7280; /* Gray 500 */
    --border-color: #E5E7EB; /* Gray 200 */
    --like-color: #EF4444; /* Red 500 */
    --font-family: 'Sarabun', sans-serif;
}

body {
    font-family: var(--font-family);
    margin: 0;
    background-color: var(--background-color);
    color: var(--text-dark);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container, .profile-page-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 16px;
}
.profile-page-container {
    max-width: 900px;
    padding: 0; /* Remove padding for full-width header */
}

/* Header */
.header {
    background-color: var(--card-background);
    padding: 12px 24px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.header h1 {
    margin: 0;
    font-size: 1.25em;
    font-weight: 700;
    color: var(--primary-color);
}
.header nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 20px;
}
.header nav a {
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
    position: relative;
    font-size: 0.95em;
}
.header nav a:hover {
    color: var(--primary-color);
}

/* --- NOTIFICATION STYLES --- */
.notification-item {
    position: relative;
    /* ตรวจสอบให้แน่ใจว่าไม่มี pointer-events: none; ที่นี่ */
}
.notification-item > a {
    position: relative;
    display: block;
    padding: 8px;
    font-size: 1.25em; /* Make icon larger */
    /* ตรวจสอบให้แน่ใจว่าไม่มี pointer-events: none; ที่นี่ */
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: -2px;
    background-color: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.75em;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--card-background);
}

.notification-dropdown {
    display: none; /* Hidden by default */
    position: absolute;
    top: 150%; 
    right: 0;
    width: 360px;
    background-color: var(--card-background);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    border: 1px solid var(--border-color);
    z-index: 1010; /* ให้แสดงทับองค์ประกอบอื่น */
    overflow: hidden;
    /* ตรวจสอบให้แน่ใจว่าไม่มี pointer-events: none; ที่นี่ */
}

.notification-dropdown.show {
    display: block; /* แสดงด้วย Javascript */
}

.notification-body {
    max-height: 400px;
    overflow-y: auto;
}

.notification-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-dark);
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}
.notification-list-item:last-child {
    border-bottom: none;
}

.notification-list-item:hover {
    background-color: #F9FAFB;
}

.notification-list-item.unread {
    background-color: #EFF6FF; /* Light blue for unread items */
}

.notification-list-item .profile-picture-small {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.notification-time {
    font-size: 0.8em;
    color: var(--primary-color);
    margin-top: 4px;
}


/* Card Styles */
.card {
    background-color: var(--card-background);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
    overflow: hidden;
}
.card-content { padding: 24px; }
.card-header {
    font-size: 1.1em;
    font-weight: 700;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    background-color: #F9FAFB;
    margin: 0;
}

/* Form & Button Styles */
.form-group { margin-bottom: 16px; position: relative; }
.form-group label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 0.9em; color: var(--text-dark); }
.form-group textarea, .form-group input[type="text"], .form-group input[type="password"], .form-group input[type="file"] {
    width: 100%; padding: 12px; border: 1px solid var(--border-color); border-radius: 8px; font-size: 1em; font-family: var(--font-family); box-sizing: border-box; transition: all 0.2s ease;
}
.form-group textarea:focus, .form-group input:focus {
    outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}
.btn {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 700;
    transition: background-color 0.2s ease, transform 0.1s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn:hover { background-color: var(--primary-hover); }
.btn:active { transform: scale(0.98); }
.btn.btn-sm {
    padding: 6px 12px;
    font-size: 0.85em;
    font-weight: 500;
}
.btn.btn-secondary { background-color: #D1D5DB; color: var(--text-dark); }
.btn.btn-secondary:hover { background-color: #9CA3AF; }
.btn.btn-success { background-color: var(--success-color); }
.btn.btn-danger { background-color: var(--danger-color); }


/* Profile Page Specific Styles */
.profile-header-card {
    background-color: var(--card-background);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin: 24px;
    overflow: hidden;
}
.profile-header-bg {
    height: 280px;
    background-size: cover;
    background-position: center;
    background-color: var(--primary-color);
}
.profile-header-content {
    position: relative;
    padding: 0 32px 24px 32px;
}
.profile-header-picture {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 5px solid var(--card-background);
    margin-top: -70px; /* Pulls it up over the background */
    object-fit: cover;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
}
.profile-header-info {
    padding-top: 16px; 
}
.profile-display-name {
    font-size: 2em;
    font-weight: 700;
    margin: 0;
}
.profile-username {
    font-size: 1em;
    color: var(--text-light);
    margin: 0 0 8px 0;
}
.profile-phone {
    font-size: 0.9em;
    color: var(--text-light);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}
.profile-about {
    padding: 0 32px 24px 32px;
    color: var(--text-dark);
    line-height: 1.6;
}
.profile-body-container {
    padding: 0 24px 24px 24px;
}
.content-title {
    font-size: 1.25em;
    font-weight: 700;
    margin-bottom: 16px;
    padding-left: 8px;
    border-left: 4px solid var(--primary-color);
}

/* Post Styles */
.post { padding: 0; }
.post-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 24px 16px 24px;
    position: relative;
}
.post-header .profile-picture {
    width: 48px; height: 48px; border: none;
}
.post-content { padding: 0 24px 16px 24px; }
.post-content p { margin: 0; line-height: 1.7; font-size: 1em; color: #374151; }
.post-image { max-width: 100%; border-radius: 12px; margin-top: 16px; border: 1px solid var(--border-color); }
.post-actions { padding: 8px 16px; display: flex; gap: 8px; border-top: 1px solid var(--border-color); }
.btn-like {
    background: none; border: none; color: var(--text-light); padding: 8px 12px; border-radius: 8px; cursor: pointer; transition: all 0.2s ease; font-family: var(--font-family); font-size: 0.9em; font-weight: 500; display: flex; align-items: center; gap: 6px;
}
.btn-like:hover { background-color: #F3F4F6; }
.btn-like.liked { color: var(--like-color); font-weight: 700; }
.btn-like.liked:hover { background-color: #FEE2E2; }
.btn-like i { font-size: 1.2em; }

/* Comment Section - Revamped */
.comments-section { padding: 16px 24px; background-color: #F9FAFB; border-top: 1px solid var(--border-color); }
.comment { display: flex; gap: 12px; margin-bottom: 16px; }
.comment .profile-picture { width: 36px; height: 36px; border: none; }
.comment-body { background-color: #E5E7EB; padding: 10px 14px; border-radius: 18px; flex-grow: 1; line-height: 1.5; position: relative; }
.comment-author { font-weight: 700; font-size: 0.9em; color: var(--text-dark); }
.comment-text { font-size: 0.95em; color: #374151; }

/* Revamped Comment Form */
.comment-form { display: flex; gap: 12px; align-items: flex-start; }
.comment-form .profile-picture { width: 36px; height: 36px; flex-shrink: 0; }
.comment-form-input-wrapper { flex-grow: 1; position: relative; }
.comment-form textarea {
    width: 100%; padding: 10px 40px 10px 16px; /* Make space for emoji button */
    border: 1px solid var(--border-color); border-radius: 20px; font-size: 0.95em; font-family: var(--font-family); box-sizing: border-box; resize: none; overflow: hidden; line-height: 1.5; background-color: white; min-height: 42px;
}
.comment-form textarea:focus { background-color: white; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3); }
.comment-form .btn { display: none; } /* Hide submit button */

/* Footer Styles */
.footer {
    text-align: center;
    padding: 24px;
    margin-top: 32px;
    color: var(--text-light);
    font-size: 0.9em;
}

/* Message Styles */
.message { padding: 16px; margin-bottom: 24px; border-radius: 8px; font-weight: 500; border: 1px solid transparent; }
.message.success { background-color: #D1FAE5; color: #065F46; border-color: #A7F3D0; }
.message.error { background-color: #FEE2E2; color: #991B1B; border-color: #FECACA; }

/* --- NEW STYLES FOR FRIENDS PAGE --- */
.search-form { display: flex; gap: 8px; }
.search-form input { flex-grow: 1; }
.search-form .btn { padding: 10px 14px; }
.search-results, .list-container { padding: 0; }
.search-results { border-top: 1px solid var(--border-color); margin-top: 24px; padding-top: 0; }
.user-list-item { display: flex; align-items: center; gap: 16px; padding: 16px 24px; border-bottom: 1px solid var(--border-color); transition: background-color 0.2s ease; }
.user-list-item:last-child { border-bottom: none; }
.user-list-item:hover { background-color: #F9FAFB; }
.user-info-link { display: flex; align-items: center; gap: 16px; text-decoration: none; flex-grow: 1; }
.profile-picture-small { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.user-display-name { font-weight: 700; color: var(--text-dark); display: block; }
.user-username { font-size: 0.9em; color: var(--text-light); }
.user-actions { margin-left: auto; flex-shrink: 0; display: flex; gap: 8px; }
.no-results { color: var(--text-light); text-align: center; padding: 24px 0; }

/* --- UI IMPROVEMENTS --- */

/* Post Action Dropdown */
.post-header-actions { margin-left: auto; position: relative; }
.action-btn { background: none; border: none; color: var(--text-light); font-size: 1.25em; cursor: pointer; padding: 4px 8px; border-radius: 50%; transition: all 0.2s ease; }
.action-btn:hover { background-color: #F3F4F6; color: var(--text-dark); }
.action-dropdown { display: none; position: absolute; right: 0; top: 100%; background-color: var(--card-background); border: 1px solid var(--border-color); border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); z-index: 10; width: 150px; overflow: hidden; padding: 4px; }
.action-dropdown.show { display: block; }
.action-dropdown form { margin: 0; }
.action-dropdown button { background: none; border: none; width: 100%; text-align: left; padding: 10px 12px; font-size: 0.9em; cursor: pointer; display: flex; align-items: center; gap: 8px; border-radius: 6px; font-family: var(--font-family); color: var(--text-dark); }
.action-dropdown button:hover { background-color: #F3F4FB; }
.action-dropdown button.delete { color: var(--danger-color); }
.action-dropdown button.delete:hover { background-color: #FEE2E2; }

/* Comment Actions & Reply Button */
.comment-actions { margin-top: 4px; }
/* FIX: Changed .btn-reply to .reply-button to match main.js and comment_template.php */
.reply-button { background: none; border: none; color: var(--text-light); font-weight: 700; font-size: 0.8em; cursor: pointer; padding: 4px 0; }
.reply-button:hover { text-decoration: underline; color: var(--primary-color); }

/* --- MODAL STYLES --- */
.modal { display: none; position: fixed; z-index: 1001; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.6); padding-top: 60px; }
.modal-content { max-width: 600px; margin: 24px auto; background-color: var(--card-background); border-radius: 12px; border: 1px solid var(--border-color); overflow: hidden; box-shadow: 0 10px 25px rgba(0,0,0,0.1); }
.modal-content .card-header { display: flex; justify-content: space-between; align-items: center; }
.close { color: var(--text-light); font-size: 24px; font-weight: bold; cursor: pointer; transition: color 0.2s ease; }
.close:hover, .close:focus { color: var(--text-dark); }

/* --- REPLY & EMOJI STYLES --- */
.comment-reply-info { font-size: 0.85em; color: var(--text-light); margin-bottom: 6px; }
.comment-reply-info a { color: var(--primary-color); font-weight: 700; text-decoration: none; }
.comment-reply-info a:hover { text-decoration: underline; }
.comment-replies { margin-left: 20px; padding-left: 20px; border-left: 2px solid var(--border-color); margin-top: 16px; }

.btn-emoji {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.25em;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.btn-emoji:hover {
    background-color: #F3F4F6;
    color: var(--primary-color);
}
.emoji-picker-container {
    position: absolute;
    z-index: 1020;
    right: 0;
    bottom: 100%;
    margin-bottom: 8px;
}
/* ใน css/style.css หรือ mobile-style.css */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    gap: 5px;
}

.pagination a {
    padding: 8px 12px;
    border: 1px solid #ddd;
    text-decoration: none;
    color: #333;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.pagination a.active,
.pagination a:hover {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

/* ใน social_nectar/css/style.css หรือ mobile-style.css */

/* ใน social_nectar/css/style.css หรือ mobile-style.css */

.post-options-container {
    position: relative;
    display: inline-block;
    margin-left: auto; /* จัดให้ไปอยู่ทางขวา */
}

/* FIX: Changed .post-options-btn to .post-options-toggle to match JS */
.post-options-toggle { 
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    padding: 5px;
    color: #666; /* สีไอคอน */
    transition: color 0.2s ease-in-out;
}

.post-options-toggle:hover {
    color: #007bff; /* เปลี่ยนสีเมื่อโฮเวอร์ */
}

.post-options-dropdown {
    display: none;
    position: absolute;
    background-color: #fff;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 100; /* ให้แสดงทับองค์ประกอบอื่น */
    right: 0; /* จัดให้อยู่ทางขวาของปุ่ม */
    border-radius: 8px;
    overflow: hidden; /* เพื่อให้ border-radius ทำงานกับลิงก์ด้านใน */
    border: 1px solid #ddd;
}

.post-options-dropdown a,
.post-options-dropdown button {
    color: #333;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
    font-family: var(--font-family); /* Ensure font consistency */
}

.post-options-dropdown a:hover,
.post-options-dropdown button:hover {
    background-color: #f0f0f0;
    color: #007bff;
}

/* FIX: Changed .delete-post-btn to .delete-post-button to match JS */
.post-options-dropdown button.delete-post-button { 
    color: #dc3545; /* สีแดงสำหรับปุ่มลบ */
}

.post-options-dropdown button.delete-post-button:hover {
    background-color: #ffebeb; /* สีพื้นหลังเมื่อโฮเวอร์สำหรับลบ */
    color: #dc3545;
}

.post-options-dropdown.show {
    display: block;
}

.btn-share-telegram {
    background-color: #0088cc; /* Telegram blue */
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9em;
    transition: background-color 0.3s ease;
}

.btn-share-telegram:hover {
    background-color: #006699;
}
