#kef-plugin-container,
#kef-plugin-container * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

#kef-plugin-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.kef-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 120px;
    height: 48px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
    transition: all 0.3s ease;
}

.kef-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.5);
}

.kef-btn-icon {
    font-size: 18px;
}

.kef-btn-text {
    display: inline;
}

.kef-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 20px;
    height: 20px;
    background: #f44336;
    color: white;
    border-radius: 10px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    font-weight: bold;
}

.kef-panel {
    position: absolute;
    bottom: 60px;
    right: 0;
    width: 360px;
    max-height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.kef-panel.show {
    display: flex;
}

.kef-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
}

.kef-tabs {
    display: flex;
    gap: 8px;
}

.kef-tab {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.kef-tab.active {
    background: white;
    color: #4CAF50;
}

.kef-tab:hover {
    background: rgba(255, 255, 255, 0.3);
}

.kef-tab-content {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.kef-tab-content.active {
    display: flex;
}

.kef-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f8f8f8;
    border-bottom: 1px solid #eee;
}

.kef-chat-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
}

.kef-chat-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kef-chat-name {
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.kef-chat-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #666;
}

.kef-friend-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 12px 16px;
    background: #f8f8f8;
    border-bottom: 1px solid #eee;
}

.kef-add-btn {
    padding: 6px 12px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.3s;
}

.kef-add-btn:hover {
    background: #45a049;
}

.kef-friend-list {
    flex: 1;
    overflow-y: auto;
    background: white;
}

.kef-friend-loading {
    padding: 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

.kef-friend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

.kef-friend-item:hover {
    background: #f5f5f5;
}

.kef-friend-item-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: white;
}

.kef-friend-item-info {
    flex: 1;
    min-width: 0;
}

.kef-friend-item-name {
    font-size: 15px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

.kef-friend-item-status {
    font-size: 12px;
    color: #999;
}

.kef-friend-actions {
    display: flex;
    gap: 8px;
}

.kef-friend-action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.kef-friend-action-btn.accept {
    background: #4CAF50;
    color: white;
}

.kef-friend-action-btn.accept:hover {
    background: #45a049;
}

.kef-friend-action-btn.reject {
    background: #f0f0f0;
    color: #666;
}

.kef-friend-action-btn.reject:hover {
    background: #e0e0e0;
}

.kef-requests-btn {
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
}

.kef-requests-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.kef-friend-requests {
    flex: 1;
    overflow-y: auto;
}

.kef-friend-chat {
    display: none;
    flex-direction: column;
    height: 100%;
}

.kef-friend-chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #f8f8f8;
    border-bottom: 1px solid #eee;
}

.kef-back-btn {
    background: none;
    border: none;
    font-size: 14px;
    color: #4CAF50;
    cursor: pointer;
    padding: 4px 8px;
}

.kef-back-btn:hover {
    color: #45a049;
}

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

.kef-friend-chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
}

.kef-friend-chat-name {
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.kef-search-result {
    margin-top: 16px;
    max-height: 200px;
    overflow-y: auto;
}

.kef-search-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #f8f8f8;
    border-radius: 8px;
    margin-bottom: 8px;
}

.kef-search-item-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.kef-search-item-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
}

.kef-search-item-name {
    font-size: 14px;
    color: #333;
}

.kef-search-add-btn {
    padding: 4px 12px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
}

.kef-search-add-btn:hover {
    background: #45a049;
}

.kef-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
}

.kef-status-dot.online {
    background: #4CAF50;
}

.kef-close-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.kef-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.kef-message-list {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f5f5f5;
}

.kef-message-list::-webkit-scrollbar {
    width: 6px;
}

.kef-message-list::-webkit-scrollbar-track {
    background: transparent;
}

.kef-message-list::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.kef-welcome-message {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.kef-welcome-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #4CAF50;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.kef-welcome-content {
    background: white;
    padding: 12px 16px;
    border-radius: 0 12px 12px 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.kef-welcome-content p {
    font-size: 14px;
    color: #333;
    line-height: 1.5;
}

.kef-message {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease;
}

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

.kef-message.self {
    flex-direction: row-reverse;
}

.kef-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ddd;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.kef-message.self .kef-message-avatar {
    background: #4CAF50;
}

.kef-message-content {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-all;
}

.kef-message:not(.self) .kef-message-content {
    background: white;
    color: #333;
    border-radius: 0 12px 12px 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.kef-message.self .kef-message-content {
    background: #4CAF50;
    color: white;
    border-radius: 12px 0 12px 12px;
}

.kef-message-time {
    font-size: 10px;
    color: #999;
    margin-top: 4px;
    text-align: right;
}

.kef-message.self .kef-message-time {
    text-align: left;
}

.kef-input-area {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #eee;
}

.kef-input {
    flex: 1;
    height: 40px;
    padding: 0 16px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.kef-input:focus {
    border-color: #4CAF50;
}

.kef-input::placeholder {
    color: #999;
}

.kef-send-btn {
    width: 70px;
    height: 40px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.kef-send-btn:hover {
    background: #45a049;
}

.kef-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.kef-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.kef-modal-content {
    width: 320px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.kef-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: #f8f8f8;
    border-bottom: 1px solid #eee;
}

.kef-modal-header h3 {
    font-size: 18px;
    color: #333;
}

.kef-modal-header .kef-close-btn {
    background: transparent;
    color: #999;
    font-size: 24px;
}

.kef-modal-header .kef-close-btn:hover {
    color: #333;
}

.kef-modal-body {
    padding: 20px;
}

.kef-form-group {
    margin-bottom: 16px;
}

.kef-form-group label {
    display: block;
    font-size: 14px;
    color: #333;
    margin-bottom: 6px;
}

.kef-form-input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.kef-form-input:focus {
    border-color: #4CAF50;
}

.kef-login-btn {
    width: 100%;
    height: 44px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.3s;
}

.kef-login-btn:hover {
    background: #45a049;
}

.kef-modal-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    font-size: 13px;
    color: #666;
}

.kef-link-btn {
    background: none;
    border: none;
    color: #4CAF50;
    cursor: pointer;
    font-size: 13px;
    text-decoration: underline;
}

.kef-link-btn:hover {
    color: #45a049;
}

.kef-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 480px) {
    #kef-plugin-container {
        bottom: 20px;
        right: 20px;
    }

    .kef-btn {
        width: 50px;
        height: 50px;
        border-radius: 50%;
    }

    .kef-btn-text {
        display: none;
    }

    .kef-panel {
        width: calc(100vw - 40px);
        max-height: 70vh;
        right: 10px;
    }
}