/* 💌 Messages Page — WhatsApp-like layout with Lovculator theme */

        body.messages-page {
            min-height: 100vh;
            margin: 0;
            background: linear-gradient(135deg, #fff5f7 0%, #f8f9fa 100%);
        }

        /* MAIN WRAPPER */
        .messages-container {
            max-width: 1100px;
            margin: 80px auto 20px;
            height: calc(100vh - 110px); /* header + padding */
            background: #f0f2f5;
            border-radius: 16px;
            box-shadow: 0 10px 40px rgba(0,0,0,0.12);
            display: flex;
            overflow: hidden;
            position: relative;
        }

        /* SIDEBAR (LEFT, LIKE WHATSAPP) */
        .conversations-sidebar {
            width: 32%;
            min-width: 300px;
            background: #ffffff;
            border-right: 1px solid #e0e0e0;
            display: flex;
            flex-direction: column;
        }

        .conversations-header {
            padding: 14px 16px;
            background: #ededed;
            border-bottom: 1px solid #d1d1d1;
        }

        .conversations-header h1 {
            margin: 0 0 10px 0;
            font-size: 20px;
            font-weight: 700;
            color: #333;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .conversations-header h1::before {
            content: "💌";
            font-size: 18px;
        }

        .search-container {
            position: relative;
        }

        .search-input {
            width: 100%;
            padding: 8px 32px 8px 10px;
            border-radius: 18px;
            border: none;
            background: #f0f2f5;
            font-size: 13px;
            outline: none;
        }

        .search-input:focus {
            box-shadow: 0 0 0 2px rgba(255, 75, 141, 0.2);
        }

        .search-icon {
            position: absolute;
            right: 10px;
            top: 50%;
            transform: translateY(-50%);
            font-size: 14px;
            color: #888;
        }

        .conversations-list {
            flex: 1;
            overflow-y: auto;
            padding: 0;
            background: #ffffff;
        }

        /* Single conversation row */
        .conversation-item {
            display: flex;
            align-items: center;
            padding: 10px 14px;
            cursor: pointer;
            transition: background 0.15s ease;
            border-bottom: 1px solid #f5f5f5;
        }

        .conversation-item:hover {
            background: #f5f5f5;
        }

        .conversation-item.active {
            background: #ffeef5;
            border-left: 4px solid #ff4b8d;
        }

        .conversation-item.unread {
            background: #f0f7ff;
        }

        .conversation-avatar {
            width: 44px;
            height: 44px;
            border-radius: 50%;
            margin-right: 10px;
            object-fit: cover;
        }

        .conversation-info {
            flex: 1;
            min-width: 0;
        }

        .conversation-header-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 4px;
        }

        .conversation-name {
            font-size: 14px;
            font-weight: 600;
            color: #222;
            margin: 0;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .conversation-time {
            font-size: 11px;
            color: #999;
            margin-left: 8px;
            flex-shrink: 0;
        }

        .conversation-preview {
            margin: 0;
            font-size: 13px;
            color: #555;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .conversation-meta {
            margin-top: 4px;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .unread-badge {
            background: linear-gradient(135deg, #ff4b8d, #ff6b9d);
            color: #fff;
            border-radius: 10px;
            padding: 2px 7px;
            font-size: 11px;
            font-weight: 700;
            min-width: 18px;
            text-align: center;
        }

        .online-indicator {
            width: 8px;
            height: 8px;
            background: #4CAF50;
            border-radius: 50%;
            border: 2px solid #fff;
        }

        /* RIGHT CHAT AREA (LIKE WHATSAPP) */
        .messages-main {
            flex: 1;
            display: flex;
            flex-direction: column;
            background: #e5ddd5;
            position: relative;
        }

        /* Fixed chat header */
        .messages-header {
            padding: 10px 14px;
            background: #ededed;
            border-bottom: 1px solid #d1d1d1;
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-shrink: 0;
        }

        .current-chat-info {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .current-chat-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            object-fit: cover;
        }

        .chat-user-info h3 {
            margin: 0 0 3px 0;
            font-size: 15px;
            font-weight: 600;
            color: #222;
        }

        .chat-user-status {
            font-size: 12px;
            color: #555;
            display: flex;
            align-items: center;
            gap: 5px;
        }

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

        .chat-action-btn {
            background: none;
            border: none;
            cursor: pointer;
            font-size: 16px;
            padding: 6px;
            border-radius: 50%;
            transition: background 0.15s ease, transform 0.1s ease;
        }

        .chat-action-btn:hover {
            background: rgba(0,0,0,0.06);
            transform: scale(1.02);
        }

        /* Back button (mobile only) */
        .back-btn {
            display: none;
            background: none;
            border: none;
            font-size: 20px;
            padding: 6px;
            border-radius: 50%;
            cursor: pointer;
        }

        /* MESSAGE LIST */
        .messages-list {
            flex: 1;
            overflow-y: auto;
            padding: 16px 24px;
            background:
                radial-gradient(circle at 20% 20%, rgba(255, 75, 141, 0.07) 0, transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(255, 75, 141, 0.05) 0, transparent 50%),
                #e5ddd5;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .message-date-divider {
            text-align: center;
            margin: 10px 0;
        }

        .date-label {
            display: inline-block;
            padding: 4px 10px;
            font-size: 11px;
            color: #555;
            background: rgba(255,255,255,0.9);
            border-radius: 10px;
        }

        .message {
            display: flex;
            animation: messageSlideIn 0.2s ease;
        }

        .own-message {
            justify-content: flex-end;
        }

        .other-message {
            justify-content: flex-start;
        }

        .message-bubble {
            max-width: 70%;
            padding: 8px 10px;
            border-radius: 8px;
            position: relative;
            font-size: 14px;
            line-height: 1.4;
        }

        .own-message .message-bubble {
            background: #ff4b8d;
            color: #fff;
            border-bottom-right-radius: 2px;
        }

        .other-message .message-bubble {
            background: #ffffff;
            color: #111;
            border-bottom-left-radius: 2px;
        }

        .message-text {
            margin: 0 0 4px 0;
        }

        .message-meta {
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 6px;
        }

        .message-time {
            font-size: 11px;
            opacity: 0.8;
        }

        .message-status {
            font-size: 11px;
        }

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

        .attachment {
            margin-bottom: 4px;
        }

        .attachment a {
            font-size: 13px;
            text-decoration: underline;
        }

        /* INPUT AREA */
        .message-input-container {
            padding: 8px 12px;
            background: #f0f0f0;
            border-top: 1px solid #d1d1d1;
            flex-shrink: 0;
        }

        .message-input-wrapper {
            display: flex;
            align-items: flex-end;
            gap: 8px;
            background: #ffffff;
            border-radius: 24px;
            padding: 6px 10px;
            border: 1px solid #ddd;
        }

        .message-input-wrapper:focus-within {
            border-color: #ff4b8d;
            box-shadow: 0 0 0 2px rgba(255, 75, 141, 0.2);
        }

        #messageInput {
            flex: 1;
            border: none;
            outline: none;
            resize: none;
            max-height: 120px;
            font-size: 14px;
            line-height: 1.4;
            background: transparent;
            font-family: inherit;
        }

        #sendMessageBtn {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            border: none;
            cursor: pointer;
            background: linear-gradient(135deg, #ff4b8d, #ff6b9d);
            color: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 3px 8px rgba(255, 75, 141, 0.4);
            transition: transform 0.1s ease, box-shadow 0.1s ease;
        }

        #sendMessageBtn:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 10px rgba(255, 75, 141, 0.5);
        }

        #sendMessageBtn:active {
            transform: translateY(0);
            box-shadow: 0 1px 4px rgba(255, 75, 141, 0.4);
        }

        /* EMPTY / ERROR STATES + SKELETONS */
        .empty-conversations {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 40px 20px;
            text-align: center;
            color: #666;
        }

        .empty-icon {
            font-size: 50px;
            margin-bottom: 10px;
            opacity: 0.6;
        }

        .empty-conversations h3 {
            margin: 0 0 8px 0;
            font-size: 18px;
            font-weight: 600;
        }

        .empty-conversations p {
            margin: 0 0 16px 0;
            font-size: 14px;
        }

        .start-chatting-btn {
            border: none;
            border-radius: 20px;
            padding: 8px 18px;
            background: linear-gradient(135deg, #ff4b8d, #ff6b9d);
            color: #fff;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
        }

        .loading-conversations {
            padding: 16px;
        }

        .conversation-skeleton {
            display: flex;
            align-items: center;
            padding: 8px 0;
            animation: pulse 1.3s ease-in-out infinite;
        }

        .avatar-skeleton {
            width: 44px;
            height: 44px;
            border-radius: 50%;
            background: #e0e0e0;
            margin-right: 10px;
        }

        .info-skeleton {
            flex: 1;
        }

        .line-skeleton {
            height: 10px;
            background: #e0e0e0;
            border-radius: 4px;
            margin-bottom: 6px;
        }

        .line-skeleton.short {
            width: 60%;
        }

        @keyframes pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.5; }
        }

        /* Scrollbars */
        .conversations-list::-webkit-scrollbar,
        .messages-list::-webkit-scrollbar {
            width: 6px;
        }
        .conversations-list::-webkit-scrollbar-thumb,
        .messages-list::-webkit-scrollbar-thumb {
            background: #ccc;
            border-radius: 3px;
        }

        /* 📱 MOBILE LAYOUT */
        @media (max-width: 768px) {
            .messages-container {
                max-width: 100%;
                margin: 56px 0 0;
                height: calc(100vh - 56px);
                border-radius: 0;
            }

            .conversations-sidebar {
                width: 100%;
                min-width: 0;
            }

            .messages-main {
                position: absolute;
                inset: 0;
                display: none; /* hidden by default on mobile */
            }

            .messages-container.chat-open .messages-main {
                display: flex;
            }

            .messages-container.chat-open .conversations-sidebar {
                display: none;
            }

            .back-btn {
                display: inline-flex;
                align-items: center;
                justify-content: center;
            }

            .messages-header {
                padding: 8px 10px;
            }

            .message-bubble {
                max-width: 80%;
            }
        }

        @media (max-width: 480px) {
            .messages-list {
                padding: 10px 12px;
            }

            .conversation-item {
                padding: 8px 10px;
            }

            .conversation-avatar {
                width: 40px;
                height: 40px;
            }

            .message-bubble {
                max-width: 85%;
            }
        }