/* Minimal Chat Widget */
#am-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

#am-chat-trigger {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: white;
    font-size: 24px;
    position: relative;
}

#am-chat-trigger:hover {
    transform: scale(1.1);
}

#am-chat-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: bold;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    display: none; /* Hidden by default */
}

#am-chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    display: none; /* Hidden by default */
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

/* Header */
.am-chat-header {
    padding: 15px 20px;
    background: rgba(15, 23, 42, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.am-chat-title {
    font-weight: 700;
    font-size: 16px;
    color: #f8fafc;
}

.am-chat-close {
    cursor: pointer;
    color: #94a3b8;
    transition: color 0.2s;
}

.am-chat-close:hover {
    color: #f8fafc;
}

/* Tabs */
.am-chat-tabs {
    display: flex;
    padding: 10px 15px;
    gap: 10px;
    background: rgba(15, 23, 42, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.am-chat-tab {
    flex: 1;
    text-align: center;
    padding: 8px 2px;
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.am-chat-tab.active {
    background: rgba(255, 255, 255, 0.05);
    color: #6366f1;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Body */
.am-chat-body {
    flex: 1;
    overflow-y: auto;
    background: transparent;
    position: relative;
}

/* Lists */
.am-chat-list-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.am-chat-list-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.am-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #334155;
    margin-right: 12px;
    object-fit: cover;
}

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

.am-chat-name {
    font-weight: 600;
    font-size: 14px;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.am-chat-status {
    font-size: 12px;
    color: #64748b;
}

/* Messages Area */
.am-chat-messages-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    display: none;
}

/* Messages List */
.am-chat-messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.am-chat-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.am-chat-msg.sent {
    align-self: flex-end;
    background: #4f46e5;
    color: white;
    border-bottom-right-radius: 4px;
}

.am-chat-msg.received {
    align-self: flex-start;
    background: #1e293b;
    color: #f1f5f9;
    border-bottom-left-radius: 4px;
}

.am-chat-msg.system {
    align-self: center;
    background: rgba(254, 243, 199, 0.1);
    color: #fbbf24;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    border-radius: 8px;
    padding: 4px 12px;
    box-shadow: none;
    border: 1px solid rgba(251, 191, 36, 0.2);
    max-width: 90%;
    margin: 10px 0;
}

.am-chat-msg-time {
    font-size: 10px;
    margin-top: 4px;
    opacity: 0.7;
    text-align: right;
}

/* Input Area */
.am-chat-input-area {
    padding: 10px 15px;
    background: rgba(15, 23, 42, 0.8);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 8px;
    align-items: center;
    position: relative;
}

.am-chat-input {
    flex: 1;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(30, 41, 59, 0.5);
    color: #fff;
    border-radius: 20px;
    padding: 8px 15px;
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
}

.am-chat-input:focus {
    border-color: #6366f1;
    background: rgba(30, 41, 59, 0.8);
}

.am-chat-send-btn {
    background: #4f46e5;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.am-chat-send-btn:hover {
    background: #4338ca;
}

/* New Features */
.am-chat-action-btn {
    color: #64748b;
    cursor: pointer;
    font-size: 16px;
    padding: 6px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.am-chat-action-btn:hover {
    color: #6366f1;
    background: rgba(255, 255, 255, 0.05);
}

.am-emoji-picker {
    position: absolute;
    bottom: 60px;
    left: 10px;
    width: 260px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    display: none;
    z-index: 10001;
    padding: 12px;
}

.am-emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    max-height: 180px;
    overflow-y: auto;
}

.am-emoji-btn {
    font-size: 32px; /* Larger emojis */
    cursor: pointer;
    text-align: center;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.1s;
    user-select: none;
}

.am-emoji-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: scale(1.1);
}

/* Workflow Invite Style */
.am-invite-card {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 8px;
    padding: 10px;
    margin-top: 5px;
    max-width: 240px;
}

.am-invite-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: #93c5fd;
    font-weight: 600;
    font-size: 12px;
}

.am-invite-btn {
    display: block;
    background: #3b82f6;
    color: white;
    text-align: center;
    padding: 6px;
    border-radius: 6px;
    font-size: 11px;
    text-decoration: none;
    transition: background 0.2s;
}

.am-invite-btn:hover {
    background: #2563eb;
    color: white;
}

/* Search Results */
.am-search-results {
    padding: 10px;
}
.am-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(30, 41, 59, 0.5);
    color: #fff;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 13px;
}

.am-add-btn {
    padding: 4px 8px;
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.am-add-btn:hover {
    background: rgba(16, 185, 129, 0.2);
}

/* Mobile Responsive */
/* Minimal Toast */
.am-mini-toast {
    position: fixed;
    right: 24px;
    bottom: 90px;
    background: rgba(17, 24, 39, 0.95);
    color: #fff;
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.3;
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    z-index: 10000;
    max-width: 240px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.am-mini-toast .am-mini-title {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 12px;
}
.am-mini-toast .am-mini-text {
    opacity: 0.9;
    font-size: 12px;
}

/* Inline unread badge inside header */
.am-inline-unread {
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    margin-left: 6px;
}

@media (max-width: 480px) {
    #am-chat-window {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 80vh;
        border-radius: 16px 16px 0 0;
    }
}
