/* Main Chat Box */
#miniapp-chat-box {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    background: #ffffff;
    border: 1px solid #dcdcdc;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    height: 80vh;
    overflow: hidden;
    font-family: sans-serif;
}

/* Header */
.miniapp-header {
    background: #f5f5f5;
    padding: 12px;
    border-bottom: 1px solid #ddd;
    text-align: right;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#miniapp-edit-profile-btn {
    background: #0088cc;
    color: #fff;
    padding: 5px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}
#miniapp-edit-profile-btn:hover {
    background: #0074ad;
}

/* Messages Area */
#miniapp-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background: #e7ebf0;
}

/* Message Bubbles */
.miniapp-msg-bubble {
    max-width: 75%;
    padding: 6px 10px;
    margin: 8px 0;
    border-radius: 10px;
    clear: both;
}

.miniapp-msg-bubble.mine {
    background: #d2f8d2;
    margin-left: auto;
    text-align: right;
}

.miniapp-msg-bubble.theirs {
    background: #ffffff;
    margin-right: auto;
    text-align: left;
}

/* Message Header */
.miniapp-msg-header {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 3px;
}

/* Message Text */
.miniapp-msg-text {
    font-size: 15px;
    white-space: pre-wrap;
}

/* Input Area */
.miniapp-input-area {
    border-top: 1px solid #ccc;
    background: #fafafa;
    padding: 10px;
    display: flex;
    gap: 10px;
}

#miniapp-message {
    flex: 1;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
}

#miniapp-send-btn {
    background: #0088cc;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
}
#miniapp-send-btn:hover {
    background: #0074ad;
}

/* Popup Background */
.miniapp-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.35);
    justify-content: center;
    align-items: center;
    z-index: 999;
}

/* Popup Container */
.miniapp-popup-content {
    background: #fff;
    width: 90%;
    max-width: 350px;
    padding: 20px;
    border-radius: 10px;
}

/* Popup Elements */
.miniapp-popup-content h3 {
    text-align: center;
    margin-bottom: 15px;
}

.miniapp-popup-content input {
    width: 100%;
    padding: 8px;
    margin: 5px 0 12px 0;
    border: 1px solid #ccc;
    border-radius: 6px;
}

.miniapp-popup-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}

#miniapp-save-profile, #miniapp-close-profile {
    flex: 1;
    padding: 8px 10px;
    border: none;
    border-radius: 6px;
    margin: 0 5px;
    cursor: pointer;
}

#miniapp-save-profile {
    background: #4caf50;
    color: #fff;
}
#miniapp-save-profile:hover {
    background: #449f47;
}

#miniapp-close-profile {
    background: #aaa;
    color: #fff;
}
#miniapp-close-profile:hover {
    background: #8c8c8c;
}

/* Popup Note */
.miniapp-note {
    font-size: 12px;
    color: #777;
    margin-top: 12px;
    text-align: center;
}

/* Scrollbar (for beauty) */
#miniapp-messages::-webkit-scrollbar {
    width: 8px;
}
#miniapp-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}
/* Glass Popup */
.miniapp-popup-content.glass {
    background: rgba(255,255,255,0.18);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255,255,255,0.35);
    color: #fff;
}

/* Tabs */
.miniapp-popup-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.miniapp-tab-btn {
    flex: 1;
    padding: 8px;
    border-radius: 8px;
    border: none;
    background: rgba(255,255,255,0.25);
    color: #fff;
    cursor: pointer;
    font-weight: bold;
}
.miniapp-tab-btn.active {
    background: rgba(255,255,255,0.5);
}

/* Tab content */
.miniapp-tab-content {
    display: none;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 10px;
}
.miniapp-tab-content.active {
    display: block;
}

/* Emoji Grid */
.miniapp-emoji-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}

.miniapp-emoji-grid div {
    font-size: 24px;
    background: rgba(255,255,255,0.22);
    padding: 6px;
    text-align: center;
    border-radius: 6px;
    cursor: pointer;
}
.miniapp-emoji-grid div.selected {
    border: 2px solid #fff;
}
.miniapp-delete-btn {
    float: left;
    color: #d00;
    font-weight: bold;
    margin-left: 8px;
    cursor: pointer;
    font-size: 18px;
}
.miniapp-delete-btn:hover {
    color: #a00;
}
.miniapp-msg-time {
    font-size: 11px;
    color: #555;
    margin-top: 4px;
    text-align: right;
}
